Skip to content

Commit

Permalink
add smoke tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ruyadorno committed Mar 25, 2021
1 parent 59cf379 commit 97b4152
Show file tree
Hide file tree
Showing 14 changed files with 1,893 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,48 @@ jobs:
- name: Run linting
run: node . run licenses

smoke-tests:
strategy:
fail-fast: false
matrix:
node-version: [10.x, 12.x, 14.x]
platform:
- os: ubuntu-latest
shell: bash
- os: macos-latest
shell: bash
- os: windows-latest
shell: bash
- os: windows-latest
shell: powershell

runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: ${{ matrix.platform.shell }}

steps:
# Checkout the npm/cli repo
- uses: actions/checkout@v2

# Installs the specific version of Node.js
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

# Run the installer script
- name: Install dependencies
run: |
node . install --ignore-scripts --no-audit
node . rebuild
# Run the smoke tests
- name: Run Smoke tests
run: node . run --ignore-scripts smoke-tests -- --no-check-coverage -t600 -Rbase -c
env:
DEPLOY_VERSION: testing

build:
strategy:
fail-fast: false
Expand Down
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ docs/template.html
Session.vim
.nyc_output
/.editorconfig

# don't ship smoke tests
smoke-tests/
tap-snapshots/smoke-tests-index.js-TAP.test.js
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ docs/content/using-npm/config.md: scripts/config-doc.js lib/utils/config/*.js
test: dev-deps
node bin/npm-cli.js test

smoke-tests: dev-deps
node bin/npm-cli.js run smoke-tests

ls-ok:
node . ls --production >/dev/null

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


publish: gitclean ls-ok link test docs prune
publish: gitclean ls-ok link test smoke-tests docs prune
@git push origin :v$(shell node bin/npm-cli.js --no-timing -v) 2>&1 || true
git push origin $(BRANCH) &&\
git push origin --tags &&\
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@
"lint": "npm run eslint -- test/lib test/bin \"lib/**/*.js\"",
"lintfix": "npm run lint -- --fix",
"prelint": "rimraf test/npm_cache*",
"resetdeps": "bash scripts/resetdeps.sh"
"resetdeps": "bash scripts/resetdeps.sh",
"smoke-tests": "tap smoke-tests/index.js"
},
"//": [
"XXX temporarily only run unit tests while v7 beta is in progress",
Expand Down
Loading

0 comments on commit 97b4152

Please # to comment.