1 ---
2 title: npm-test
3 section: 1
4 description: Test a package
5 github_repo: npm/cli
6 github_branch: release/v8
7 github_path: docs/lib/content/commands/npm-test.md
8 redirect_from:
9 - /cli-documentation/v8/cli-commands/npm-test
10 - /cli-documentation/v8/cli-commands/test
11 - /cli-documentation/v8/commands/npm-test
12 - /cli-documentation/v8/commands/test
13 - /cli-documentation/v8/npm-test
14 - /cli-documentation/v8/test
15 - /cli/v8/cli-commands/npm-test
16 - /cli/v8/cli-commands/test
17 - /cli/v8/commands/test
18 - /cli/v8/npm-test
19 - /cli/v8/test
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm test [-- <args>]
26
27 aliases: tst, t
28 ```
29
30 ### Description
31
32 This runs a predefined command specified in the `"test"` property of a package's `"scripts"` object.
33
34 ### Example
35
36 ```json
37 {
38 "scripts": {
39 "test": "node test.js"
40 }
41 }
42 ```
43
44 ```bash
45 npm test
46 > npm@x.x.x test
47 > node test.js
48
49 (test.js output would be here)
50 ```
51
52 ### Configuration
53
54 #### `ignore-scripts`
55
56 - Default: false
57 - Type: Boolean
58
59 If true, npm does not run scripts specified in package.json files.
60
61 Note that commands explicitly intended to run a particular script, such as `npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` will still run their intended script if `ignore-scripts` is set, but they will _not_ run any pre- or post-scripts.
62
63 #### `script-shell`
64
65 - Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
66 - Type: null or String
67
68 The shell to use for scripts run with the `npm exec`, `npm run` and `npm init <package-spec>` commands.
69
70 ### See Also
71
72 - [npm run-script](/cli/v8/commands/npm-run-script)
73 - [npm scripts](/cli/v8/using-npm/scripts)
74 - [npm start](/cli/v8/commands/npm-start)
75 - [npm restart](/cli/v8/commands/npm-restart)
76 - [npm stop](/cli/v8/commands/npm-stop)