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

[tests] separate tests from linting and license validation #2682

Merged
merged 12 commits into from Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
57 changes: 43 additions & 14 deletions .github/workflows/ci.yml
Expand Up @@ -3,20 +3,54 @@ name: Node CI
on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
# Checkout the npm/cli repo
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install dependencies
run: |
node . install --ignore-scripts --no-audit
node . rebuild
- name: Run linting
run: node . run posttest
env:
DEPLOY_VERSION: testing

licenses:
runs-on: ubuntu-latest
steps:
# Checkout the npm/cli repo
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install dependencies
run: |
node . install --ignore-scripts --no-audit
node . rebuild
- name: Run linting
run: node . run licenses

build:
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
- 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:
Expand All @@ -42,7 +76,7 @@ jobs:
# Run the tests, but not if we're just gonna do coveralls later anyway
- name: Run Tap tests
if: matrix.platform.os != 'ubuntu-latest' || matrix.node-version != '12.x'
run: node . test -- -t600 -Rbase -c
run: node . run --ignore-scripts test -- -t600 -Rbase -c
env:
DEPLOY_VERSION: testing

Expand All @@ -58,8 +92,3 @@ jobs:
# - name: Run sudo tests on Linux
# if: matrix.os == 'ubuntu-latest'
# run: sudo PATH=$PATH $(which node) . test -- --coverage --timeout 600

# no need to check licenses everywhere, they don't change between versions
- name: Validate licenses
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '12.x'
run: node . run licenses
12 changes: 6 additions & 6 deletions docs/content/commands/npm-diff.md
Expand Up @@ -82,11 +82,11 @@ of files for packages published to the npm registry.
When using a single package name (with no version or tag specifier) as an
argument, `npm diff` will work in a similar way to
[`npm-outdated`](npm-outdated) and reach for the registry to figure out
what current published version of the package named <pkg-name> will satisfy
its dependent declared semver-range. Once that specific version is known
`npm diff` will print diff patches comparing the current version of
<pkg-name> found in the local file system with that specific version
returned by the registry.
what current published version of the package named `<pkg-name>`
will satisfy its dependent declared semver-range. Once that specific
version is known `npm diff` will print diff patches comparing the
current version of `<pkg-name>` found in the local file system with
that specific version returned by the registry.

Given a package named `abbrev` that is currently installed:

Expand Down Expand Up @@ -155,7 +155,7 @@ located within the folder `./lib/` and changed lines of code within the

#### diff

* Type: Array<String>
* Type: Array
* Default: null

Defines npm package specifiers to compare using the `npm diff` command.
Expand Down
2 changes: 1 addition & 1 deletion lib/run-script.js
Expand Up @@ -41,7 +41,7 @@ const runScript = async (args) => {

if (event === 'restart' && !scripts.restart)
scripts.restart = 'npm stop --if-present && npm start'
else if (event === 'env')
else if (event === 'env' && !scripts.env)
scripts.env = isWindowsShell ? 'SET' : 'env'

pkg.scripts = scripts
Expand Down
1 change: 0 additions & 1 deletion node_modules/.gitignore

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