@sprucelabs/spruce-cli
Version:
Command line interface for building Spruce skills.
41 lines • 1.33 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const test_utils_1 = require("@sprucelabs/test-utils");
const CommandService_1 = __importDefault(require("../services/CommandService"));
class CommandFaker {
fakeCommand(command, code = 0) {
CommandService_1.default.fakeCommand(command, {
code,
});
}
on(command, cb) {
CommandService_1.default.fakeCommand(command, {
code: 0,
callback: cb,
});
}
makeCommandThrow(command) {
CommandService_1.default.fakeCommand(command, {
code: 1,
callback: () => test_utils_1.assert.fail(`${command} should not have been called`),
});
}
fakeRebuild(code = 0) {
const command = new RegExp(/yarn rebuild/gis);
this.fakeCommand(command, code);
}
fakeCleanBuild(code = 0) {
this.fakeCommand('yarn clean.build', code);
}
fakeBuild(code = 0) {
this.fakeCommand('yarn build.dev', code);
}
fakeInstall(code = 0) {
this.fakeCommand(/.*?(add|install)/gis, code);
}
}
exports.default = CommandFaker;
//# sourceMappingURL=CommandFaker.js.map