我使用jest.run()使用node.js运行测试。我的测试已经完成,但是我不知道结果是什么-错误或成功。结果变量在这里未定义。如何获得测试执行结果?
const { startServer, closeServer } = require('../bin/www');
const jest = require('jest');
const execute = require('./executeCli');
const runAll = async () => {
await execute('npm run restoreData');
console.log('Test database is created');
await startServer();
console.log('Test server is started');
const result = await jest.run();
console.log('Tests are completed');
console.log('Good job, developer!');
await closeServer();
process.exit(0);
};