2025-04-10 14:36:22 -07:00
.TH "NPM-TEST" "1" "April 2025" "NPM@11.3.0" ""
2011-11-26 09:21:03 -08:00
.SH "NAME"
2022-12-06 22:18:33 -05:00
\fB npm-test\fR - Test a package
.SS "Synopsis"
2014-09-24 14:41:07 -07:00
.P
.RS 2
2014-11-04 15:08:12 -08:00
.nf
2022-12-06 22:18:33 -05:00
npm test \[ lB]-- <args>\[ rB]
2016-03-29 23:30:51 -07:00
2022-02-24 21:41:49 +00:00
aliases: tst, t
2014-11-04 15:08:12 -08:00
.fi
2014-09-24 14:41:07 -07:00
.RE
2022-12-06 22:18:33 -05:00
.SS "Description"
2014-09-24 14:41:07 -07:00
.P
2022-12-06 22:18:33 -05:00
This runs a predefined command specified in the \fB "test"\fR property of a package's \fB "scripts"\fR object.
.SS "Example"
2021-01-15 16:09:24 -05:00
.P
.RS 2
.nf
{
"scripts": {
2022-12-06 22:18:33 -05:00
"test": "node test.js"
2021-01-15 16:09:24 -05:00
}
}
.fi
.RE
.P
.RS 2
.nf
npm test
2022-12-06 22:18:33 -05:00
> npm@x.x.x test
> node test.js
2021-01-15 16:09:24 -05:00
2022-12-06 22:18:33 -05:00
(test.js output would be here)
2021-01-15 16:09:24 -05:00
.fi
.RE
2022-12-06 22:18:33 -05:00
.SS "Configuration"
.SS "\fBignore-scripts\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
If true, npm does not run scripts specified in package.json files.
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
Note that commands explicitly intended to run a particular script, such as \fB npm start\fR , \fB npm stop\fR , \fB npm restart\fR , \fB npm test\fR , and \fB npm run-script\fR will still run their intended script if \fB ignore-scripts\fR is set, but they will \fI not\fR run any pre- or post-scripts.
.SS "\fBscript-shell\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: null or String
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
The shell to use for scripts run with the \fB npm exec\fR , \fB npm run\fR and \fB npm
init <package-spec>\fR commands.
.SS "See Also"
2014-09-24 14:41:07 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
npm help run-script
.IP \(bu 4
2019-11-05 14:55:08 -05:00
npm help scripts
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help start
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help restart
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help stop
2022-12-06 22:18:33 -05:00
.RE 0