Test: Add env flag to allow skip production install (#12857)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-05-21 11:11:41 +08:00
1 parent ee17a2ff8b
commit 8f555a2b84
1 file changed
+6 -1
+6 -1
View File
@@ -7,12 +7,17 @@ const isProduction = process.env.NODE_ENV === "production";
const ENABLE_CODE_COVERAGE = Boolean(process.env.ENABLE_CODE_COVERAGE);
const TEST_STANDALONE = Boolean(process.env.TEST_STANDALONE);
const INSTALL_PACKAGE = Boolean(process.env.INSTALL_PACKAGE);
// When debugging production test, this flag can skip installing package
const SKIP_PRODUCTION_INSTALL = Boolean(process.env.SKIP_PRODUCTION_INSTALL);
const SKIP_TESTS_WITH_NEW_SYNTAX = process.versions.node.startsWith("12.");
let PRETTIER_DIR = isProduction
? path.join(PROJECT_ROOT, "dist")
: PROJECT_ROOT;
if (INSTALL_PACKAGE || (isProduction && !TEST_STANDALONE)) {
if (
INSTALL_PACKAGE ||
(isProduction && !TEST_STANDALONE && !SKIP_PRODUCTION_INSTALL)
) {
PRETTIER_DIR = installPrettier(PRETTIER_DIR);
}
process.env.PRETTIER_DIR = PRETTIER_DIR;