From f8ee02f0b9474b7fd3a2c0543a90d836cafb3bd4 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 23 Feb 2023 15:13:36 -0800 Subject: [PATCH 1/5] Run lint in parallel with runtests and runtests-parallel --- .github/workflows/ci.yml | 2 +- Herebyfile.mjs | 22 ++++++++++++++++++---- scripts/build/options.mjs | 4 +++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 692d6b83a9408..689668ec19a44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: - run: npm ci - name: Tests - run: npm run test -- --bundle=${{ matrix.bundle }} + run: npm run test -- --no-lint --bundle=${{ matrix.bundle }} lint: runs-on: ubuntu-latest diff --git a/Herebyfile.mjs b/Herebyfile.mjs index 2ac34dfde47b5..9faeea5ed4ac9 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -569,12 +569,19 @@ export const watchLocal = task({ const runtestsDeps = [tests, generateLibs].concat(cmdLineOptions.typecheck ? [dts] : []); -export const runTests = task({ - name: "runtests", +const runTests = task({ + name: "runtests-nolint", description: "Runs the tests using the built run.js file.", dependencies: runtestsDeps, run: () => runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false), }); + +export const runTestsAndLint = task({ + name: "runtests", + description: "Runs the tests using the built run.js file, linting in parallel if --lint=true.", + dependencies: [runTests].concat(cmdLineOptions.lint ? [lint] : []), +}); + // task("runtests").flags = { // "-t --tests=": "Pattern for tests to run.", // " --failed": "Runs tests listed in '.failed-tests'.", @@ -702,12 +709,19 @@ export const runTestsAndWatch = task({ }, }); -export const runTestsParallel = task({ - name: "runtests-parallel", +const runTestsParallel = task({ + name: "runtests-parallel-nolint", description: "Runs all the tests in parallel using the built run.js file.", dependencies: runtestsDeps, run: () => runConsoleTests(testRunner, "min", /*runInParallel*/ cmdLineOptions.workers > 1), }); + +export const runTestsParallelAndLint = task({ + name: "runtests-parallel", + description: "Runs all the tests in parallel using the built run.js file, linting in parallel if --lint=true.", + dependencies: [runTestsParallel].concat(cmdLineOptions.lint ? [lint] : []), +}); + // task("runtests-parallel").flags = { // " --light": "Run tests in light mode (fewer verifications, but tests run faster).", // " --keepFailed": "Keep tests in .failed-tests even if they pass.", diff --git a/scripts/build/options.mjs b/scripts/build/options.mjs index 8c354552b10f9..43afde3db37be 100644 --- a/scripts/build/options.mjs +++ b/scripts/build/options.mjs @@ -4,7 +4,7 @@ import os from "os"; const ci = ["1", "true"].includes(process.env.CI ?? ""); const parsed = minimist(process.argv.slice(2), { - boolean: ["dirty", "light", "colors", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci", "bundle", "typecheck"], + boolean: ["dirty", "light", "colors", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci", "bundle", "typecheck", "lint"], string: ["browser", "tests", "break", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"], alias: { /* eslint-disable quote-props */ @@ -41,6 +41,7 @@ const parsed = minimist(process.argv.slice(2), { ci, bundle: true, typecheck: true, + lint: true, } }); @@ -86,5 +87,6 @@ export default options; * @property {string} break * @property {boolean} bundle * @property {boolean} typecheck + * @property {boolean} lint */ void 0; From d4f6a55104126d8a68d9f00e5b45a4258c530ca6 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 23 Feb 2023 15:15:49 -0800 Subject: [PATCH 2/5] rename tasks --- Herebyfile.mjs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Herebyfile.mjs b/Herebyfile.mjs index 9faeea5ed4ac9..69bcdfdc17f85 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -569,17 +569,17 @@ export const watchLocal = task({ const runtestsDeps = [tests, generateLibs].concat(cmdLineOptions.typecheck ? [dts] : []); -const runTests = task({ - name: "runtests-nolint", +const doRunTests = task({ + name: "do-runtests", description: "Runs the tests using the built run.js file.", dependencies: runtestsDeps, run: () => runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false), }); -export const runTestsAndLint = task({ +export const runTests = task({ name: "runtests", description: "Runs the tests using the built run.js file, linting in parallel if --lint=true.", - dependencies: [runTests].concat(cmdLineOptions.lint ? [lint] : []), + dependencies: [doRunTests].concat(cmdLineOptions.lint ? [lint] : []), }); // task("runtests").flags = { @@ -709,17 +709,17 @@ export const runTestsAndWatch = task({ }, }); -const runTestsParallel = task({ - name: "runtests-parallel-nolint", +const doRunTestsParallel = task({ + name: "do-runtests-parallel", description: "Runs all the tests in parallel using the built run.js file.", dependencies: runtestsDeps, run: () => runConsoleTests(testRunner, "min", /*runInParallel*/ cmdLineOptions.workers > 1), }); -export const runTestsParallelAndLint = task({ +export const runTestsParallel = task({ name: "runtests-parallel", description: "Runs all the tests in parallel using the built run.js file, linting in parallel if --lint=true.", - dependencies: [runTestsParallel].concat(cmdLineOptions.lint ? [lint] : []), + dependencies: [doRunTestsParallel].concat(cmdLineOptions.lint ? [lint] : []), }); // task("runtests-parallel").flags = { From eab35d1b72257ff4d38aa2f1001211a5b1ed713b Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 23 Feb 2023 17:23:00 -0800 Subject: [PATCH 3/5] Update .github/workflows/ci.yml Co-authored-by: Daniel Rosenwasser --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 689668ec19a44..109d0b7c32bce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,7 @@ jobs: - run: npm ci - name: Tests + # run tests, but lint separately run: npm run test -- --no-lint --bundle=${{ matrix.bundle }} lint: From 5b528efcbc6a6e14d05a481006d22f49eda4cea0 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 24 Feb 2023 10:17:03 -0800 Subject: [PATCH 4/5] Only do this for runtests-parallel --- Herebyfile.mjs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Herebyfile.mjs b/Herebyfile.mjs index 69bcdfdc17f85..9b492b6aeacfb 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -569,19 +569,13 @@ export const watchLocal = task({ const runtestsDeps = [tests, generateLibs].concat(cmdLineOptions.typecheck ? [dts] : []); -const doRunTests = task({ - name: "do-runtests", +export const runTests = task({ + name: "runtests", description: "Runs the tests using the built run.js file.", dependencies: runtestsDeps, run: () => runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false), }); -export const runTests = task({ - name: "runtests", - description: "Runs the tests using the built run.js file, linting in parallel if --lint=true.", - dependencies: [doRunTests].concat(cmdLineOptions.lint ? [lint] : []), -}); - // task("runtests").flags = { // "-t --tests=": "Pattern for tests to run.", // " --failed": "Runs tests listed in '.failed-tests'.", From 9b767b887afb6783b88e8bbc95e3c42c18fded33 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 24 Feb 2023 10:21:00 -0800 Subject: [PATCH 5/5] Revert whitespace change --- Herebyfile.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/Herebyfile.mjs b/Herebyfile.mjs index 9b492b6aeacfb..f3a53ee44c86e 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -575,7 +575,6 @@ export const runTests = task({ dependencies: runtestsDeps, run: () => runConsoleTests(testRunner, "mocha-fivemat-progress-reporter", /*runInParallel*/ false), }); - // task("runtests").flags = { // "-t --tests=": "Pattern for tests to run.", // " --failed": "Runs tests listed in '.failed-tests'.",