如何获得笑话测试的执行结果?

时间:2018-10-27 08:03:15

标签: javascript node.js testing jestjs

我使用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);
};

0 个答案:

没有答案