Skip to content

Commit

Permalink
Fix Test262 on MacOS / Node14
Browse files Browse the repository at this point in the history
Fixes #687 which prevented Test262 tests from running in my
MacOS/Node14 environment.
- if MacOS, use sysctl instead of nproc in ci_test.sh
- defend against undefined `globalThis.__coverage__`
  • Loading branch information
justingrant authored and ptomato committed Jun 19, 2020
1 parent 9cb326e commit 4481a79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion polyfill/ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ fi

cd test/

threads=$(nproc --ignore 1)
if [ "$(uname)" = 'Darwin' ]; then
threads=$(sysctl -n hw.logicalcpu)
else
threads=$(nproc --ignore 1)
fi
if [ $threads -gt 2 ]; then threads=2; fi

test262-harness \
Expand Down
2 changes: 1 addition & 1 deletion polyfill/test/transform.test262.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ const fs = require('fs');
const {v4: uuid} = require('uuid');
const filename = '../coverage/tmp/transformer/' + uuid() + '.json';
fs.mkdirSync('../coverage/tmp/transformer/', { recursive: true });
fs.writeFileSync(filename, JSON.stringify(globalThis.__coverage__), 'utf-8');
fs.writeFileSync(filename, JSON.stringify(globalThis.__coverage__ || {}), 'utf-8');
`;
};

0 comments on commit 4481a79

Please sign in to comment.