@hayspec/cli
Version:
CLI for Hayspec framework.
39 lines • 2.37 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const ava_1 = require("ava");
const util = require("util");
const cproc = require("child_process");
const exec = util.promisify(cproc.exec);
ava_1.default('initializes current folder', (t) => __awaiter(void 0, void 0, void 0, function* () {
const command = `mkdir -p ./node_modules/.tmp/test; cd ./node_modules/.tmp/test; ../../../bin/hayspec init --name foo --description bar; echo code: $?`;
const { stdout, stderr } = yield exec(command);
t.true(stdout.indexOf('Continue by running the commands below:') !== -1);
t.true(stdout.indexOf('code: 0') !== -1);
t.true(stderr === '');
}));
ava_1.default('runs valid tests', (t) => __awaiter(void 0, void 0, void 0, function* () {
const command = './bin/hayspec test --require ts-node/register --match ./src/tests/assets/**/valid.hay.*; echo code: $?';
const { stdout, stderr } = yield exec(command);
t.true(stdout.indexOf('src/tests/assets/valid.hay.ts') !== -1);
t.true(stdout.indexOf('src/tests/assets/invalid.hay.ts') === -1);
t.true(stdout.indexOf('code: 0') !== -1);
t.true(stderr === '');
}));
ava_1.default('runs invalid tests', (t) => __awaiter(void 0, void 0, void 0, function* () {
const command = './bin/hayspec test --require ts-node/register --match ./src/tests/assets/**/invalid.hay.*; echo code: $?';
const { stdout, stderr } = yield exec(command);
t.true(stdout.indexOf('src/tests/assets/valid.hay.ts') === -1);
t.true(stdout.indexOf('src/tests/assets/invalid.hay.ts') !== -1);
t.true(stdout.indexOf('code: 1') !== -1);
t.true(stderr === '');
}));
//# sourceMappingURL=index.test.js.map