1 ---
2 title: npm-install-test
3 section: 1
4 description: Install package(s) and run tests
5 github_repo: npm/cli
6 github_branch: release/v8
7 github_path: docs/lib/content/commands/npm-install-test.md
8 redirect_from:
9 - /cli-documentation/v8/cli-commands/install-test
10 - /cli-documentation/v8/cli-commands/npm-install-test
11 - /cli-documentation/v8/commands/install-test
12 - /cli-documentation/v8/commands/npm-install-test
13 - /cli-documentation/v8/install-test
14 - /cli-documentation/v8/npm-install-test
15 - /cli/v8/cli-commands/install-test
16 - /cli/v8/cli-commands/npm-install-test
17 - /cli/v8/commands/install-test
18 - /cli/v8/install-test
19 - /cli/v8/npm-install-test
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm install-test [<package-spec> ...]
26
27 alias: it
28 ```
29
30 ### Description
31
32 This command runs an `npm install` followed immediately by an `npm test`. It takes exactly the same arguments as `npm install`.
33
34 ### Configuration
35
36 #### `save`
37
38 - Default: `true` unless when using `npm update` where it defaults to `false`
39 - Type: Boolean
40
41 Save installed packages to a `package.json` file as dependencies.
42
43 When used with the `npm rm` command, removes the dependency from `package.json`.
44
45 Will also prevent writing to `package-lock.json` if set to `false`.
46
47 #### `save-exact`
48
49 - Default: false
50 - Type: Boolean
51
52 Dependencies saved to package.json will be configured with an exact version rather than using npm's default semver range operator.
53
54 #### `global`
55
56 - Default: false
57 - Type: Boolean
58
59 Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See [folders](/cli/v8/configuring-npm/folders) for more on the differences in behavior.
60
61 - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory.
62 - bin files are linked to `{prefix}/bin`
63 - man pages are linked to `{prefix}/share/man`
64
65 #### `global-style`
66
67 - Default: false
68 - Type: Boolean
69
70 Causes npm to install the package into your local `node_modules` folder with the same layout it uses with the global `node_modules` folder. Only your direct dependencies will show in `node_modules` and everything they depend on will be flattened in their `node_modules` folders. This obviously will eliminate some deduping. If used with `legacy-bundling`, `legacy-bundling` will be preferred.
71
72 #### `legacy-bundling`
73
74 - Default: false
75 - Type: Boolean
76
77 Causes npm to install the package such that versions of npm prior to 1.4, such as the one included with node 0.8, can install the package. This eliminates all automatic deduping. If used with `global-style` this option will be preferred.
78
79 #### `omit`
80
81 - Default: 'dev' if the `NODE_ENV` environment variable is set to 'production', otherwise empty.
82 - Type: "dev", "optional", or "peer" (can be set multiple times)
83
84 Dependency types to omit from the installation tree on disk.
85
86 Note that these dependencies _are_ still resolved and added to the `package-lock.json` or `npm-shrinkwrap.json` file. They are just not physically installed on disk.
87
88 If a package type appears in both the `--include` and `--omit` lists, then it will be included.
89
90 If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment variable will be set to `'production'` for all lifecycle scripts.
91
92 #### `strict-peer-deps`
93
94 - Default: false
95 - Type: Boolean
96
97 If set to `true`, and `--legacy-peer-deps` is not set, then _any_ conflicting `peerDependencies` will be treated as an install failure, even if npm could reasonably guess the appropriate resolution based on non-peer dependency relationships.
98
99 By default, conflicting `peerDependencies` deep in the dependency graph will be resolved using the nearest non-peer dependency specification, even if doing so will result in some packages receiving a peer dependency outside the range set in their package's `peerDependencies` object.
100
101 When such and override is performed, a warning is printed, explaining the conflict and the packages involved. If `--strict-peer-deps` is set, then this warning is treated as a failure.
102
103 #### `package-lock`
104
105 - Default: true
106 - Type: Boolean
107
108 If set to false, then ignore `package-lock.json` files when installing. This will also prevent _writing_ `package-lock.json` if `save` is true.
109
110 This configuration does not affect `npm ci`.
111
112 #### `foreground-scripts`
113
114 - Default: false
115 - Type: Boolean
116
117 Run all build scripts (ie, `preinstall`, `install`, and `postinstall`) scripts for installed packages in the foreground process, sharing standard input, output, and error with the main npm process.
118
119 Note that this will generally make installs run slower, and be much noisier, but can be useful for debugging.
120
121 #### `ignore-scripts`
122
123 - Default: false
124 - Type: Boolean
125
126 If true, npm does not run scripts specified in package.json files.
127
128 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.
129
130 #### `audit`
131
132 - Default: true
133 - Type: Boolean
134
135 When "true" submit audit reports alongside the current npm command to the default registry and all registries configured for scopes. See the documentation for [`npm audit`](/cli/v8/commands/npm-audit) for details on what is submitted.
136
137 #### `bin-links`
138
139 - Default: true
140 - Type: Boolean
141
142 Tells npm to create symlinks (or `.cmd` shims on Windows) for package executables.
143
144 Set to false to have it not do this. This can be used to work around the fact that some file systems don't support symlinks, even on ostensibly Unix systems.
145
146 #### `fund`
147
148 - Default: true
149 - Type: Boolean
150
151 When "true" displays the message at the end of each `npm install` acknowledging the number of dependencies looking for funding. See [`npm fund`](/cli/v8/commands/npm-fund) for details.
152
153 #### `dry-run`
154
155 - Default: false
156 - Type: Boolean
157
158 Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, `install`, `update`, `dedupe`, `uninstall`, as well as `pack` and `publish`.
159
160 Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc.
161
162 #### `workspace`
163
164 - Default:
165 - Type: String (can be set multiple times)
166
167 Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
168
169 Valid values for the `workspace` config are either:
170
171 - Workspace names
172 - Path to a workspace directory
173 - Path to a parent workspace directory (will result in selecting all workspaces within that folder)
174
175 When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
176
177 This value is not exported to the environment for child processes.
178
179 #### `workspaces`
180
181 - Default: null
182 - Type: null or Boolean
183
184 Set to true to run the command in the context of **all** configured workspaces.
185
186 Explicitly setting this to false will cause commands like `install` to ignore workspaces altogether. When not set explicitly:
187
188 - Commands that operate on the `node_modules` tree (install, update, etc.) will link workspaces into the `node_modules` folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, _unless_ one or more workspaces are specified in the `workspace` config.
189
190 This value is not exported to the environment for child processes.
191
192 #### `include-workspace-root`
193
194 - Default: false
195 - Type: Boolean
196
197 Include the workspace root when workspaces are enabled for a command.
198
199 When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project.
200
201 This value is not exported to the environment for child processes.
202
203 #### `install-links`
204
205 - Default: false
206 - Type: Boolean
207
208 When set file: protocol dependencies that exist outside of the project root will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces.
209
210 ### See Also
211
212 - [npm install](/cli/v8/commands/npm-install)
213 - [npm install-ci-test](/cli/v8/commands/npm-install-ci-test)
214 - [npm test](/cli/v8/commands/npm-test)