Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace nps with npm scripts #5128

Merged
merged 31 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e5ea816
chore: WIP - replace `nps` with npm scripts
voxpelli Nov 7, 2023
624d954
Fix `mocha.yml` smoke run
voxpelli Mar 26, 2024
6f97c6b
Update npm-run-all2
voxpelli Jun 17, 2024
8a34a56
Add missing `git add` in version command
voxpelli Jun 17, 2024
42c5897
Merge remote-tracking branch 'origin/master' into voxpelli/issue5126
voxpelli Jun 17, 2024
e94fa5b
Fix spelling mistake that's fixed in master
voxpelli Jun 17, 2024
1eb3648
Log current test suite from karma
voxpelli Jun 17, 2024
e16d25d
Dedupe some npm scripts
voxpelli Jun 17, 2024
8aac6e0
Merge remote-tracking branch 'origin/main' into voxpelli/issue5126
voxpelli Jul 15, 2024
6105a8e
Merge remote-tracking branch 'origin/main' into voxpelli/issue5126
voxpelli Aug 1, 2024
4e3e05d
Add a matrix to run the individual node tests
voxpelli Aug 1, 2024
543d517
Speed: Leaner smoke tests
voxpelli Aug 1, 2024
d550948
Add another level of "smoke" tests
voxpelli Aug 1, 2024
56921a6
Temporary fix for coverage report run
voxpelli Aug 1, 2024
b1935c0
Ensure building mocha.js before integration tests
voxpelli Aug 1, 2024
f0243d0
Additional grouping level in test-node scripts
voxpelli Aug 1, 2024
4b80df2
Fix flag name for coverage to work with matrix
voxpelli Aug 1, 2024
1ab29e4
Skip coverage for `jsapi` for now
voxpelli Aug 1, 2024
8c95028
Port all node tests from nps to npm scripts
voxpelli Aug 2, 2024
7a01bf6
Remove unused coveralls module
voxpelli Aug 2, 2024
61ba911
Set FORCE_COLOR=3 in workflow
voxpelli Aug 2, 2024
560b35f
Try swapping `nyc` for `c8`
voxpelli Aug 2, 2024
0e19522
Remove FORCE_COLOR
voxpelli Aug 2, 2024
890993a
Docs updates
voxpelli Aug 2, 2024
6edd503
Port `docs` from nps to npm scripts + remove nps
voxpelli Aug 2, 2024
d16a8be
Fix markdown linting error
voxpelli Aug 2, 2024
083380d
Remove leftover console log
voxpelli Aug 2, 2024
3d34753
Revert "Try swapping `nyc` for `c8`"
voxpelli Aug 2, 2024
72a0026
Merge remote-tracking branch 'origin/main' into voxpelli/issue5126
voxpelli Aug 5, 2024
4c7c731
Followup fix to merge
voxpelli Aug 5, 2024
70bb03d
Remove special timeout
voxpelli Aug 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Then:
- **Do not modify** the root `mocha.js` file directly; it is automatically generated.
- Keep your PR focused.
Don't fix two things at once; don't upgrade dependencies unless necessary.
1. Before committing, run `npm start test`.
1. Before committing, run `npm test`.
- This will run both Node.js-based and browser-based tests.
- Ultimately, your pull request will be built on our continuous integration servers ([GitHub Actions](https://github.com/mochajs/mocha/actions?query=workflow%3A%22Tests%22)).
The first step to ensuring these checks pass is to test on your own machine.
Expand Down
2 changes: 0 additions & 2 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@ If you are having trouble, don't be afraid to [ask for help](./CONTRIBUTING.md#
- Do not use `yarn install` or `pnpm install`.
- Some optional dependencies may fail; you can safely ignore these unless you are trying to build the documentation.
- If you're sick of seeing the failures, run `npm install --ignore-scripts`.

> PRO TIP: After `npm install`, run `npm start` to see a list of commands which can be run with `npm start <command>` (powered by [nps](https://npm.im/nps)).
58 changes: 50 additions & 8 deletions .github/workflows/mocha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,67 @@ jobs:
smoke:
uses: ./.github/workflows/npm-script.yml
with:
os: 'ubuntu-latest,windows-2019'
node-versions: '14,16,18,20,22'
npm-script: test:smoke
node-versions: '14,22,lts/*'
npm-script: test-smoke

test-node:
test-node-lts:
voxpelli marked this conversation as resolved.
Show resolved Hide resolved
# TODO: Restore "mocha-github-actions-reporter" style reporting without relying on third party module
uses: ./.github/workflows/npm-script.yml
needs: smoke
strategy:
fail-fast: false
matrix:
test-part:
- interfaces
- unit
- integration
- jsapi
- requires
- reporters
- only
with:
npm-script: test-node:${{ matrix.test-part }}

test-node-all:
name: Test ${{ matrix.test-part }} in all environments
# TODO: Restore "mocha-github-actions-reporter" style reporting without relying on third party module
uses: ./.github/workflows/npm-script.yml
needs: test-node-lts
strategy:
fail-fast: false
matrix:
coverage: [true]
test-part:
- interfaces
- unit
- integration
- requires
- reporters
- only
include:
- test-part: jsapi
coverage: false
with:
os: 'ubuntu-latest,windows-2019'
node-versions: '14,16,18,20,22'
npm-script: test:node
coverage: true
npm-script: test-node:${{ matrix.test-part }}
coverage: ${{ matrix.coverage }}

test-node-upload-coverage:
needs: test-node-all
if: always()
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true

test-browser-local:
uses: ./.github/workflows/npm-script.yml
with:
browsers: ChromeHeadless
npm-script: test:browser
npm-script: test-browser

# test-browser-saucelabs:
# # Don't run forked 'pull_request' without saucelabs token
Expand All @@ -53,4 +95,4 @@ jobs:
# secrets: inherit
# with:
# browsers: 'firefox@latest,chrome@latest,MicrosoftEdge@latest,safari@latest'
# npm-script: test:browser
# npm-script: test-browser
14 changes: 2 additions & 12 deletions .github/workflows/npm-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,10 @@ jobs:
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
- name: Generate coverage report
if: always() && inputs.coverage
run: npm start coverage-report-lcov
run: npm run test-coverage-generate
- name: Coveralls Parallel
if: always() && inputs.coverage
uses: coverallsapp/github-action@v2
with:
flag-name: run-${{ join(matrix.*, '-') }}
flag-name: run-${{ inputs.npm-script }}-${{ join(matrix.*, '-') }}
parallel: true

upload-coverage:
needs: script
if: always() && inputs.coverage
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ _So you wanna build the site?_
## Development

1. Run `npm install` from working copy root to get Node.js deps.
1. To serve the site and rebuild as changes are made, execute `npm start docs.watch`.
1. To rebuild the site _once_, execute `npm start docs`.
1. To serve the site and rebuild as changes are made, execute `npm run docs-watch`.
1. To rebuild the site _once_, execute `npm run docs`.

### Notes

- The content lives in `docs/index.md`; everything else is markup, scripts, assets, etc.
- This file (`docs/README.md`) should _not_ be included in the build.
- `docs/_dist` is where the deployed site lives. `docs/_site` is essentially a build step. These directories are _not_ under version control.
- If you get the error message below when running `npm start docs`, follow [this guide](https://www.npmjs.com/package/gm) to install GraphicsMagick or ImageMagick.
- If you get the error message below when running `npm run docs`, follow [this guide](https://www.npmjs.com/package/gm) to install GraphicsMagick or ImageMagick.

```console
⚠ WARN: docs/_site/images/matomo-logo.png: Error executing Stream: The gm stream ended without emitting any data
Expand Down
2 changes: 2 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ module.exports = [
'docs/{_dist,_site,api,example}/**',
'out/**',
'test/integration/fixtures/**',
'.karma/**',
'mocha.js'
],
}
];
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module.exports = config => {
let cfg = {...baseConfig};

// TO RUN AGAINST SAUCELABS LOCALLY, execute:
// `CI=1 SAUCE_USERNAME=<user> SAUCE_ACCESS_KEY=<key> npm start test.browser`
// `CI=1 SAUCE_USERNAME=<user> SAUCE_ACCESS_KEY=<key> npm run test-browser`
let sauceConfig;

// configuration for CI mode
Expand Down
4 changes: 2 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

[build]
publish = "docs/_dist/"
command = "npm start docs.production"
command = "npm run docs-production"

[build.environment]
DEBUG = "mocha:docs*"
NODE_VERSION = "16"
RUBY_VERSION = "2.7.2"

[context.deploy-preview]
command = "npm start docs"
command = "npm run docs"
publish = "docs/_site/"
Loading
Loading