CityBEM-CityLayers-SaeedRay.../node_modules/electron-rebuild/lib/test/rebuild-yarnworkspace.js

46 lines
2.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs-extra");
const path = require("path");
const os = require("os");
const cross_spawn_promise_1 = require("@malept/cross-spawn-promise");
const rebuild_1 = require("./helpers/rebuild");
const electron_version_1 = require("./helpers/electron-version");
const search_module_1 = require("../src/search-module");
const rebuild_2 = require("../src/rebuild");
const testElectronVersion = electron_version_1.getExactElectronVersionSync();
describe('rebuild for yarn workspace', function () {
this.timeout(2 * 60 * 1000);
const testModulePath = path.resolve(os.tmpdir(), 'electron-rebuild-test');
const msvs_version = process.env.GYP_MSVS_VERSION;
describe('core behavior', () => {
before(async () => {
await fs.remove(testModulePath);
await fs.copy(path.resolve(__dirname, 'fixture/workspace-test'), testModulePath);
await cross_spawn_promise_1.spawn('yarn', [], { cwd: testModulePath });
if (msvs_version) {
process.env.GYP_MSVS_VERSION = msvs_version;
}
const projectRootPath = await search_module_1.getProjectRootPath(path.join(testModulePath, 'workspace-test', 'child-workspace'));
await rebuild_2.rebuild({
buildPath: path.resolve(testModulePath, 'child-workspace'),
electronVersion: testElectronVersion,
arch: process.arch,
projectRootPath
});
});
it('should have rebuilt top level prod dependencies', async () => {
await rebuild_1.expectNativeModuleToBeRebuilt(testModulePath, 'snappy');
});
it('should not have rebuilt top level devDependencies', async () => {
await rebuild_1.expectNativeModuleToNotBeRebuilt(testModulePath, 'sleep');
});
after(async () => {
await fs.remove(testModulePath);
if (msvs_version) {
process.env.GYP_MSVS_VERSION = msvs_version;
}
});
});
});
//# sourceMappingURL=rebuild-yarnworkspace.js.map