samedi 27 octobre 2018

How to get jest-tests execution results?

I use jest.run() to run my tests using node.js. My tests are completed, but I don't know what is result - error or success. The result variable is undefined here. How to get test execution results?

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);
};

Aucun commentaire:

Enregistrer un commentaire