UNPKG

@testim/testim-cli

Version:

Command line interface for running Testing on you CI

34 lines (27 loc) 861 B
#! /usr/bin/env node var options = require('./runOptions.js'); var testRunner = require('./runner.js'); function getExitCode(testResults) { testResults = testResults || {}; var failedCount = Object.keys(testResults).filter(function(testId){ return testResults[testId].testResults.success !== true; }).length; return failedCount === 0 ? 0 : 1; } function main(moreOptions) { moreOptions = moreOptions || {}; return options.process(moreOptions) .then(function(options) { return testRunner.run(options); }).catch(function(err){ console.log('error', err, err.stack); }).then(function(testResults) { setTimeout(process.exit.bind(process, getExitCode(testResults)), 3000); }); } module.exports = { main: main }; if (require.main === module) { main(); }