const getReporters = require('./lib/getReporters.js');
const runner = require('./lib/runner.js');
const enqueue = require('./lib/runnerQueue.js');
const createId = require('./lib/createId.js');
const RunOptions = require('./lib/RunOptions.js');
/**
* @module pete/todo
*/
module.exports = todo;
/**
* Prepare test but override it so it will not exit on error.
* It will not run `warmup` phase. It will be reported as `todo` instead.
*
* Returns `true` if test was prepared and added to the queue.
*
* @alias module:pete/todo
* @param {string} [name]
* @param {Function|string} fn function to run, or path to file that calls any combination of `test`, `skip` and/or `todo`
* @param {module:pete/lib/RunOptions|object} [opts]
* @param {Function} [cb] function to call back with array of results
* @return {boolean}
*/
function todo (name, fn, opts, cb) { // eslint-disable-line no-unused-vars
const options = new RunOptions();
fn = runner.setOptions(createId(todo), options, arguments); // eslint-disable-line prefer-rest-params
if (!fn || options.areInvalid()) {
return false;
}
options.exitOnError = false;
options.warmupSamples = 0;
enqueue(runner.createRun(fn, options), options, 'todo', getReporters(options.reporters));
return true;
}