From cd00c0c1bf9bdfe7f066549d2baf123843c1badd Mon Sep 17 00:00:00 2001 From: Milan Raj Date: Tue, 30 Apr 2024 10:11:27 -0500 Subject: [PATCH] Run lint and test concurrently (#2048) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request ## ๐Ÿคจ Rationale The lint and test commands are independent from each other and can run in parallel. Running them in parallel shaves off 4-5 min from the build following the pattern in SystemLinkShared with minimal additional complexity. ## ๐Ÿ‘ฉโ€๐Ÿ’ป Implementation - Use `concurrently` cli to run lint and test in parallel - Reduce the verbosity of test output by not logging passing tests ## ๐Ÿงช Testing Rely on CI ## โœ… Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --- .github/workflows/main.yml | 7 +- ...-f0e44b94-faad-475f-84e4-c40c1c0b55e5.json | 7 + ...-5deebf64-20da-4165-8dbe-c8f9cbd69542.json | 7 + package-lock.json | 135 ++++++++++++++++++ package.json | 4 +- .../nimble-components/karma.conf.verbose.js | 7 +- .../spright-components/karma.conf.verbose.js | 7 +- 7 files changed, 166 insertions(+), 8 deletions(-) create mode 100644 change/@ni-nimble-components-f0e44b94-faad-475f-84e4-c40c1c0b55e5.json create mode 100644 change/@ni-spright-components-5deebf64-20da-4165-8dbe-c8f9cbd69542.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8a0c7e1a4a..eaaa035935 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -100,11 +100,8 @@ jobs: exitOnceUploaded: true # Do not wait for test results exitZeroOnChanges: true # Option to prevent the workflow from failing - # Lint - - run: npm run lint - - # Test - - run: npm run test + # Lint and Test + - run: npm run concurrently-lint-test # Run Lighthouse audit (from any push) - name: Performance Audit with Lighthouse CI diff --git a/change/@ni-nimble-components-f0e44b94-faad-475f-84e4-c40c1c0b55e5.json b/change/@ni-nimble-components-f0e44b94-faad-475f-84e4-c40c1c0b55e5.json new file mode 100644 index 0000000000..5dd4ec7e48 --- /dev/null +++ b/change/@ni-nimble-components-f0e44b94-faad-475f-84e4-c40c1c0b55e5.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Try some less verbose test flags", + "packageName": "@ni/nimble-components", + "email": "rajsite@users.noreply.github.com", + "dependentChangeType": "none" +} diff --git a/change/@ni-spright-components-5deebf64-20da-4165-8dbe-c8f9cbd69542.json b/change/@ni-spright-components-5deebf64-20da-4165-8dbe-c8f9cbd69542.json new file mode 100644 index 0000000000..95716efa89 --- /dev/null +++ b/change/@ni-spright-components-5deebf64-20da-4165-8dbe-c8f9cbd69542.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "Try some less verbose test flags", + "packageName": "@ni/spright-components", + "email": "rajsite@users.noreply.github.com", + "dependentChangeType": "none" +} diff --git a/package-lock.json b/package-lock.json index 91bc371855..191f8a43d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ ], "devDependencies": { "beachball": "^2.31.0", + "concurrently": "^8.2.2", "cross-env": "^7.0.3", "patch-package": "^8.0.0", "playwright": "1.42.0" @@ -13624,6 +13625,118 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, + "node_modules/concurrently": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-8.2.2.tgz", + "integrity": "sha512-1dP4gpXFhei8IOtlXRE/T/4H88ElHgTiUzh71YUmtjTEHMSRS2Z/fgOxHSxxusGHogsRfxNq1vyAwxSC+EVyDg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "date-fns": "^2.30.0", + "lodash": "^4.17.21", + "rxjs": "^7.8.1", + "shell-quote": "^1.8.1", + "spawn-command": "0.0.2", + "supports-color": "^8.1.1", + "tree-kill": "^1.2.2", + "yargs": "^17.7.2" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": "^14.13.0 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/concurrently/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concurrently/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/config-chain": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", @@ -14585,6 +14698,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/date-fns": { + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", + "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.21.0" + }, + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, "node_modules/date-format": { "version": "4.0.14", "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz", @@ -29654,6 +29783,12 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/spawn-command": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", + "integrity": "sha512-zC8zGoGkmc8J9ndvml8Xksr1Amk9qBujgbF0JAIWO7kXr43w0h/0GJNM/Vustixu+YE8N/MTrQ7N31FvHUACxQ==", + "dev": true + }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", diff --git a/package.json b/package.json index 3d260adc1b..5c22103c45 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "invoke-publish": "cross-env-shell beachball publish --yes --access public --message \\\"applying package updates [skip ci]\\\" -n $NPM_SECRET_TOKEN", "validate": "npm run build && npm run lint && npm run test", "performance": "npm run performance --workspaces --if-present", - "beachball-sync": "beachball sync" + "beachball-sync": "beachball sync", + "concurrently-lint-test": "concurrently --group \"npm run lint\" \"npm run test\"" }, "repository": { "type": "git", @@ -50,6 +51,7 @@ ], "devDependencies": { "beachball": "^2.31.0", + "concurrently": "^8.2.2", "cross-env": "^7.0.3", "patch-package": "^8.0.0", "playwright": "1.42.0" diff --git a/packages/nimble-components/karma.conf.verbose.js b/packages/nimble-components/karma.conf.verbose.js index c147a108bd..9471b63004 100644 --- a/packages/nimble-components/karma.conf.verbose.js +++ b/packages/nimble-components/karma.conf.verbose.js @@ -8,7 +8,12 @@ module.exports = config => { originalConfigFunction(config); const options = { plugins: [...config.plugins, 'karma-spec-reporter'], - reporters: [...config.reporters, 'spec'] + reporters: [...config.reporters, 'spec'], + specReporter: { + suppressPassed: true, + suppressSkipped: false, + showSpecTiming: true + } }; config.set(options); diff --git a/packages/spright-components/karma.conf.verbose.js b/packages/spright-components/karma.conf.verbose.js index c147a108bd..9471b63004 100644 --- a/packages/spright-components/karma.conf.verbose.js +++ b/packages/spright-components/karma.conf.verbose.js @@ -8,7 +8,12 @@ module.exports = config => { originalConfigFunction(config); const options = { plugins: [...config.plugins, 'karma-spec-reporter'], - reporters: [...config.reporters, 'spec'] + reporters: [...config.reporters, 'spec'], + specReporter: { + suppressPassed: true, + suppressSkipped: false, + showSpecTiming: true + } }; config.set(options);