From 348140833c9ccfbabfd9683cff526239915c5d4f Mon Sep 17 00:00:00 2001 From: John Jenkins Date: Mon, 13 Jul 2026 11:15:08 +0100 Subject: [PATCH] fix(wizard): quieten warnings on copy output --- src/test/wizard.spec.ts | 36 ++++++++++++------------------------ src/wizard.ts | 39 +++++++-------------------------------- 2 files changed, 19 insertions(+), 56 deletions(-) diff --git a/src/test/wizard.spec.ts b/src/test/wizard.spec.ts index 4b031e9..af70ea7 100644 --- a/src/test/wizard.spec.ts +++ b/src/test/wizard.spec.ts @@ -16,11 +16,7 @@ function makeSpinner() { return { start: vi.fn(), stop: vi.fn() }; } -function makeInitCtx( - rootDir: string, - outputTargets: Array<{ type: string; copy?: Array<{ src?: string }> }> = [], - isNewProject = false, -) { +function makeInitCtx(rootDir: string, outputTargets: Array<{ type: string }> = [], isNewProject = false) { return { config: { rootDir, fsNamespace: 'my-lib', outputTargets }, isNewProject, @@ -85,7 +81,7 @@ describe('wizard.init.run', () => { it('proceeds and overwrites when user accepts overwrite', async () => { writeFileSync(join(tmpDir, 'playwright.config.ts'), 'export default {};\n'); - const ctx = makeInitCtx(tmpDir, [{ type: 'www', copy: [{ src: '**/*.html' }, { src: '**/*.css' }] }]); + const ctx = makeInitCtx(tmpDir, [{ type: 'www' }]); ctx.prompts.confirm.mockResolvedValueOnce(true); // accept overwrite await wizard.init!.run(ctx as any); @@ -96,7 +92,7 @@ describe('wizard.init.run', () => { }); it('installs @playwright/test as a dev dependency', async () => { - const ctx = makeInitCtx(tmpDir, [{ type: 'www', copy: [{ src: '**/*.html' }, { src: '**/*.css' }] }]); + const ctx = makeInitCtx(tmpDir, [{ type: 'www' }]); await wizard.init!.run(ctx as any); @@ -104,7 +100,7 @@ describe('wizard.init.run', () => { }); it('writes playwright.config.ts with the expected boilerplate', async () => { - const ctx = makeInitCtx(tmpDir, [{ type: 'www', copy: [{ src: '**/*.html' }, { src: '**/*.css' }] }]); + const ctx = makeInitCtx(tmpDir, [{ type: 'www' }]); await wizard.init!.run(ctx as any); @@ -119,7 +115,7 @@ describe('wizard.init.run', () => { join(tmpDir, 'tsconfig.json'), JSON.stringify({ compilerOptions: { lib: ['ES2022', 'DOM'] } }, null, 2) + '\n', ); - const ctx = makeInitCtx(tmpDir, [{ type: 'www', copy: [{ src: '**/*.html' }, { src: '**/*.css' }] }]); + const ctx = makeInitCtx(tmpDir, [{ type: 'www' }]); await wizard.init!.run(ctx as any); @@ -132,7 +128,7 @@ describe('wizard.init.run', () => { join(tmpDir, 'tsconfig.json'), JSON.stringify({ compilerOptions: { lib: ['ES2022', 'ESNext.Disposable'] } }, null, 2) + '\n', ); - const ctx = makeInitCtx(tmpDir, [{ type: 'www', copy: [{ src: '**/*.html' }, { src: '**/*.css' }] }]); + const ctx = makeInitCtx(tmpDir, [{ type: 'www' }]); await wizard.init!.run(ctx as any); @@ -141,7 +137,7 @@ describe('wizard.init.run', () => { }); it('skips tsconfig editing when no tsconfig.json exists', async () => { - const ctx = makeInitCtx(tmpDir, [{ type: 'www', copy: [{ src: '**/*.html' }, { src: '**/*.css' }] }]); + const ctx = makeInitCtx(tmpDir, [{ type: 'www' }]); await wizard.init!.run(ctx as any); @@ -185,19 +181,11 @@ describe('wizard.init.run', () => { ); }); - it('warns about a missing copy config on an existing www target', async () => { + it('does not warn when a "www" output target is already configured', async () => { const ctx = makeInitCtx(tmpDir, [{ type: 'www' }]); await wizard.init!.run(ctx as any); - expect(ctx.prompts.log.warn).toHaveBeenCalledWith(expect.stringContaining('no "copy" config')); - }); - - it('does not warn when the www target already has a suitable copy config', async () => { - const ctx = makeInitCtx(tmpDir, [{ type: 'www', copy: [{ src: '**/*.html' }, { src: '**/*.css' }] }]); - - await wizard.init!.run(ctx as any); - expect(ctx.prompts.log.warn).not.toHaveBeenCalled(); }); @@ -206,7 +194,7 @@ describe('wizard.init.run', () => { join(tmpDir, 'package.json'), JSON.stringify({ name: 'test-lib', scripts: { test: 'my-custom-test' } }, null, 2) + '\n', ); - const ctx = makeInitCtx(tmpDir, [{ type: 'www', copy: [{ src: '**/*.html' }, { src: '**/*.css' }] }]); + const ctx = makeInitCtx(tmpDir, [{ type: 'www' }]); await wizard.init!.run(ctx as any); @@ -216,7 +204,7 @@ describe('wizard.init.run', () => { }); it('does not add a bare "test" script', async () => { - const ctx = makeInitCtx(tmpDir, [{ type: 'www', copy: [{ src: '**/*.html' }, { src: '**/*.css' }] }]); + const ctx = makeInitCtx(tmpDir, [{ type: 'www' }]); await wizard.init!.run(ctx as any); @@ -236,7 +224,7 @@ export class MyButton { render() { return