Skip to content

Commit 537fc23

Browse files
author
chen ruixiang
committed
fix: reuse test task
1 parent e5bb6db commit 537fc23

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@
7171
"lint": "eslint --max-warnings 0 --ext js . && eslint --max-warnings 0 --ext ts .",
7272
"build": "node scripts/build",
7373
"watch": "node scripts/build --watch",
74-
"coverage": "ASC_FEATURES=\"*\" c8 npm run test:coverage",
74+
"coverage": "ASC_FEATURES=\"*\" ASC_COVERAGERUN=1 c8 npm run test",
7575
"test": "npm run test:parser && npm run test:compiler -- --parallel && npm run test:browser && npm run test:asconfig && npm run test:transform",
76-
"test:coverage": "npm run test:parser && npm run test:compiler && npm run test:browser && npm run test:asconfig && npm run test:transform",
7776
"test:parser": "node --enable-source-maps tests/parser",
7877
"test:compiler": "node --enable-source-maps --experimental-wasi-unstable-preview1 --no-warnings tests/compiler",
7978
"test:browser": "node --enable-source-maps tests/browser",

tests/compiler.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ if (args.help) {
7979
}
8080

8181
const features = process.env.ASC_FEATURES ? process.env.ASC_FEATURES.split(",") : [];
82+
//Disable parallel run during test coverage report generation
83+
const coverageRun = process.env.ASC_FEATURES ? true : false;
8284
const featuresConfig = require("./features.json");
8385
const basedir = path.join(dirname, "compiler");
8486

@@ -501,7 +503,7 @@ function evaluateResult(failedTests, skippedTests) {
501503
}
502504

503505
// Run tests in parallel if requested
504-
if (args.parallel && coreCount > 2) {
506+
if (args.parallel && coreCount > 2 && !coverageRun) {
505507
if (cluster.isWorker) {
506508
process.on("message", msg => {
507509
if (msg.cmd != "run") throw Error("invalid command: " + JSON.stringify(msg));

0 commit comments

Comments
 (0)