From ed14311174b285f9647f05b73d5e3b7bc9214992 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Mon, 2 Aug 2021 14:03:41 +1000 Subject: [PATCH 1/3] Run test tasks in parallel --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 70333e90e6..a49d698041 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "pretest:2-build-nim-waku": "[ -f './nim-waku/build/wakunode2' ] || run-s nim-waku:build", "nim-waku:build": "(cd nim-waku; NIMFLAGS=\"-d:chronicles_colors=off -d:chronicles_sinks=textlines -d:chronicles_log_level=TRACE\" make -j$(nproc --all 2>/dev/null || echo 2) wakunode2)", "nim-waku:force-build": "(cd nim-waku && rm -rf ./build/ ./vendor && make -j$(nproc --all 2>/dev/null || echo 2) update) && run-s nim-waku:build", - "test": "run-s build test:*", + "test": "npm-run-all build --parallel test:*", "test:lint": "eslint src --ext .ts", "test:prettier": "prettier \"src/**/*.ts\" \"./*.json\" \"*.conf.js\" --list-different", "test:spelling": "cspell \"{README.md,.github/*.md,src/**/*.ts}\"", From b828f7773c209d2cf90e66801b895d56e795f397 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Mon, 2 Aug 2021 14:11:05 +1000 Subject: [PATCH 2/3] Add helpers to test examples Keep a separate CI task. --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index a49d698041..c2aa2b5849 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "pretest": "run-s pretest:*", "pretest:1-init-git-submodules": "[ -f './nim-waku/build/wakunode2' ] || git submodule update --init --recursive", "pretest:2-build-nim-waku": "[ -f './nim-waku/build/wakunode2' ] || run-s nim-waku:build", + "examples:pretest": "for d in examples/*; do (cd $d; npm install); done", "nim-waku:build": "(cd nim-waku; NIMFLAGS=\"-d:chronicles_colors=off -d:chronicles_sinks=textlines -d:chronicles_log_level=TRACE\" make -j$(nproc --all 2>/dev/null || echo 2) wakunode2)", "nim-waku:force-build": "(cd nim-waku && rm -rf ./build/ ./vendor && make -j$(nproc --all 2>/dev/null || echo 2) update) && run-s nim-waku:build", "test": "npm-run-all build --parallel test:*", @@ -31,6 +32,7 @@ "test:spelling": "cspell \"{README.md,.github/*.md,src/**/*.ts}\"", "test:unit": "nyc --silent mocha", "test:karma": "karma start", + "examples:test": "run-s examples:pretest; for d in examples/*; do (cd $d; npm test;); done", "proto": "run-s proto:*", "proto:lint": "buf lint", "proto:build": "buf generate", From b8e7079b67a4b1783a6b8215c8fe1f118a4de405 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Mon, 2 Aug 2021 14:12:39 +1000 Subject: [PATCH 3/3] Run tests in parallel React build is quite long so best to run other linters in parallel. --- examples/eth-dm/package.json | 2 +- examples/web-chat/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/eth-dm/package.json b/examples/eth-dm/package.json index 405f819d9d..bf99fff6cc 100644 --- a/examples/eth-dm/package.json +++ b/examples/eth-dm/package.json @@ -28,7 +28,7 @@ "build:react": "react-scripts build", "eject": "react-scripts eject", "fix": "run-s fix:*", - "test": "run-s build test:*", + "test": "npm-run-all build --parallel test:*", "test:lint": "eslint src --ext .ts --ext .tsx", "test:prettier": "prettier \"src/**/*.{ts,tsx}\" \"./*.json\" --list-different", "test:spelling": "cspell \"{README.md,src/**/*.{ts,tsx},public/**/*.html}\" -c ../../.cspell.json", diff --git a/examples/web-chat/package.json b/examples/web-chat/package.json index 180eb49ea1..c657513661 100644 --- a/examples/web-chat/package.json +++ b/examples/web-chat/package.json @@ -32,7 +32,7 @@ "test:unit": "react-scripts test", "eject": "react-scripts eject", "fix": "run-s fix:*", - "test": "run-s build test:*", + "test": "npm-run-all build --parallel test:*", "test:lint": "eslint src --ext .ts --ext .tsx", "test:prettier": "prettier \"src/**/*.{ts,tsx}\" \"./*.json\" --list-different", "test:spelling": "cspell \"{README.md,.github/*.md,src/**/*.{ts,tsx},public/**/*.html}\" -c ../../.cspell.json",