deprecate-totp-2fa
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-test |
| 3 | section: 1 |
| 4 | description: Test a package |
| 5 | github_repo: npm/cli |
| 6 | github_branch: latest |
| 7 | github_path: docs/lib/content/commands/npm-test.md |
| 8 | redirect_from: |
| 9 | - /cli-commands/npm-test |
| 10 | - /cli-commands/test |
| 11 | - /cli-documentation/cli-commands/npm-test |
| 12 | - /cli-documentation/cli-commands/test |
| 13 | - /cli-documentation/commands/npm-test |
| 14 | - /cli-documentation/commands/test |
| 15 | - /cli-documentation/npm-test |
| 16 | - /cli-documentation/test |
| 17 | - /cli-documentation/v11/cli-commands/npm-test |
| 18 | - /cli-documentation/v11/cli-commands/test |
| 19 | - /cli-documentation/v11/commands/npm-test |
| 20 | - /cli-documentation/v11/commands/test |
| 21 | - /cli-documentation/v11/npm-test |
| 22 | - /cli-documentation/v11/test |
| 23 | - /cli/cli-commands/npm-test |
| 24 | - /cli/cli-commands/test |
| 25 | - /cli/commands/npm-test |
| 26 | - /cli/commands/test |
| 27 | - /cli/npm-test |
| 28 | - /cli/test |
| 29 | - /cli/v11/cli-commands/npm-test |
| 30 | - /cli/v11/cli-commands/test |
| 31 | - /cli/v11/commands/test |
| 32 | - /cli/v11/npm-test |
| 33 | - /cli/v11/test |
| 34 | - /commands/npm-test |
| 35 | - /commands/test |
| 36 | --- |
| 37 | |
| 38 | ### Synopsis |
| 39 | |
| 40 | ```bash |
| 41 | npm test [-- <args>] |
| 42 | |
| 43 | aliases: tst, t |
| 44 | ``` |
| 45 | |
| 46 | ### Description |
| 47 | |
| 48 | This runs a predefined command specified in the `"test"` property of a package's `"scripts"` object. |
| 49 | |
| 50 | ### Example |
| 51 | |
| 52 | ```json |
| 53 | { |
| 54 | "scripts": { |
| 55 | "test": "node test.js" |
| 56 | } |
| 57 | } |
| 58 | ``` |
| 59 | |
| 60 | ```bash |
| 61 | npm test |
| 62 | > npm@x.x.x test |
| 63 | > node test.js |
| 64 | |
| 65 | (test.js output would be here) |
| 66 | ``` |
| 67 | |
| 68 | ### Configuration |
| 69 | |
| 70 | #### `ignore-scripts` |
| 71 | |
| 72 | - Default: false |
| 73 | - Type: Boolean |
| 74 | |
| 75 | If true, npm does not run scripts specified in package.json files. |
| 76 | |
| 77 | Note that commands explicitly intended to run a particular script, such as `npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run` will still run their intended script if `ignore-scripts` is set, but they will _not_ run any pre- or post-scripts. |
| 78 | |
| 79 | #### `script-shell` |
| 80 | |
| 81 | - Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows |
| 82 | - Type: null or String |
| 83 | |
| 84 | The shell to use for scripts run with the `npm exec`, `npm run` and `npm init <package-spec>` commands. |
| 85 | |
| 86 | ### See Also |
| 87 | |
| 88 | - [npm run](/cli/v11/commands/npm-run) |
| 89 | - [npm scripts](/cli/v11/using-npm/scripts) |
| 90 | - [npm start](/cli/v11/commands/npm-start) |
| 91 | - [npm restart](/cli/v11/commands/npm-restart) |
| 92 | - [npm stop](/cli/v11/commands/npm-stop) |