Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Run smoke test for both entry and usage options #286

Merged
merged 1 commit into from
Apr 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions scripts/smoke-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ try {
console.log("Creating package");
execSync("npm pack");

console.log("Setting up smoke test");
console.log("Setting up smoke test dependencies");

fs.ensureDirSync(tempFolderPath);
process.chdir(tempFolderPath);

fs.writeFileSync(
path.join(tempFolderPath, "package.json"),
Expand All @@ -33,14 +35,18 @@ try {
`
);

execSync("npm install");

console.log("Setting up 'usage' smoke test");

fs.writeFileSync(
path.join(tempFolderPath, ".babelrc"),
`
{
"presets": [
["env", {
modules: false,
useBuiltIns: true
useBuiltIns: "usage"
}]
]
}
Expand All @@ -56,10 +62,37 @@ const foo = new Promise((resolve) => {
`
);

process.chdir(tempFolderPath);
console.log("Running 'usage' smoke test");

execSync("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");

console.log("Running smoke test");
execSync("npm install && npm run build");
execSync("npm run build");
} catch (e) {
console.log(e);
errorOccurred = true;
Expand Down