Skip to content

Commit 1cde28d

Browse files
ptomatoMs2ger
authored andcommitted
Run test262 tests from a git submodule
Instead of an in-tree checkout use a git submodule of test262 so we can pin the tests to a particular commit and pull in updates when we are ready for them. Requires some changes in various paths. The tests that were currently marked as expected to fail were not added to upstream test262 yet, so they are removed from expected-failures.txt.
1 parent c447b41 commit 1cde28d

File tree

8 files changed

+20
-33
lines changed

8 files changed

+20
-33
lines changed

.github/workflows/test.yml

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
runs-on: ubuntu-latest
4242
steps:
4343
- uses: actions/checkout@v2
44+
with:
45+
submodules: true
4446
- name: use node.js v16.x
4547
uses: actions/setup-node@v1
4648
with:

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ polyfill/index.js
33
polyfill/index.js.map
44
polyfill/script.js
55
polyfill/script.js.map
6-
polyfill/test262/
76
polyfill/*.tgz
87
polyfill/venv
98
polyfill/coverage

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "polyfill/test262"]
2+
path = polyfill/test262
3+
url = https://github.com/tc39/test262

polyfill/ci_test.sh

+9-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
11
#!/bin/bash
22

3-
TESTS=${@:-"./*/**/*.js"}
3+
TESTS=${@:-"**/*.js"}
44
TIMEOUT=${TIMEOUT:-10000}
55
PRELUDE=${PRELUDE:-script.js}
66

77
export NODE_PATH=$PWD/node_modules
88
npm run build262
9-
if [ ! -d "test262" ]; then
10-
git clone --depth 1 https://github.com/tc39/test262.git
11-
else
12-
cd ./test262
13-
git fetch origin
14-
git merge --ff-only origin/master
15-
cd ..
16-
fi
179

1810
if [ "x$COVERAGE" = xyes ]; then
1911
nyc instrument "$PRELUDE" > script-instrumented.js
2012
PRELUDE=script-instrumented.js
21-
TRANSFORMER_ARG="--transformer ./transform.test262.js"
13+
TRANSFORMER_ARG="--transformer ../../test/transform.test262.js"
2214
fi
2315

24-
cd test/
16+
pushd test262/test/
2517

2618
if [ "$(uname)" = 'Darwin' ]; then
2719
threads=$(sysctl -n hw.logicalcpu)
@@ -30,22 +22,20 @@ else
3022
fi
3123
if [ $threads -gt 8 ]; then threads=8; fi
3224

33-
cp ./helpers/* ../test262/harness/
34-
3525
test262-harness \
3626
-t $threads \
3727
-r json \
3828
--reporter-keys file,rawResult,result,scenario \
39-
--test262Dir ../test262 \
40-
--prelude "../$PRELUDE" \
29+
--test262Dir .. \
30+
--prelude "../../$PRELUDE" \
4131
--timeout "$TIMEOUT" \
42-
--preprocessor ./preprocessor.test262.js \
32+
--preprocessor ../../test/preprocessor.test262.js \
4333
$TRANSFORMER_ARG \
44-
"$TESTS" \
45-
| ./parseResults.js
34+
"*/Temporal/$TESTS" \
35+
| ../../test/parseResults.js
4636
RESULT=$?
4737

48-
cd ..
38+
popd
4939

5040
if [ "x$COVERAGE" = xyes ]; then
5141
nyc report -t coverage/tmp/transformer --reporter=text-lcov > coverage/test262.lcov

polyfill/test/expected-failures.txt

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
# Bug: https://github.com/tc39/proposal-temporal/issues/1791
2-
Duration/constructor/compare/relativeto-string-datetime.js
3-
4-
# Blocked on https://github.com/tc39/proposal-temporal/issues/1685
5-
# (MoveRelativeDate should pass undefined as options)
6-
Duration/constructor/compare/calendar-dateadd-called-with-options-undefined.js
7-
Duration/prototype/round/calendar-dateadd-called-with-options-undefined.js
8-
Duration/prototype/total/calendar-dateadd-called-with-options-undefined.js
9-
ZonedDateTime/prototype/since/calendar-dateadd-called-with-options-undefined.js
10-
ZonedDateTime/prototype/until/calendar-dateadd-called-with-options-undefined.js
1+
# Blocked on https://github.com/tc39/test262/pull/3188
2+
built-ins/Temporal/Calendar/prototype/fields/long-input.js

polyfill/test/parseResults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let testOutput = '';
1212
const now = Date.now();
1313

1414
const expectedFailures = new Set();
15-
const lines = fs.readFileSync('expected-failures.txt', { encoding: 'utf-8' });
15+
const lines = fs.readFileSync('../../test/expected-failures.txt', { encoding: 'utf-8' });
1616
for (let line of lines.split('\n')) {
1717
line = line.trim();
1818
if (!line) continue;

polyfill/test/transform.test262.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ module.exports = function addCoverageOutput(code) {
22
return `${code}
33
const fs = require('fs');
44
const {v4: uuid} = require('uuid');
5-
const filename = '../coverage/tmp/transformer/' + uuid() + '.json';
6-
fs.mkdirSync('../coverage/tmp/transformer/', { recursive: true });
5+
const filename = '../../coverage/tmp/transformer/' + uuid() + '.json';
6+
fs.mkdirSync('../../coverage/tmp/transformer/', { recursive: true });
77
fs.writeFileSync(filename, JSON.stringify(globalThis.__coverage__ || {}), 'utf-8');
88
`;
99
};

polyfill/test262

Submodule test262 added at 56e537b

0 commit comments

Comments
 (0)