Skip to content

Commit 1107a4a

Browse files
committed
add ava-script to support old node
1 parent 4e4b0b5 commit 1107a4a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"postbuild": "run-s bundle",
1414
"bundle": "node ./scripts/rollup-script.js",
1515
"test": "run-s test:ava test:puppeteer:basic test:puppeteer:webpack",
16-
"test:ava": "cross-env TS_NODE_FILES=true ava",
16+
"test:ava": "cross-env TS_NODE_FILES=true ./scripts/ava-script.js",
1717
"test:puppeteer:basic": "puppet-run --plugin=mocha --bundle=./test/workers/:/workers/ --serve=./bundle/worker.js:/worker.js ./test/*.chromium*.ts",
1818
"test:puppeteer:webpack": "puppet-run --serve ./test/webpack/dist/app.web/0.worker.js --serve ./test/webpack/dist/app.web/1.worker.js --plugin=mocha ./test/webpack/webpack.chromium.mocha.ts",
1919
"posttest": "tslint --project .",

scripts/ava-script.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const child_process = require('child_process');
2+
const path = require('path')
3+
4+
if (parseFloat(process.version.match(/^v(\d+\.\d+)/)[1]) < 10) {
5+
child_process.spawnSync(`npm install ava@^2`, {stdio: 'inherit'})
6+
child_process.spawnSync(`node ${path.resolve('./node_modules/ava-old/cli.js')}`, {stdio: 'inherit'})
7+
} else {
8+
child_process.spawnSync(`node ${path.resolve('./node_modules/ava/cli.js')}`, {stdio: 'inherit'})
9+
}

0 commit comments

Comments
 (0)