understand nested dependencies

This commit is contained in:
Simon Knott 2024-07-18 17:12:55 +02:00
parent b618a613ea
commit 93983476f8
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
2 changed files with 13 additions and 4 deletions

View file

@ -173,7 +173,12 @@ export async function buildBundle(config: FullConfig, configDir: string): Promis
{
for (const [importingFile, components] of componentsByImportingFile) {
setExternalDependencies(importingFile, components)
const deps = new Set<string>();
for (const component of components) {
for (const d of buildInfo.deps[component])
deps.add(d);
}
setExternalDependencies(importingFile, [...deps]);
}
}

View file

@ -152,8 +152,12 @@ test('should suppport component tests', async ({ runInlineTest, setupRepository,
'playwright/index.html': `<script type="module" src="./index.ts"></script>`,
'playwright/index.ts': `
`,
'src/contents.ts': `
export const content = "Button";
`,
'src/button.tsx': `
export const Button = () => <button>Button</button>;
import {content} from './contents';
export const Button = () => <button>{content}</button>;
`,
'src/button.test.tsx': `
import { test, expect } from '@playwright/experimental-ct-react';
@ -204,8 +208,8 @@ test('should suppport component tests', async ({ runInlineTest, setupRepository,
git('commit -am "update button2 test"');
const result3 = await runInlineTest({
'src/button.tsx': `
export const Button = () => <button>And another different Button</button>;
'src/contents.ts': `
export const content = 'Changed Content';
`
}, { 'workers': 1, 'only-changed': true });