Skip to content

Commit 1656915

Browse files
committed
add install deps command back in
1 parent 4fb95d5 commit 1656915

File tree

3 files changed

+35
-21
lines changed

3 files changed

+35
-21
lines changed

packages/plugin/fuses/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
],
1515
"typings": "dist/FusesPlugin.d.ts",
1616
"devDependencies": {
17+
"@electron-forge/core-utils": "workspace:*",
1718
"@electron/fuses": "^1.0.0",
1819
"@malept/cross-spawn-promise": "^2.0.0",
1920
"xvfb-maybe": "^0.2.1"

packages/plugin/fuses/spec/FusesPlugin.slow.verdaccio.spec.ts

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,62 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
33

4+
import {
5+
PACKAGE_MANAGERS,
6+
spawnPackageManager,
7+
} from '@electron-forge/core-utils';
8+
import { ensureTestDirIsNonexistent } from '@electron-forge/test-utils';
49
import { CrossSpawnOptions, spawn } from '@malept/cross-spawn-promise';
510
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
611

712
import { getElectronExecutablePath } from '../src/util/getElectronExecutablePath';
813

914
describe('FusesPlugin', () => {
10-
const appPath = path.join(__dirname, 'fixture', 'app');
11-
12-
const spawnOptions: CrossSpawnOptions = {
13-
cwd: appPath,
14-
shell: true,
15-
};
15+
const fixtureDir = path.join(__dirname, 'fixture', 'app');
16+
const forgeVersion = JSON.parse(
17+
fs.readFileSync(
18+
path.resolve(__dirname, '..', '..', '..', '..', 'lerna.json'),
19+
'utf-8',
20+
),
21+
).version;
22+
let appPath: string;
1623

1724
const packageJSON = JSON.parse(
18-
fs.readFileSync(path.join(appPath, 'package.json.tmpl'), {
19-
encoding: 'utf-8',
20-
}),
25+
fs.readFileSync(path.join(fixtureDir, 'package.json.tmpl'), 'utf-8'),
2126
);
2227

2328
const { name: appName } = packageJSON;
2429

25-
const outDir = path.join(appPath, 'out', 'fuses-test-app');
26-
2730
beforeAll(async () => {
2831
delete process.env.TS_NODE_PROJECT;
29-
await fs.promises.copyFile(
32+
appPath = await ensureTestDirIsNonexistent();
33+
await fs.promises.cp(fixtureDir, appPath, { recursive: true });
34+
const packageJSONTemplate = await fs.promises.readFile(
3035
path.join(appPath, 'package.json.tmpl'),
36+
'utf-8',
37+
);
38+
await fs.promises.writeFile(
3139
path.join(appPath, 'package.json'),
40+
packageJSONTemplate.replace(/ELECTRON_FORGE\/VERSION/g, forgeVersion),
3241
);
42+
await fs.promises.rm(path.join(appPath, 'package.json.tmpl'));
43+
await spawnPackageManager(PACKAGE_MANAGERS.yarn, ['install'], {
44+
cwd: appPath,
45+
});
3346
});
3447

3548
afterAll(async () => {
36-
await fs.promises.rm(path.resolve(outDir, '../'), {
37-
recursive: true,
38-
force: true,
39-
});
40-
41-
await fs.promises.rm(path.join(appPath, 'package.json'));
49+
await fs.promises.rm(appPath, { recursive: true, force: true });
4250
});
4351

4452
it('should flip Fuses', async () => {
53+
const spawnOptions: CrossSpawnOptions = {
54+
cwd: appPath,
55+
shell: true,
56+
};
4557
await spawn('yarn', ['package'], spawnOptions);
4658

59+
const outDir = path.join(appPath, 'out', appName);
4760
const electronExecutablePath = getElectronExecutablePath({
4861
appName,
4962
basePath: path.join(

packages/plugin/fuses/spec/fixture/app/package.json.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"fs-extra": "^10.0.0"
1111
},
1212
"devDependencies": {
13-
"@electron-forge/cli": "6.4.0",
14-
"@electron-forge/plugin-fuses": "6.4.0",
15-
"@electron-forge/shared-types": "6.4.0",
13+
"@electron-forge/cli": "ELECTRON_FORGE/VERSION",
14+
"@electron-forge/plugin-fuses": "ELECTRON_FORGE/VERSION",
15+
"@electron-forge/shared-types": "ELECTRON_FORGE/VERSION",
1616
"electron": "34.0.0"
1717
}
1818
}

0 commit comments

Comments
 (0)