Skip to content

Commit d9ed587

Browse files
authored
test: use verdaccio in more init cases (#4116)
* test(import): use verdaccio * remove fixtures * move fuses to verdaccio too...
1 parent fcf59c7 commit d9ed587

File tree

8 files changed

+0
-16569
lines changed

8 files changed

+0
-16569
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"test:slow": "xvfb-maybe vitest run --project slow",
2525
"test:verdaccio": "ts-node tools/verdaccio/spawn-verdaccio.ts xvfb-maybe vitest run --project slow-verdaccio",
2626
"test:clear": "ts-node tools/test-clear",
27-
"update:lockfile-fixtures": "ts-node tools/regenerate-lockfile-fixtures.ts",
2827
"postinstall": "husky install && node -e \"try { fs.rmSync('node_modules/.bin/*.ps1', { recursive: true, force: true }) } catch (e) {}\" && ts-node ./tools/gen-tsconfigs.ts && ts-node ./tools/gen-ts-glue.ts"
2928
},
3029
"dependencies": {
File renamed without changes.

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

File renamed without changes.

packages/template/vite-typescript/spec/ViteTypeScriptTemplate.slow.spec.ts renamed to packages/template/vite-typescript/spec/ViteTypeScriptTemplate.slow.verdaccio.spec.ts

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest';
1212

1313
// eslint-disable-next-line n/no-missing-import
1414
import { api } from '../../../api/core/dist/api';
15-
import { initLink } from '../../../api/core/src/api/init-scripts/init-link';
1615

1716
describe('ViteTypeScriptTemplate', () => {
1817
let dir: string;
@@ -85,59 +84,6 @@ describe('ViteTypeScriptTemplate', () => {
8584
// Vite resolves plugins via cwd
8685
cwd = process.cwd();
8786
process.chdir(dir);
88-
/**
89-
* LOCKFILE FIXTURE USAGE:
90-
* We use a pre-generated lockfile to avoid needing to disable Yarn's security features.
91-
*
92-
* When to regenerate the fixture:
93-
* - When vite version is updated in Forge's package.json
94-
* - When template dependencies change significantly
95-
* - When Yarn lockfile format changes
96-
* - When this test starts failing due to dependency resolution issues
97-
*
98-
* How to regenerate:
99-
* Run: yarn ts-node tools/regenerate-lockfile-fixtures.ts
100-
*
101-
* This will create a new lockfile with the correct vite resolution and dependencies.
102-
*/
103-
// Copy pre-generated lockfile and update the project name
104-
const fixtureLockfile = path.join(
105-
__dirname,
106-
'fixtures',
107-
'test-yarn.lock',
108-
);
109-
const targetLockfile = path.join(dir, 'yarn.lock');
110-
let lockfileContent = await fs.promises.readFile(
111-
fixtureLockfile,
112-
'utf-8',
113-
);
114-
115-
// Get the current project name from package.json
116-
const currentPackageJson = JSON.parse(
117-
await fs.promises.readFile(path.join(dir, 'package.json'), 'utf-8'),
118-
);
119-
const projectName = currentPackageJson.name;
120-
121-
// Replace the fixture project name with the actual project name
122-
lockfileContent = lockfileContent.replace(
123-
/electron-forge-test-\d+/g,
124-
projectName,
125-
);
126-
await fs.promises.writeFile(targetLockfile, lockfileContent);
127-
128-
// Install with immutable lockfile (no modifications needed)
129-
await spawnPackageManager(
130-
PACKAGE_MANAGERS['yarn'],
131-
['install', '--immutable'],
132-
{
133-
cwd: dir,
134-
},
135-
);
136-
137-
// Installing deps removes symlinks that were added at the start of this
138-
// spec via `api.init`. So we should re-link local forge dependencies
139-
// again.
140-
await initLink(PACKAGE_MANAGERS['yarn'], dir);
14187
});
14288

14389
afterAll(() => {

0 commit comments

Comments
 (0)