【发布时间】:2021-10-26 15:44:28
【问题描述】:
我正在尝试使用start-server-and-test npm 包并想运行测试用例。
为此,我首先需要启动一个测试服务器,然后运行测试命令。
这就是我的package.json 脚本部分的样子。
现在的问题是 start-server-and-test 正在启动测试服务器,但它没有启动测试用例。
{
...
...
"scripts": {
"test": "jest --runInBand --config jest.config.json",
"dev": "nodemon --watch 'src/**' --ext 'ts,js' --exec \"ts-node src/app.ts\"",
"start": "ts-node src/app.ts",
"test-server": "MYSQL_TABLE_PREFIX=TEST_ PORT=4001 ts-node src/app.ts",
"ci": "start-server-and-test 'yarn test-server' http://localhost:4001/ 'yarn test'"
},
...
...
}
【问题讨论】:
标签: node.js unit-testing jestjs ts-node