Run production tests on npm package (#3730)

* Run production tests on npm package

* Put back fast finish
This commit is contained in:
Lucas Azzola authored and GitHub committed 2018-01-13 03:19:20 +11:00
1 parent 934f679705
commit dd78f31aaf
6 files changed
+71 -7

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env node
"use strict";
const path = require("path");
const shell = require("shelljs");
const tempy = require("tempy");
shell.config.fatal = true;
const rootDir = path.join(__dirname, "..");
const distDir = path.join(rootDir, "dist");
const file = shell.exec("npm pack", { cwd: distDir }).stdout.trim();
const tarPath = path.join(distDir, file);
const tmpDir = tempy.directory();
shell.config.silent = true;
shell.exec("npm init -y", { cwd: tmpDir });
shell.exec(`npm install "${tarPath}"`, { cwd: tmpDir });
shell.config.silent = false;
const code = shell.exec("yarn test --color --runInBand", {
cwd: rootDir,
env: Object.assign({}, process.env, {
NODE_ENV: "production",
AST_COMPARE: "1",
PRETTIER_DIR: path.join(tmpDir, "node_modules/prettier")
}),
shell: true
}).code;
process.exit(code);