describe("Crankshaft build", () => {
it("A full flow example must run without errors (*nix only)", () => {
const matchingFiles = [];
const build = crankshaft.create({ threads: 4 });
let buildStarted = false;
build.onStart(() => {
buildStarted = true;
});
let buildCompleted = false;
build.onStart(() => {
buildCompleted = true;
});
const copyTextAndHtmlFiles = function() {
this.watch(["*.txt", "*.html", "!src/zomg.txt", "!temp/"], async function(filePath) {
await exec(`cp ${filePath} temp`);
}, "copy_text_and_html_files");
}
build.configure(copyTextAndHtmlFiles, 'fixtures');
let configStarted = false;
let configCompleted = false;
const copyJsonFiles = function() {
this.onStart(() => {
configStarted = true;
});
this.watch(["*.txt", "!temp/"], async function(filePath) {
await exec(`cp ${filePath} temp`);
}, "copy_json_files");
this.onComplete(() => {
configCompleted = true;
});
}
build.configure(copyJsonFiles, 'fixtures');
return crankshaft.run(build, false).then(() => {
buildStarted.should.be.true();
buildCompleted.should.be.true();
configStarted.should.be.true();
configCompleted.should.be.true();
const files = fs.readdirSync("fixtures/temp");
files.length.should.equal(6);
});
});
});