11cb0ef41Sopenharmony_ci--- 21cb0ef41Sopenharmony_cititle: npm-test 31cb0ef41Sopenharmony_cisection: 1 41cb0ef41Sopenharmony_cidescription: Test a package 51cb0ef41Sopenharmony_ci--- 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci### Synopsis 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci```bash 101cb0ef41Sopenharmony_cinpm test [-- <args>] 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cialiases: tst, t 131cb0ef41Sopenharmony_ci``` 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ci### Description 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ciThis runs a predefined command specified in the `"test"` property of 181cb0ef41Sopenharmony_cia package's `"scripts"` object. 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci### Example 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci```json 231cb0ef41Sopenharmony_ci{ 241cb0ef41Sopenharmony_ci "scripts": { 251cb0ef41Sopenharmony_ci "test": "node test.js" 261cb0ef41Sopenharmony_ci } 271cb0ef41Sopenharmony_ci} 281cb0ef41Sopenharmony_ci``` 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci```bash 311cb0ef41Sopenharmony_cinpm test 321cb0ef41Sopenharmony_ci> npm@x.x.x test 331cb0ef41Sopenharmony_ci> node test.js 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci(test.js output would be here) 361cb0ef41Sopenharmony_ci``` 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ci### Configuration 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ci#### `ignore-scripts` 411cb0ef41Sopenharmony_ci 421cb0ef41Sopenharmony_ci* Default: false 431cb0ef41Sopenharmony_ci* Type: Boolean 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ciIf true, npm does not run scripts specified in package.json files. 461cb0ef41Sopenharmony_ci 471cb0ef41Sopenharmony_ciNote that commands explicitly intended to run a particular script, such as 481cb0ef41Sopenharmony_ci`npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run-script` 491cb0ef41Sopenharmony_ciwill still run their intended script if `ignore-scripts` is set, but they 501cb0ef41Sopenharmony_ciwill *not* run any pre- or post-scripts. 511cb0ef41Sopenharmony_ci 521cb0ef41Sopenharmony_ci 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ci#### `script-shell` 551cb0ef41Sopenharmony_ci 561cb0ef41Sopenharmony_ci* Default: '/bin/sh' on POSIX systems, 'cmd.exe' on Windows 571cb0ef41Sopenharmony_ci* Type: null or String 581cb0ef41Sopenharmony_ci 591cb0ef41Sopenharmony_ciThe shell to use for scripts run with the `npm exec`, `npm run` and `npm 601cb0ef41Sopenharmony_ciinit <package-spec>` commands. 611cb0ef41Sopenharmony_ci 621cb0ef41Sopenharmony_ci 631cb0ef41Sopenharmony_ci 641cb0ef41Sopenharmony_ci### See Also 651cb0ef41Sopenharmony_ci 661cb0ef41Sopenharmony_ci* [npm run-script](/commands/npm-run-script) 671cb0ef41Sopenharmony_ci* [npm scripts](/using-npm/scripts) 681cb0ef41Sopenharmony_ci* [npm start](/commands/npm-start) 691cb0ef41Sopenharmony_ci* [npm restart](/commands/npm-restart) 701cb0ef41Sopenharmony_ci* [npm stop](/commands/npm-stop) 71