Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
npm-install-test.md425 linesDownload Raw Back to commands
1---
2title: npm-install-test
3section: 1
4description: Install package(s) and run tests
5---
6
7### Synopsis
8
9```bash
10npm install-test [<package-spec> ...]
11
12alias: it
13```
14
15### Description
16
17This command runs an `npm install` followed immediately by an `npm test`.
18It takes exactly the same arguments as `npm install`.
19
20### Configuration
21
22#### `save`
23
24* Default: `true` unless when using `npm update` where it defaults to `false`
25* Type: Boolean
26
27Save installed packages to a `package.json` file as dependencies.
28
29When used with the `npm rm` command, removes the dependency from
30`package.json`.
31
32Will also prevent writing to `package-lock.json` if set to `false`.
33
34
35
36#### `save-exact`
37
38* Default: false
39* Type: Boolean
40
41Dependencies saved to package.json will be configured with an exact version
42rather than using npm's default semver range operator.
43
44
45
46#### `global`
47
48* Default: false
49* Type: Boolean
50
51Operates in "global" mode, so that packages are installed into the `prefix`
52folder instead of the current working directory. See
53[folders](/configuring-npm/folders) for more on the differences in behavior.
54
55* packages are installed into the `{prefix}/lib/node_modules` folder, instead
56  of the current working directory.
57* bin files are linked to `{prefix}/bin`
58* man pages are linked to `{prefix}/share/man`
59
60
61
62#### `install-strategy`
63
64* Default: "hoisted"
65* Type: "hoisted", "nested", "shallow", or "linked"
66
67Sets the strategy for installing packages in node_modules. hoisted
68(default): Install non-duplicated in top-level, and duplicated as necessary
69within directory structure. nested: (formerly --legacy-bundling) install in
70place, no hoisting. shallow (formerly --global-style) only install direct
71deps at top-level. linked: (experimental) install in node_modules/.store,
72link in place, unhoisted.
73
74
75
76#### `legacy-bundling`
77
78* Default: false
79* Type: Boolean
80* DEPRECATED: This option has been deprecated in favor of
81  `--install-strategy=nested`
82
83Instead of hoisting package installs in `node_modules`, install packages in
84the same manner that they are depended on. This may cause very deep
85directory structures and duplicate package installs as there is no
86de-duplicating. Sets `--install-strategy=nested`.
87
88
89
90#### `global-style`
91
92* Default: false
93* Type: Boolean
94* DEPRECATED: This option has been deprecated in favor of
95  `--install-strategy=shallow`
96
97Only install direct dependencies in the top level `node_modules`, but hoist
98on deeper dependencies. Sets `--install-strategy=shallow`.
99
100
101
102#### `omit`
103
104* Default: 'dev' if the `NODE_ENV` environment variable is set to
105  'production'; otherwise, empty.
106* Type: "dev", "optional", or "peer" (can be set multiple times)
107
108Dependency types to omit from the installation tree on disk.
109
110Note that these dependencies _are_ still resolved and added to the
111`package-lock.json` or `npm-shrinkwrap.json` file. They are just not
112physically installed on disk.
113
114If a package type appears in both the `--include` and `--omit` lists, then
115it will be included.
116
117If the resulting omit list includes `'dev'`, then the `NODE_ENV` environment
118variable will be set to `'production'` for all lifecycle scripts.
119
120
121
122#### `include`
123
124* Default:
125* Type: "prod", "dev", "optional", or "peer" (can be set multiple times)
126
127Option that allows for defining which types of dependencies to install.
128
129This is the inverse of `--omit=<type>`.
130
131Dependency types specified in `--include` will not be omitted, regardless of
132the order in which omit/include are specified on the command-line.
133
134
135
136#### `strict-peer-deps`
137
138* Default: false
139* Type: Boolean
140
141If set to `true`, and `--legacy-peer-deps` is not set, then _any_
142conflicting `peerDependencies` will be treated as an install failure, even
143if npm could reasonably guess the appropriate resolution based on non-peer
144dependency relationships.
145
146By default, conflicting `peerDependencies` deep in the dependency graph will
147be resolved using the nearest non-peer dependency specification, even if
148doing so will result in some packages receiving a peer dependency outside
149the range set in their package's `peerDependencies` object.
150
151When such an override is performed, a warning is printed, explaining the
152conflict and the packages involved. If `--strict-peer-deps` is set, then
153this warning is treated as a failure.
154
155
156
157#### `prefer-dedupe`
158
159* Default: false
160* Type: Boolean
161
162Prefer to deduplicate packages if possible, rather than choosing a newer
163version of a dependency.
164
165
166
167#### `package-lock`
168
169* Default: true
170* Type: Boolean
171
172If set to false, then ignore `package-lock.json` files when installing. This
173will also prevent _writing_ `package-lock.json` if `save` is true.
174
175
176
177#### `package-lock-only`
178
179* Default: false
180* Type: Boolean
181
182If set to true, the current operation will only use the `package-lock.json`,
183ignoring `node_modules`.
184
185For `update` this means only the `package-lock.json` will be updated,
186instead of checking `node_modules` and downloading dependencies.
187
188For `list` this means the output will be based on the tree described by the
189`package-lock.json`, rather than the contents of `node_modules`.
190
191
192
193#### `foreground-scripts`
194
195* Default: `false` unless when using `npm pack` or `npm publish` where it
196  defaults to `true`
197* Type: Boolean
198
199Run all build scripts (ie, `preinstall`, `install`, and `postinstall`)
200scripts for installed packages in the foreground process, sharing standard
201input, output, and error with the main npm process.
202
203Note that this will generally make installs run slower, and be much noisier,
204but can be useful for debugging.
205
206
207
208#### `ignore-scripts`
209
210* Default: false
211* Type: Boolean
212
213If true, npm does not run scripts specified in package.json files.
214
215Note that commands explicitly intended to run a particular script, such as
216`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run` will still
217run their intended script if `ignore-scripts` is set, but they will *not*
218run any pre- or post-scripts.
219
220
221
222#### `allow-git`
223
224* Default: "all"
225* Type: "all", "none", or "root"
226
227Limits the ability for npm to fetch dependencies from git references. That
228is, dependencies that point to a git repo instead of a version or semver
229range. Please note that this could leave your tree incomplete and some
230packages may not function as intended or designed.
231
232`all` allows any git dependencies to be fetched and installed. `none`
233prevents any git dependencies from being fetched and installed. `root` only
234allows git dependencies defined in your project's package.json to be fetched
235installed. Also allows git dependencies to be fetched for other commands
236like `npm view`
237
238
239
240#### `audit`
241
242* Default: true
243* Type: Boolean
244
245When "true" submit audit reports alongside the current npm command to the
246default registry and all registries configured for scopes. See the
247documentation for [`npm audit`](/commands/npm-audit) for details on what is
248submitted.
249
250
251
252#### `before`
253
254* Default: null
255* Type: null or Date
256
257If passed to `npm install`, will rebuild the npm tree such that only
258versions that were available **on or before** the given date are installed.
259If there are no versions available for the current set of dependencies, the
260command will error.
261
262If the requested version is a `dist-tag` and the given tag does not pass the
263`--before` filter, the most recent version less than or equal to that tag
264will be used. For example, `foo@latest` might install `foo@1.2` even though
265`latest` is `2.0`.
266
267This config cannot be used with: `min-release-age`
268
269#### `min-release-age`
270
271* Default: null
272* Type: null or Number
273
274If set, npm will build the npm tree such that only versions that were
275available more than the given number of days ago will be installed. If there
276are no versions available for the current set of dependencies, the command
277will error.
278
279This flag is a complement to `before`, which accepts an exact date instead
280of a relative number of days.
281
282This config cannot be used with: `before`
283
284This value is not exported to the environment for child processes.
285
286#### `bin-links`
287
288* Default: true
289* Type: Boolean
290
291Tells npm to create symlinks (or `.cmd` shims on Windows) for package
292executables.
293
294Set to false to have it not do this. This can be used to work around the
295fact that some file systems don't support symlinks, even on ostensibly Unix
296systems.
297
298
299
300#### `fund`
301
302* Default: true
303* Type: Boolean
304
305When "true" displays the message at the end of each `npm install`
306acknowledging the number of dependencies looking for funding. See [`npm
307fund`](/commands/npm-fund) for details.
308
309
310
311#### `dry-run`
312
313* Default: false
314* Type: Boolean
315
316Indicates that you don't want npm to make any changes and that it should
317only report what it would have done. This can be passed into any of the
318commands that modify your local installation, eg, `install`, `update`,
319`dedupe`, `uninstall`, as well as `pack` and `publish`.
320
321Note: This is NOT honored by other network related commands, eg `dist-tags`,
322`owner`, etc.
323
324
325
326#### `cpu`
327
328* Default: null
329* Type: null or String
330
331Override CPU architecture of native modules to install. Acceptable values
332are same as `cpu` field of package.json, which comes from `process.arch`.
333
334
335
336#### `os`
337
338* Default: null
339* Type: null or String
340
341Override OS of native modules to install. Acceptable values are same as `os`
342field of package.json, which comes from `process.platform`.
343
344
345
346#### `libc`
347
348* Default: null
349* Type: null or String
350
351Override libc of native modules to install. Acceptable values are same as
352`libc` field of package.json
353
354
355
356#### `workspace`
357
358* Default:
359* Type: String (can be set multiple times)
360
361Enable running a command in the context of the configured workspaces of the
362current project while filtering by running only the workspaces defined by
363this configuration option.
364
365Valid values for the `workspace` config are either:
366
367* Workspace names
368* Path to a workspace directory
369* Path to a parent workspace directory (will result in selecting all
370  workspaces within that folder)
371
372When set for the `npm init` command, this may be set to the folder of a
373workspace which does not yet exist, to create the folder and set it up as a
374brand new workspace within the project.
375
376This value is not exported to the environment for child processes.
377
378#### `workspaces`
379
380* Default: null
381* Type: null or Boolean
382
383Set to true to run the command in the context of **all** configured
384workspaces.
385
386Explicitly setting this to false will cause commands like `install` to
387ignore workspaces altogether. When not set explicitly:
388
389- Commands that operate on the `node_modules` tree (install, update, etc.)
390will link workspaces into the `node_modules` folder. - Commands that do
391other things (test, exec, publish, etc.) will operate on the root project,
392_unless_ one or more workspaces are specified in the `workspace` config.
393
394This value is not exported to the environment for child processes.
395
396#### `include-workspace-root`
397
398* Default: false
399* Type: Boolean
400
401Include the workspace root when workspaces are enabled for a command.
402
403When false, specifying individual workspaces via the `workspace` config, or
404all workspaces via the `workspaces` flag, will cause npm to operate only on
405the specified workspaces, and not on the root project.
406
407This value is not exported to the environment for child processes.
408
409#### `install-links`
410
411* Default: false
412* Type: Boolean
413
414When set file: protocol dependencies will be packed and installed as regular
415dependencies instead of creating a symlink. This option has no effect on
416workspaces.
417
418
419
420### See Also
421
422* [npm install](/commands/npm-install)
423* [npm install-ci-test](/commands/npm-install-ci-test)
424* [npm test](/commands/npm-test)
425 
codekingpro/portable-devtools · Team Ai