Skip to content

Commit 97b4152

Browse files
committed
add smoke tests
Lightweight smoke test suite that runs common commands so that we can also have a holistic check during CI. PR-URL: #2959 Credit: @ruyadorno Close: #2959 Reviewed-by: @nlf
1 parent 59cf379 commit 97b4152

File tree

14 files changed

+1893
-2
lines changed

14 files changed

+1893
-2
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,48 @@ jobs:
3737
- name: Run linting
3838
run: node . run licenses
3939

40+
smoke-tests:
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
node-version: [10.x, 12.x, 14.x]
45+
platform:
46+
- os: ubuntu-latest
47+
shell: bash
48+
- os: macos-latest
49+
shell: bash
50+
- os: windows-latest
51+
shell: bash
52+
- os: windows-latest
53+
shell: powershell
54+
55+
runs-on: ${{ matrix.platform.os }}
56+
defaults:
57+
run:
58+
shell: ${{ matrix.platform.shell }}
59+
60+
steps:
61+
# Checkout the npm/cli repo
62+
- uses: actions/checkout@v2
63+
64+
# Installs the specific version of Node.js
65+
- name: Use Node.js ${{ matrix.node-version }}
66+
uses: actions/setup-node@v1
67+
with:
68+
node-version: ${{ matrix.node-version }}
69+
70+
# Run the installer script
71+
- name: Install dependencies
72+
run: |
73+
node . install --ignore-scripts --no-audit
74+
node . rebuild
75+
76+
# Run the smoke tests
77+
- name: Run Smoke tests
78+
run: node . run --ignore-scripts smoke-tests -- --no-check-coverage -t600 -Rbase -c
79+
env:
80+
DEPLOY_VERSION: testing
81+
4082
build:
4183
strategy:
4284
fail-fast: false

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,7 @@ docs/template.html
3939
Session.vim
4040
.nyc_output
4141
/.editorconfig
42+
43+
# don't ship smoke tests
44+
smoke-tests/
45+
tap-snapshots/smoke-tests-index.js-TAP.test.js

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ docs/content/using-npm/config.md: scripts/config-doc.js lib/utils/config/*.js
7676
test: dev-deps
7777
node bin/npm-cli.js test
7878

79+
smoke-tests: dev-deps
80+
node bin/npm-cli.js run smoke-tests
81+
7982
ls-ok:
8083
node . ls --production >/dev/null
8184

@@ -93,7 +96,7 @@ prune:
9396
@[[ "$(shell git status -s)" != "" ]] && echo "ERR: found unpruned files" && exit 1 || echo "git status is clean"
9497

9598

96-
publish: gitclean ls-ok link test docs prune
99+
publish: gitclean ls-ok link test smoke-tests docs prune
97100
@git push origin :v$(shell node bin/npm-cli.js --no-timing -v) 2>&1 || true
98101
git push origin $(BRANCH) &&\
99102
git push origin --tags &&\

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@
207207
"lint": "npm run eslint -- test/lib test/bin \"lib/**/*.js\"",
208208
"lintfix": "npm run lint -- --fix",
209209
"prelint": "rimraf test/npm_cache*",
210-
"resetdeps": "bash scripts/resetdeps.sh"
210+
"resetdeps": "bash scripts/resetdeps.sh",
211+
"smoke-tests": "tap smoke-tests/index.js"
211212
},
212213
"//": [
213214
"XXX temporarily only run unit tests while v7 beta is in progress",

0 commit comments

Comments
 (0)