2019-11-05 14:55:08 -05:00
|
|
|
---
|
|
|
|
title: npm-test
|
2020-11-01 07:54:36 +01:00
|
|
|
section: 1
|
2019-11-05 14:55:08 -05:00
|
|
|
description: Test a package
|
|
|
|
---
|
|
|
|
|
|
|
|
### Synopsis
|
|
|
|
|
2022-02-24 21:41:49 +00:00
|
|
|
<!-- AUTOGENERATED USAGE DESCRIPTIONS START -->
|
|
|
|
<!-- automatically generated, do not edit manually -->
|
|
|
|
<!-- see lib/commands/test.js -->
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
```bash
|
|
|
|
npm test [-- <args>]
|
|
|
|
|
2022-02-24 21:41:49 +00:00
|
|
|
aliases: tst, t
|
2019-11-05 14:55:08 -05:00
|
|
|
```
|
|
|
|
|
2022-02-24 21:41:49 +00:00
|
|
|
<!-- automatically generated, do not edit manually -->
|
|
|
|
<!-- see lib/commands/test.js -->
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED USAGE DESCRIPTIONS END -->
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Description
|
|
|
|
|
2021-01-15 16:09:24 -05:00
|
|
|
This runs a predefined command specified in the `"test"` property of
|
|
|
|
a package's `"scripts"` object.
|
|
|
|
|
|
|
|
### Example
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"scripts": {
|
|
|
|
"test": "node test.js"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm test
|
|
|
|
> npm@x.x.x test
|
|
|
|
> node test.js
|
|
|
|
|
|
|
|
(test.js output would be here)
|
|
|
|
```
|
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
### Configuration
|
2021-01-15 16:09:24 -05:00
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
<!-- AUTOGENERATED CONFIG DESCRIPTIONS START -->
|
|
|
|
<!-- automatically generated, do not edit manually -->
|
2021-08-19 17:47:33 +00:00
|
|
|
<!-- see lib/utils/config/definitions.js -->
|
2021-05-20 15:54:50 -04:00
|
|
|
#### `ignore-scripts`
|
|
|
|
|
|
|
|
* Default: false
|
|
|
|
* Type: Boolean
|
|
|
|
|
|
|
|
If true, npm does not run scripts specified in package.json files.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2021-08-19 17:47:33 +00:00
|
|
|
<!-- automatically generated, do not edit manually -->
|
|
|
|
<!-- see lib/utils/config/definitions.js -->
|
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
#### `script-shell`
|
|
|
|
|
|
|
|
* Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
|
|
|
|
* Type: null or String
|
|
|
|
|
|
|
|
The shell to use for scripts run with the `npm exec`, `npm run` and `npm
|
2022-06-24 18:21:50 -07:00
|
|
|
init <package-spec>` commands.
|
2021-05-20 15:54:50 -04:00
|
|
|
|
2021-08-19 17:47:33 +00:00
|
|
|
<!-- automatically generated, do not edit manually -->
|
|
|
|
<!-- see lib/utils/config/definitions.js -->
|
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
<!-- AUTOGENERATED CONFIG DESCRIPTIONS END -->
|
2019-11-05 14:55:08 -05:00
|
|
|
|
|
|
|
### See Also
|
|
|
|
|
2020-11-01 07:54:36 +01:00
|
|
|
* [npm run-script](/commands/npm-run-script)
|
2019-11-05 14:55:08 -05:00
|
|
|
* [npm scripts](/using-npm/scripts)
|
2020-11-01 07:54:36 +01:00
|
|
|
* [npm start](/commands/npm-start)
|
|
|
|
* [npm restart](/commands/npm-restart)
|
|
|
|
* [npm stop](/commands/npm-stop)
|