Skip to content

Commit

Permalink
Move smoke test scripts to smoke dir
Browse files Browse the repository at this point in the history
  • Loading branch information
boopathi committed Apr 5, 2017
1 parent c27275d commit 5c39f2e
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 30 deletions.
91 changes: 62 additions & 29 deletions scripts/smoke.js → smoke/run.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,64 @@
const program = require("commander");
const smoke = require("./smoke-test.js");

const tests = [
const TESTS = [
{
dir: "html-minifier",
files: "src/htmlminifier.js",
build: "npm install && grunt dist",
test: "grunt qunit",
verbose: true
},
{
dir: "immutable-js",
files: "dist/immutable.js",
build: "npm install && npm run build",
test: "npm run testonly",
verbose: true,
babiliOptions: {
keepFnName: true,
unsafe: {
typeConstructors: false
}
}
}
];

function run() {
let inputTests = [];
program
.usage("[options] [inputTests...]")
.action(_inputTests => inputTests = _inputTests)
.option("-f --force", "Force rebuild")
.parse(process.argv);

console.log("tests to run - ", inputTests);

const testsToRun = [];
for (let test of TESTS) {
if (inputTests.indexOf(test.dir) !== -1) {
testsToRun.push(test);
}
}

if (testsToRun.length < 1) {
throw new Error("No Test to run");
}

(function tick(test) {
smoke(test).then(() => {
const test = testsToRun.pop();
test && tick(test);
});
})(testsToRun.pop());
}

/**
* Run the test
*/
run();

const otherTests = [
// {
// dir: "babel",
// files: "packages/babel-core/src/helpers/resolve.js",
Expand Down Expand Up @@ -51,32 +109,7 @@ const tests = [
// test: "npm test",
// verbose: false
// },
// {
// dir: "immutable-js",
// files: "dist/immutable.js",
// build: "npm install && npm run build",
// test: "npm run testonly",
// verbose: true,
// babiliOptions: {
// keepFnName: true,
// unsafe: {
// typeConstructors: false
// }
// }
// },
{
dir: "html-minifier",
files: "src/htmlminifier.js",
build: "npm install && grunt dist",
test: "grunt qunit",
success: "0 failed",
verbose: true
}
/**
* PASSED AND VERIFIED
*/
];

(function tick(test) {
smoke(test).then(() => {
const test = tests.pop();
test && tick(test);
});
})(tests.pop());
2 changes: 1 addition & 1 deletion scripts/smoke-test.js → smoke/smoke-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class SmokeTest {
});
}
minifyFile(file) {
this.log(`Minifying ${file}`);
this.log("Minifying", file);
return readFile(file)
.then(contents => this.minify(contents.toString()))
.then(({ code }) => writeFile(file, code));
Expand Down

0 comments on commit 5c39f2e

Please sign in to comment.