我有一个Strapi api并试图运行单元测试
这是我得到的控制台中的错误
yarn test
yarn run v1.22.5
$ jest --forceExit --detectOpenHandles
● process.exit called with "1"
8 | if (!instance) {
9 | /** the follwing code in copied from `./node_modules/strapi/lib/Strapi.js` */
> 10 | await Strapi().load();
| ^
11 | instance = strapi; // strapi is global now
12 | await instance.app
13 | .use(instance.router.routes()) // populate KOA routes
at Strapi.stop (node_modules/strapi/lib/Strapi.js:263:13)
at node_modules/strapi/lib/Strapi.js:391:16
at async Promise.all (index 5)
at Strapi.runBootstrapFunctions (node_modules/strapi/lib/Strapi.js:394:5)
at Strapi.load (node_modules/strapi/lib/Strapi.js:326:5)
at setupStrapi (tests/helpers/strapi.js:10:5)
at Object.<anonymous> (tests/app.test.js:8:3)
RUNS tests/app.test.js
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
我完全遵循了这些说明。
如何解决此问题?
谢谢
答案 0 :(得分:0)
通过将 env 文件夹名称更改为 environments
即可解决此问题。