From 9a5a13a50615589dd85ad8b75aeb5999561d954e Mon Sep 17 00:00:00 2001 From: Manish Jethani Date: Tue, 17 Aug 2021 18:25:31 +0530 Subject: [PATCH] Add --full-battery option for tests (#3834) --- Makefile | 3 +++ platform/npm/package.json | 3 ++- platform/npm/test.js | 11 +++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1056d5802..e0dcdf111 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,9 @@ lint: npm test: npm 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) tools/make-dig.sh diff --git a/platform/npm/package.json b/platform/npm/package.json index b6291b37c..f38743893 100644 --- a/platform/npm/package.json +++ b/platform/npm/package.json @@ -7,7 +7,8 @@ "scripts": { "build": "node build.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": { "type": "git", diff --git a/platform/npm/test.js b/platform/npm/test.js index 5be784b92..10dc462b6 100644 --- a/platform/npm/test.js +++ b/platform/npm/test.js @@ -34,10 +34,17 @@ import { promisify } from 'util'; async function spawnMocha() { const files = [ '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() {