Files
test-repo/scripts/test-dist.js
T
fisker CheungandGeorgii Dolzhykov 54f907dba3 Followup work on setup github actions (#7431)
* Followup work on setup github actions

* Coverage report & split `prod_lint`

* Add env

* Remove coverage report on azure pipelines

* Remove build step on lint

* remove coverage report on prod_test

* Use `ci-info` instead of `is-ci`

* Always enable `ENABLE_TEST_RESULTS` and `AST_COMPARE` on CI

* Standalone test and remove some env

* coverage report

* reduce matrix

* standalone test

* `ci-info`

* Remove token

* Disable `coverage` on azure pipelines

* use master version of codecov-action

* Link to master status

* fix prod lint

* Use boolean env

* Remove locv report

* Try lcov report

* pin `codecov-action` version, enable `verbose`

* azure coverage

* Name

* Trigger CI

* Use `basename`

* Trigger CI

* Try `runInBand`

* try `maxWorkers`

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-03-23 03:36:44 +02:00

40 lines
995 B
JavaScript

#!/usr/bin/env node
"use strict";
const path = require("path");
const shell = require("shelljs");
const tempy = require("tempy");
const { isCI } = require("ci-info");
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 runInBand = isCI ? "--runInBand" : "";
const testPath = process.env.TEST_STANDALONE ? "tests/" : "";
const cmd = `yarn test --color ${runInBand} ${testPath}`;
const { code } = shell.exec(cmd, {
cwd: rootDir,
env: {
...process.env,
NODE_ENV: "production",
AST_COMPARE: "1",
PRETTIER_DIR: path.join(tmpDir, "node_modules/prettier"),
},
shell: true,
});
process.exit(code);