test: consolidate repeated application rebuild checks (#29628)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-10-16 05:10:22 -07:00
committed by GitHub
co-authored by OrcaWin
parent 5db05e8ed4
commit 36d449ba67
@@ -128,7 +128,7 @@ function readEmittedVersion(root: string): number {
}
describe('External process-host development rebuilds', () => {
it('skips excluded test and fixture changes without reloading the application', async () => {
it('ignores excluded files and rebuilds application edits without recompiling the package', async () => {
const { root, packageDir, main } = fixture()
const fixtureDir = join(packageDir, 'src', '__fixtures__')
mkdirSync(fixtureDir)
@@ -159,6 +159,8 @@ describe('External process-host development rebuilds', () => {
const rebuilt = nextEvent(watcher, 'END')
writeFileSync(main, "module.exports = { ...require('@orca/process-host'), changed: true }\n")
await rebuilt
expect(readEmittedVersion(root)).toBe(1)
expect(readFileSync(join(root, 'out', 'main.cjs'), 'utf8')).toContain('changed')
expect(readFileSync(join(packageDir, 'builds.txt'), 'utf8')).toBe('build\n')
})
@@ -222,29 +224,6 @@ describe('External process-host development rebuilds', () => {
.toContain('exports.version')
})
it('skips package compilation when only application code changes', async () => {
const { root, packageDir, main } = fixture()
const watcher = watch({
input: main,
external: ['@orca/process-host'],
plugins: [createProcessHostDevRebuildPlugin(root)],
output: { file: join(root, 'out', 'main.cjs'), format: 'cjs' }
})
watchers.push(watcher)
closeSuccessfulBundles(watcher)
await nextEvent(watcher, 'END')
const builds = join(packageDir, 'builds.txt')
expect(readFileSync(builds, 'utf8')).toBe('build\n')
const rebuilt = nextEvent(watcher, 'END')
writeFileSync(main, "module.exports = { ...require('@orca/process-host'), changed: true }\n")
await rebuilt
expect(readEmittedVersion(root)).toBe(1)
expect(readFileSync(join(root, 'out', 'main.cjs'), 'utf8')).toContain('changed')
expect(readFileSync(builds, 'utf8')).toBe('build\n')
})
it('emits private source edits and new imports before the Electron reload hook', async () => {
const { root, packageDir, main } = fixture()
const loadedVersions: number[] = []