Run smoke test for both entry and usage options (#286)

This commit is contained in:
Brian Ng 2017-04-13 22:04:08 -05:00 committed by GitHub
parent 7acf4a46f0
commit 1e11a32c44

View File

@ -12,8 +12,10 @@ try {
console.log("Creating package"); console.log("Creating package");
execSync("npm pack"); execSync("npm pack");
console.log("Setting up smoke test"); console.log("Setting up smoke test dependencies");
fs.ensureDirSync(tempFolderPath); fs.ensureDirSync(tempFolderPath);
process.chdir(tempFolderPath);
fs.writeFileSync( fs.writeFileSync(
path.join(tempFolderPath, "package.json"), path.join(tempFolderPath, "package.json"),
@ -33,6 +35,10 @@ try {
` `
); );
execSync("npm install");
console.log("Setting up 'usage' smoke test");
fs.writeFileSync( fs.writeFileSync(
path.join(tempFolderPath, ".babelrc"), path.join(tempFolderPath, ".babelrc"),
` `
@ -40,7 +46,7 @@ try {
"presets": [ "presets": [
["env", { ["env", {
modules: false, modules: false,
useBuiltIns: true useBuiltIns: "usage"
}] }]
] ]
} }
@ -56,10 +62,37 @@ const foo = new Promise((resolve) => {
` `
); );
process.chdir(tempFolderPath); console.log("Running 'usage' smoke test");
console.log("Running smoke test"); execSync("npm run build");
execSync("npm install && npm run build");
console.log("Setting up 'entry' smoke test");
fs.writeFileSync(
path.join(tempFolderPath, ".babelrc"),
`
{
"presets": [
["env", {
modules: false,
useBuiltIns: "entry"
}]
]
}
`
);
fs.writeFileSync(
path.join(tempFolderPath, "index.js"),
`
import "babel-polyfill";
1 ** 2;
`
);
console.log("Running 'entry' smoke test");
execSync("npm run build");
} catch (e) { } catch (e) {
console.log(e); console.log(e);
errorOccurred = true; errorOccurred = true;