我正在尝试用jestjs运行测试,但我很难做到这一点。
当我运行这个命令时:
npm testj国家预防机制说我没有这个剧本:
$ npm测试j
Usage: npm <command>
where <command> is one of:
access, add-user, ....
npm <cmd> -h quick help on <cmd>
npm -l display full usage info
npm faq commonly asked questions
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
/Users/bli1/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@2.13.1 /usr/local/lib/node_modules/npm我的package.json
{
...
...
"scripts": {
...
...
"testj": "jest"
...
},
"dependencies": {
...
...
"react": "^0.13.1",
"react-highlight": "^0.4.1",
"react-router": "^0.13.2",
"react-select": "^0.5.6",
},
"devDependencies": {
...
...
"jest-cli": "^0.4.14",
"react-tools": "^0.13.1",
}
"jest": {
"scriptPreprocessor": "<rootDir>/preprocessor.js",
"unmockedModulePathPatterns": [
"<rootDir>/node_modules/react"
]
}
}preprocessor.js
var ReactTools = require('react-tools');
module.exports = {
process: function(src) {
return ReactTools.transform(src);
}
};发布于 2015-08-04 18:59:00
也许你需要npm run testj
只有少数脚本具有速记功能,比如npm test。https://docs.npmjs.com/misc/scripts
https://stackoverflow.com/questions/31817046
复制相似问题