Skip to content

Commit c44653a

Browse files
authored
chore: replace nps with npm scripts (#5128)
* chore: WIP - replace `nps` with npm scripts Fixes #5126
1 parent 1883c41 commit c44653a

File tree

11 files changed

+470
-2007
lines changed

11 files changed

+470
-2007
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Then:
8888
- **Do not modify** the root `mocha.js` file directly; it is automatically generated.
8989
- Keep your PR focused.
9090
Don't fix two things at once; don't upgrade dependencies unless necessary.
91-
1. Before committing, run `npm start test`.
91+
1. Before committing, run `npm test`.
9292
- This will run both Node.js-based and browser-based tests.
9393
- 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)).
9494
The first step to ensuring these checks pass is to test on your own machine.

.github/DEVELOPMENT.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@ If you are having trouble, don't be afraid to [ask for help](./CONTRIBUTING.md#
1616
- Do not use `yarn install` or `pnpm install`.
1717
- Some optional dependencies may fail; you can safely ignore these unless you are trying to build the documentation.
1818
- If you're sick of seeing the failures, run `npm install --ignore-scripts`.
19-
20-
> 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)).

.github/workflows/mocha.yml

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,67 @@ jobs:
2222
smoke:
2323
uses: ./.github/workflows/npm-script.yml
2424
with:
25-
os: 'ubuntu-latest,windows-2019'
26-
node-versions: '14,16,18,20,22'
27-
npm-script: test:smoke
25+
node-versions: '14,22,lts/*'
26+
npm-script: test-smoke
2827

29-
test-node:
28+
test-node-lts:
3029
# TODO: Restore "mocha-github-actions-reporter" style reporting without relying on third party module
3130
uses: ./.github/workflows/npm-script.yml
3231
needs: smoke
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
test-part:
36+
- interfaces
37+
- unit
38+
- integration
39+
- jsapi
40+
- requires
41+
- reporters
42+
- only
43+
with:
44+
npm-script: test-node:${{ matrix.test-part }}
45+
46+
test-node-all:
47+
name: Test ${{ matrix.test-part }} in all environments
48+
# TODO: Restore "mocha-github-actions-reporter" style reporting without relying on third party module
49+
uses: ./.github/workflows/npm-script.yml
50+
needs: test-node-lts
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
coverage: [true]
55+
test-part:
56+
- interfaces
57+
- unit
58+
- integration
59+
- requires
60+
- reporters
61+
- only
62+
include:
63+
- test-part: jsapi
64+
coverage: false
3365
with:
3466
os: 'ubuntu-latest,windows-2019'
3567
node-versions: '14,16,18,20,22'
36-
npm-script: test:node
37-
coverage: true
68+
npm-script: test-node:${{ matrix.test-part }}
69+
coverage: ${{ matrix.coverage }}
70+
71+
test-node-upload-coverage:
72+
needs: test-node-all
73+
if: always()
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Coveralls Finished
77+
uses: coverallsapp/github-action@v2
78+
with:
79+
parallel-finished: true
3880

3981
test-browser-local:
4082
uses: ./.github/workflows/npm-script.yml
4183
with:
4284
browsers: ChromeHeadless
43-
npm-script: test:browser
85+
npm-script: test-browser
4486

4587
# test-browser-saucelabs:
4688
# # Don't run forked 'pull_request' without saucelabs token
@@ -53,4 +95,4 @@ jobs:
5395
# secrets: inherit
5496
# with:
5597
# browsers: 'firefox@latest,chrome@latest,MicrosoftEdge@latest,safari@latest'
56-
# npm-script: test:browser
98+
# npm-script: test-browser

.github/workflows/npm-script.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,10 @@ jobs:
7575
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
7676
- name: Generate coverage report
7777
if: always() && inputs.coverage
78-
run: npm start coverage-report-lcov
78+
run: npm run test-coverage-generate
7979
- name: Coveralls Parallel
8080
if: always() && inputs.coverage
8181
uses: coverallsapp/github-action@v2
8282
with:
83-
flag-name: run-${{ join(matrix.*, '-') }}
83+
flag-name: run-${{ inputs.npm-script }}-${{ join(matrix.*, '-') }}
8484
parallel: true
85-
86-
upload-coverage:
87-
needs: script
88-
if: always() && inputs.coverage
89-
runs-on: ubuntu-latest
90-
steps:
91-
- name: Coveralls Finished
92-
uses: coverallsapp/github-action@v2
93-
with:
94-
parallel-finished: true

docs/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ _So you wanna build the site?_
1111
## Development
1212

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

1717
### Notes
1818

1919
- The content lives in `docs/index.md`; everything else is markup, scripts, assets, etc.
2020
- This file (`docs/README.md`) should _not_ be included in the build.
2121
- `docs/_site_` is where the deployed site lives. This directories are _not_ under version control.
22-
- See `package-scripts.js` for details on what the builds are actually doing.
2322

2423
## License
2524

eslint.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ module.exports = [
150150
'docs/{_dist,_site,api,example}/**',
151151
'out/**',
152152
'test/integration/fixtures/**',
153+
'.karma/**',
154+
'mocha.js'
153155
],
154156
}
155157
];

karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module.exports = config => {
8080
let cfg = {...baseConfig};
8181

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

8686
// configuration for CI mode

netlify.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
# that is where we will look for package.json/.nvmrc/etc not repo root!
1010

1111
[build]
12+
command = "npm run docs"
1213
publish = "docs/_site/"
13-
command = "npm start docs.production"
1414

1515
[build.environment]
1616
DEBUG = "mocha:docs*"
1717
NODE_VERSION = "16"
1818
RUBY_VERSION = "2.7.2"
1919

2020
[context.deploy-preview]
21-
command = "npm start docs"
21+
command = "npm run docs"
2222
publish = "docs/_site/"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy