Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion test/bun/dev-reload-stress.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
import assert from 'node:assert/strict';
import { spawn } from 'node:child_process';
import { mkdtempSync, writeFileSync, mkdirSync, rmSync, cpSync } from 'node:fs';
import { mkdtempSync, writeFileSync, mkdirSync, rmSync, cpSync, readdirSync, symlinkSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { basename, dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
Expand Down Expand Up @@ -56,6 +56,14 @@ try {
for (const p of ['core', 'server', 'cli']) {
cpSync(join(ROOT, 'packages', p), join(dir, 'node_modules/@webjsdev', p), { recursive: true, dereference: true, filter: (src) => basename(src) !== 'test' });
}
// The copies need their third-party dependencies, which a real install puts
// next to them. Link the repo's hoisted ones (amaro, the TS stripper Bun
// needs, among them); a symlinked third-party package is harmless, only the
// framework packages have to be real copies.
for (const name of readdirSync(join(ROOT, 'node_modules'))) {
if (name === '@webjsdev' || name.startsWith('.')) continue;
symlinkSync(join(ROOT, 'node_modules', name), join(dir, 'node_modules', name));
}

// The CLI runs from the app's own node_modules, as in a real install: under
// `bun --hot` an entry outside the app breaks dynamic `#` imports by itself,
Expand Down
Loading