Add --full-battery option for tests (#3834)

This commit is contained in:
Manish Jethani 2021-08-17 18:25:31 +05:30 committed by GitHub
parent 14c8930ebb
commit 9a5a13a506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -37,6 +37,9 @@ lint: npm
test: npm test: npm
cd dist/build/uBlock0.npm && npm run test cd dist/build/uBlock0.npm && npm run test
test-full-battery: npm
cd dist/build/uBlock0.npm && npm run test-full-battery
dist/build/uBlock0.dig: tools/make-nodejs.sh $(sources) $(platform) $(assets) dist/build/uBlock0.dig: tools/make-nodejs.sh $(sources) $(platform) $(assets)
tools/make-dig.sh tools/make-dig.sh

View File

@ -7,7 +7,8 @@
"scripts": { "scripts": {
"build": "node build.js", "build": "node build.js",
"lint": "eslint js/ *.js tests/*.js", "lint": "eslint js/ *.js tests/*.js",
"test": "c8 --include=index.js --include=js/**/*.js node test.js --mocha" "test": "c8 --include=index.js --include=js/**/*.js node test.js --mocha",
"test-full-battery": "c8 --include=index.js --include=js/**/*.js node test.js --mocha --full-battery"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -34,10 +34,17 @@ import { promisify } from 'util';
async function spawnMocha() { async function spawnMocha() {
const files = [ const files = [
'tests/snfe.js', 'tests/snfe.js',
'tests/request-data.js',
]; ];
await promisify(spawn)('mocha', [ '--experimental-vm-modules', '--no-warnings', ...files, '--reporter', 'progress' ], { stdio: [ 'inherit', 'inherit', 'inherit' ] }); const options = [];
if ( process.argv[3] === '--full-battery' ) {
files.push('tests/request-data.js');
options.push('--reporter', 'progress');
}
await promisify(spawn)('mocha', [ '--experimental-vm-modules', '--no-warnings', ...files, ...options ], { stdio: [ 'inherit', 'inherit', 'inherit' ] });
} }
async function main() { async function main() {