Test: Skip install for standalone test (#10273)
This commit is contained in:
1 parent
662cdb04db
commit
2f4140ff18
4 files changed
+18
-17
No files matched your search
+11
-3
@@ -1,13 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
const path = require("path");
|
||||
const installPrettier = require("./scripts/install-prettier");
|
||||
|
||||
const PROJECT_ROOT = __dirname;
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
const ENABLE_CODE_COVERAGE = Boolean(process.env.ENABLE_CODE_COVERAGE);
|
||||
if (isProduction || process.env.INSTALL_PACKAGE) {
|
||||
process.env.PRETTIER_DIR = installPrettier();
|
||||
const TEST_STANDALONE = Boolean(process.env.TEST_STANDALONE);
|
||||
const INSTALL_PACKAGE = Boolean(process.env.INSTALL_PACKAGE);
|
||||
|
||||
let PRETTIER_DIR = isProduction
|
||||
? path.join(PROJECT_ROOT, "dist")
|
||||
: PROJECT_ROOT;
|
||||
if (INSTALL_PACKAGE || (isProduction && !TEST_STANDALONE)) {
|
||||
PRETTIER_DIR = installPrettier(PRETTIER_DIR);
|
||||
}
|
||||
const { TEST_STANDALONE } = process.env;
|
||||
process.env.PRETTIER_DIR = PRETTIER_DIR;
|
||||
|
||||
const testPathIgnorePatterns = [];
|
||||
let transform;
|
||||
|
||||
@@ -6,12 +6,9 @@ const tempy = require("tempy");
|
||||
|
||||
shell.config.fatal = true;
|
||||
|
||||
const rootDir = path.join(__dirname, "..");
|
||||
const client = process.env.NPM_CLIENT || "yarn";
|
||||
const packageDir =
|
||||
process.env.NODE_ENV === "production" ? path.join(rootDir, "dist") : rootDir;
|
||||
|
||||
module.exports = () => {
|
||||
module.exports = (packageDir) => {
|
||||
const tmpDir = tempy.directory();
|
||||
const file = shell.exec("npm pack", { cwd: packageDir }).stdout.trim();
|
||||
shell.mv(path.join(packageDir, file), tmpDir);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const prettierRootDir = process.env.PRETTIER_DIR || "../";
|
||||
|
||||
const prettier = require(prettierRootDir);
|
||||
const prettier = require(process.env.PRETTIER_DIR);
|
||||
|
||||
module.exports = prettier;
|
||||
@@ -2,18 +2,16 @@
|
||||
|
||||
const path = require("path");
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
const prettierRootDir = isProduction
|
||||
? process.env.PRETTIER_DIR
|
||||
: path.join(__dirname, "..");
|
||||
const { bin } = require(path.join(prettierRootDir, "package.json"));
|
||||
const { PRETTIER_DIR } = process.env;
|
||||
const { bin } = require(path.join(PRETTIER_DIR, "package.json"));
|
||||
const prettierCli = path.join(
|
||||
prettierRootDir,
|
||||
PRETTIER_DIR,
|
||||
typeof bin === "object" ? bin.prettier : bin
|
||||
);
|
||||
|
||||
const thirdParty = isProduction
|
||||
? path.join(prettierRootDir, "./third-party")
|
||||
: path.join(prettierRootDir, "./src/common/third-party");
|
||||
? path.join(PRETTIER_DIR, "./third-party")
|
||||
: path.join(PRETTIER_DIR, "./src/common/third-party");
|
||||
|
||||
const projectRoot = path.join(__dirname, "..");
|
||||
|
||||
|
||||
Reference in new issue
Block a user