forked from tc39/proposal-temporal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci_test.sh
executable file
·52 lines (41 loc) · 1.18 KB
/
ci_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
TESTS=${@:-"**/*.js"}
TIMEOUT=${TIMEOUT:-10000}
PRELUDE=${PRELUDE:-script.js}
export NODE_PATH=$PWD/node_modules
npm run build262
if [ "x$COVERAGE" = xyes ]; then
nyc instrument "$PRELUDE" > script-instrumented.js
PRELUDE=script-instrumented.js
TRANSFORMER_ARG="--transformer ../../test/transform.test262.js"
fi
if [ ! -d "$(dirname "$0")"/./test262/test/ ]; then
echo "Missing Test262 directory. Try initializing the submodule with 'git submodule init && git submodule update'";
exit 1;
fi
pushd test262/test/
if [ "$(uname)" = 'Darwin' ]; then
threads=$(sysctl -n hw.logicalcpu)
else
threads=$(nproc --ignore 1)
fi
if [ $threads -gt 8 ]; then threads=8; fi
test262-harness \
-t $threads \
-r json \
--reporter-keys file,rawResult,result,scenario \
--test262Dir .. \
--prelude "../../$PRELUDE" \
--timeout "$TIMEOUT" \
--preprocessor ../../test/preprocessor.test262.js \
$TRANSFORMER_ARG \
"*/Temporal/$TESTS" \
| ../../test/parseResults.js
RESULT=$?
popd
if [ "x$COVERAGE" = xyes ]; then
nyc report -t coverage/tmp/transformer --reporter=text-lcov > coverage/test262.lcov
fi
rm -f script-instrumented.js
rm -rf coverage/tmp/transformer
exit $RESULT