suman-interactive
Version:
Suman interactive project to guide users through advanced use cases
53 lines (42 loc) • 1.41 kB
JavaScript
;
//polyfills
const process = require('suman-browser-polyfills/modules/process');
const global = require('suman-browser-polyfills/modules/global');
//core
const assert = require('assert');
const util = require('util');
const path = require('path');
const fs = require('fs');
const cp = require('child_process');
//npm
const colors = require('colors/safe');
const inquirer = require('suman-inquirer');
//project
const _suman = global.__suman = (global.__suman || {});
const rejectionHandler = require('../interactive-rejection-handler');
const choices = require('./choices');
//////////////////////////////////////////////////////////////
module.exports = function debugSingle (opts, backspaceCB) {
const exec = opts.exec;
return inquirer.prompt([
{
type: 'list',
name: 'debugCmd',
message: 'Which technique would you like to use to debug your tests?',
onLeftKey: function () {
_suman.onBackspace(backspaceCB);
},
when: function () {
console.log('\n\n ----------------------------------------------- \n\n');
return true;
},
choices: exec === 'node' ? choices.nodeDebug : choices.sumanDebug,
filter: function (val) {
return val;
}
},
]).then(function (answers) {
_suman._interactiveDebug('answers in debug-single =>', answers);
return Object.assign(opts, answers);
});
};