test: upgrade tap, configure coverage thresholds

As part of simplifying the CI setup I plan to not explicitly specify
`--jobs=4` to `tap` going forward. Upgrading to a newer version of `tap`
means that it will automatically parallelize jobs according to available
CPU count, which should be better anyway. Only one of our tests was
incompatible with newer versions of `tap`, so this commit includes a
compatibility fix there.

Also, by default newer versions of `tap` calculate coverage and consider
the test run to fail if below the configured thresholds. The default is
100% coverage and we're not there, so I adjusted the thresholds to match
where we're at for now. We can ratchet those up over time.
This commit is contained in:
Christopher Willis-Ford 2022-06-02 13:01:00 -07:00
parent c2c66a68d6
commit 05f8692300
3 changed files with 5783 additions and 6757 deletions

12515
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -34,6 +34,12 @@
"path": "cz-conventional-changelog" "path": "cz-conventional-changelog"
} }
}, },
"tap": {
"branches": 60,
"functions": 70,
"lines": 70,
"statements": 70
},
"dependencies": { "dependencies": {
"@vernier/godirect": "1.5.0", "@vernier/godirect": "1.5.0",
"arraybuffer-loader": "^1.0.6", "arraybuffer-loader": "^1.0.6",
@ -90,7 +96,7 @@
"scratch-svg-renderer": "0.2.0-prerelease.20210727023023", "scratch-svg-renderer": "0.2.0-prerelease.20210727023023",
"script-loader": "0.7.2", "script-loader": "0.7.2",
"stats.js": "0.17.0", "stats.js": "0.17.0",
"tap": "12.0.1", "tap": "16.2.0",
"tiny-worker": "2.3.0", "tiny-worker": "2.3.0",
"uglifyjs-webpack-plugin": "1.2.7", "uglifyjs-webpack-plugin": "1.2.7",
"webpack": "4.46.0", "webpack": "4.46.0",

View file

@ -6,12 +6,11 @@ const test = tap.test;
let originals; let originals;
let newBlocks; let newBlocks;
tap.beforeEach(done => { tap.beforeEach(() => {
originals = simpleStack; originals = simpleStack;
// Will be mutated so make a copy first // Will be mutated so make a copy first
newBlocks = JSON.parse(JSON.stringify(simpleStack)); newBlocks = JSON.parse(JSON.stringify(simpleStack));
newBlockIds(newBlocks); newBlockIds(newBlocks);
done();
}); });