This repository has been archived by the owner on May 11, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe74b77
commit b2057c0
Showing
4 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ test/tmp | |
*.log | ||
.vscode | ||
.nyc_output | ||
tmp | ||
babel-preset-env-*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,6 @@ scripts | |
.travis.yml | ||
codecov.yml | ||
yarn.lock | ||
.nyc_output | ||
.vscode | ||
babel-preset-env-*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
const fs = require("fs-extra"); | ||
const execSync = require("child_process").execSync; | ||
const path = require("path"); | ||
const pkg = require("../package.json"); | ||
|
||
let errorOccurred = false; | ||
|
||
const tempFolderPath = path.join(__dirname, "../tmp"); | ||
const packPath = path.join(__dirname, `../babel-preset-env-${pkg.version}.tgz`); | ||
|
||
try { | ||
console.log("Creating package"); | ||
execSync("npm pack"); | ||
|
||
console.log("Setting up smoke test"); | ||
fs.ensureDir(tempFolderPath); | ||
|
||
fs.writeFileSync( | ||
path.join(tempFolderPath, "package.json"), | ||
` | ||
{ | ||
"name": "babel-preset-env-smoke-test", | ||
"private": true, | ||
"version": "1.0.0", | ||
"scripts": { | ||
"build": "babel index.js --out-file index.es6" | ||
}, | ||
"dependencies": { | ||
"babel-cli": "*", | ||
"babel-preset-env": "${packPath}" | ||
} | ||
} | ||
`); | ||
|
||
fs.writeFileSync( | ||
path.join(tempFolderPath, ".babelrc"), | ||
` | ||
{ | ||
"presets": [ | ||
["env", { | ||
modules: false, | ||
useBuiltIns: true | ||
}] | ||
] | ||
} | ||
` | ||
); | ||
|
||
fs.writeFileSync( | ||
path.join(tempFolderPath, "index.js"), | ||
` | ||
import "babel-polyfill"; | ||
1 ** 2; | ||
` | ||
); | ||
|
||
process.chdir(tempFolderPath); | ||
|
||
console.log("Running smoke test"); | ||
execSync("npm install && npm run build"); | ||
} catch (e) { | ||
errorOccurred = true; | ||
} | ||
|
||
console.log("Cleaning up"); | ||
fs.removeSync(tempFolderPath); | ||
fs.removeSync(packPath); | ||
|
||
process.exit(errorOccurred ? 1 : 0); |