1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.cleanupTestModule = exports.resetTestModule = exports.resetMSVSVersion = exports.TIMEOUT_IN_MILLISECONDS = exports.MINUTES_IN_MILLISECONDS = void 0;
|
7 | const fs_extra_1 = __importDefault(require("fs-extra"));
|
8 | const path_1 = __importDefault(require("path"));
|
9 | const cross_spawn_promise_1 = require("@malept/cross-spawn-promise");
|
10 | const originalGypMSVSVersion = process.env.GYP_MSVS_VERSION;
|
11 | const TIMEOUT_IN_MINUTES = process.platform === 'win32' ? 5 : 2;
|
12 | exports.MINUTES_IN_MILLISECONDS = 60 * 1000;
|
13 | exports.TIMEOUT_IN_MILLISECONDS = TIMEOUT_IN_MINUTES * exports.MINUTES_IN_MILLISECONDS;
|
14 | function resetMSVSVersion() {
|
15 | if (originalGypMSVSVersion) {
|
16 | process.env.GYP_MSVS_VERSION = originalGypMSVSVersion;
|
17 | }
|
18 | }
|
19 | exports.resetMSVSVersion = resetMSVSVersion;
|
20 | async function resetTestModule(testModulePath, installModules = true) {
|
21 | await fs_extra_1.default.remove(testModulePath);
|
22 | await fs_extra_1.default.mkdir(testModulePath, { recursive: true });
|
23 | await fs_extra_1.default.copyFile(path_1.default.resolve(__dirname, '../../test/fixture/native-app1/package.json'), path_1.default.resolve(testModulePath, 'package.json'));
|
24 | if (installModules) {
|
25 | await (0, cross_spawn_promise_1.spawn)('npm', ['install'], { cwd: testModulePath });
|
26 | }
|
27 | resetMSVSVersion();
|
28 | }
|
29 | exports.resetTestModule = resetTestModule;
|
30 | async function cleanupTestModule(testModulePath) {
|
31 | await fs_extra_1.default.remove(testModulePath);
|
32 | resetMSVSVersion();
|
33 | }
|
34 | exports.cleanupTestModule = cleanupTestModule;
|
35 |
|
\ | No newline at end of file |