Skip to content

Commit

Permalink
Run lint and test concurrently (#2048)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
rajsite authored Apr 30, 2024
1 parent 5950f38 commit cd00c0c
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 8 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
@@ -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"
}
135 changes: 135 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down
7 changes: 6 additions & 1 deletion packages/nimble-components/karma.conf.verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion packages/spright-components/karma.conf.verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cd00c0c

Please sign in to comment.