From b76cea10ecaf3d4a1f5ce2a00a4371bf94b200dc Mon Sep 17 00:00:00 2001 From: Anshuman Verma Date: Fri, 29 Mar 2019 13:18:49 +0530 Subject: [PATCH] chore(tests): updated test regex, some helper scripts (#809) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ISSUES CLOSED: #808 **What kind of change does this PR introduce?** Updated test regex to run all tests, added some helper scripts for running tests **Did you add tests for your changes?** Yes **If relevant, did you update the documentation?** Yes **Summary** * Updated tests regex to run all tests * Added helper scripts to run cli and package tests separately **Does this PR introduce a breaking change?** No **Other information** --- .github/CONTRIBUTING.md | 24 +++++++++++++++++++ package.json | 7 +++++- .../stats/single-config/single-config.test.js | 4 ++-- .../info-verbosity-off.test.js | 2 +- .../info-verbosity-verbose.test.js | 2 +- .../multi-config-watch-opt.test.js | 2 +- .../watch/multi-config/multi-config.test.js | 2 +- .../single-config-watch-opt.test.js | 2 +- .../watch/single-config/single-config.test.js | 2 +- 9 files changed, 38 insertions(+), 9 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 4ed7f17ccba..8f937259c0c 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -83,6 +83,18 @@ In case you are suggesting a new feature, we will match your idea with our curre npm run test ``` +* Run CLI tests with: + + ```bash + npm run test:cli + ``` + +* Run tests of all packages: + + ```bash + npm run test:packages + ``` + * Test a single CLI test case: ```bash @@ -110,6 +122,18 @@ In case you are suggesting a new feature, we will match your idea with our curre yarn test ``` +* Run CLI tests with: + + ```bash + yarn test:cli` + ``` + +* Run tests of all packages: + + ```bash + yarn test:packages + ``` + * Test a single CLI test case: ```bash diff --git a/package.json b/package.json index 06baa84f421..8e0eeb180fd 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,8 @@ "pretest": "npm run build && npm run lint && npm run tslint", "reportCoverage": "nyc report --reporter=json && codecov -f coverage/coverage-final.json --disable=gcov", "test": "nyc jest --maxWorkers=4 --reporters=default --reporters=jest-junit", + "test:cli": "nyc jest test/ --maxWorkers=4 --reporters=default --reporters=jest-junit", + "test:packages": "nyc jest packages/ --maxWorkers=4 --reporters=default --reporters=jest-junit", "test:ci": "nyc jest --maxWorkers=$(nproc) --reporters=default --reporters=jest-junit", "travis:integration": "npm run build && npm run test && npm run reportCoverage", "travis:lint": "npm run build && npm run lint && npm run tslint", @@ -76,7 +78,10 @@ "transform": { "^.+\\.(ts)?$": "ts-jest" }, - "testRegex": "/__tests__/.*\\.(test.js|test.ts)$", + "testRegex": [ + "/__tests__/.*\\.(test.js|test.ts)$", + "/test/.*\\.(test.js|test.ts)$" + ], "moduleFileExtensions": [ "ts", "js", diff --git a/test/binCases/stats/single-config/single-config.test.js b/test/binCases/stats/single-config/single-config.test.js index e7b29b4a12c..e8f50126247 100644 --- a/test/binCases/stats/single-config/single-config.test.js +++ b/test/binCases/stats/single-config/single-config.test.js @@ -6,8 +6,8 @@ jest.setTimeout(10E6); const { run, extractSummary } = require("../../../testUtils"); -test("single-config", async done => { - const { code, stdout, stderr } = await run(__dirname); +test("single-config", done => { + const { code, stdout, stderr } = run(__dirname); const summary = extractSummary(stdout); diff --git a/test/binCases/watch/info-verbosity-off/info-verbosity-off.test.js b/test/binCases/watch/info-verbosity-off/info-verbosity-off.test.js index 10313d086bf..bb416f354bd 100644 --- a/test/binCases/watch/info-verbosity-off/info-verbosity-off.test.js +++ b/test/binCases/watch/info-verbosity-off/info-verbosity-off.test.js @@ -28,7 +28,7 @@ afterEach(() => { } }); -test.skip("info-verbosity-off", async done => { +test.skip("info-verbosity-off", done => { var webpackProc = runAndGetWatchProc(__dirname, [ "--entry ", "./index.js", diff --git a/test/binCases/watch/info-verbosity-verbose/info-verbosity-verbose.test.js b/test/binCases/watch/info-verbosity-verbose/info-verbosity-verbose.test.js index c3ccd9102e4..5b6b3972189 100644 --- a/test/binCases/watch/info-verbosity-verbose/info-verbosity-verbose.test.js +++ b/test/binCases/watch/info-verbosity-verbose/info-verbosity-verbose.test.js @@ -28,7 +28,7 @@ afterEach(() => { } }); -test.skip("info-verbosity-verbose", async done => { +test.skip("info-verbosity-verbose", done => { const webpackProc = runAndGetWatchProc(__dirname, [ "--entry ", "./index.js", diff --git a/test/binCases/watch/multi-config-watch-opt/multi-config-watch-opt.test.js b/test/binCases/watch/multi-config-watch-opt/multi-config-watch-opt.test.js index 1b691428608..a89fb1b53e8 100644 --- a/test/binCases/watch/multi-config-watch-opt/multi-config-watch-opt.test.js +++ b/test/binCases/watch/multi-config-watch-opt/multi-config-watch-opt.test.js @@ -28,7 +28,7 @@ afterEach(() => { } }); -test.skip("multi-config-watch-opt", async done => { +test.skip("multi-config-watch-opt", done => { const webpackProc = runAndGetWatchProc(__dirname, [ "--entry", "./index.js", diff --git a/test/binCases/watch/multi-config/multi-config.test.js b/test/binCases/watch/multi-config/multi-config.test.js index fbb4f055d58..7738b81472d 100644 --- a/test/binCases/watch/multi-config/multi-config.test.js +++ b/test/binCases/watch/multi-config/multi-config.test.js @@ -28,7 +28,7 @@ afterEach(() => { } }); -test.skip("multi-config", async done => { +test.skip("multi-config", done => { const webpackProc = runAndGetWatchProc(__dirname); // info-verbosity is set to info by default diff --git a/test/binCases/watch/single-config-watch-opt/single-config-watch-opt.test.js b/test/binCases/watch/single-config-watch-opt/single-config-watch-opt.test.js index 1d1ab6be2f5..47c512c47ce 100644 --- a/test/binCases/watch/single-config-watch-opt/single-config-watch-opt.test.js +++ b/test/binCases/watch/single-config-watch-opt/single-config-watch-opt.test.js @@ -28,7 +28,7 @@ afterEach(() => { } }); -test.skip("single-config-watch-opt", async done => { +test.skip("single-config-watch-opt", done => { const webpackProc = runAndGetWatchProc(__dirname, [ "--entry", "./index.js", diff --git a/test/binCases/watch/single-config/single-config.test.js b/test/binCases/watch/single-config/single-config.test.js index 51fca537634..1865cd130a9 100644 --- a/test/binCases/watch/single-config/single-config.test.js +++ b/test/binCases/watch/single-config/single-config.test.js @@ -28,7 +28,7 @@ afterEach(() => { } }); -test.skip("single-config", async(done) => { +test.skip("single-config", done => { const webpackProc = runAndGetWatchProc(__dirname, [ "--entry", "./index.js",