Skip to content

Commit

Permalink
test: speed up only-changed CT test (#32947)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Oct 4, 2024
1 parent d7020cb commit dfa4ab8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/playwright-test/only-changed.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const test = baseTest.extend<{ git(command: string): void }>({
git: async ({}, use, testInfo) => {
const baseDir = testInfo.outputPath();

const git = (command: string) => execSync(`git ${command}`, { cwd: baseDir });
const git = (command: string) => execSync(`git ${command}`, { cwd: baseDir, stdio: process.env.PWTEST_DEBUG ? 'inherit' : 'ignore' });

git(`init --initial-branch=main`);
git(`config --local user.name "Robert Botman"`);
Expand Down Expand Up @@ -204,7 +204,7 @@ test('should suppport component tests', async ({ runInlineTest, git, writeFiles
test('pass', async ({ mount }) => {
const component = await mount(<Button></Button>);
await expect(component).toHaveText('Button');
await expect(component).toHaveText('Button', { timeout: 1000 });
});
`,
'src/button2.test.tsx': `
Expand All @@ -213,7 +213,7 @@ test('should suppport component tests', async ({ runInlineTest, git, writeFiles
test('pass', async ({ mount }) => {
const component = await mount(<Button></Button>);
await expect(component).toHaveText('Button');
await expect(component).toHaveText('Button', { timeout: 1000 });
});
`,
'src/button3.test.tsx': `
Expand All @@ -229,7 +229,7 @@ test('should suppport component tests', async ({ runInlineTest, git, writeFiles
git(`add .`);
git(`commit -m "init"`);

const result = await runInlineTest({}, { 'workers': 1, 'only-changed': true });
const result = await runInlineTest({}, { 'only-changed': true });

expect(result.exitCode).toBe(0);
expect(result.passed).toBe(0);
Expand All @@ -242,10 +242,10 @@ test('should suppport component tests', async ({ runInlineTest, git, writeFiles
test('pass', async ({ mount }) => {
const component = await mount(<Button></Button>);
await expect(component).toHaveText('Different Button');
await expect(component).toHaveText('Different Button', { timeout: 1000 });
});
`
}, { 'workers': 1, 'only-changed': true });
}, { 'only-changed': true });

expect(result2.exitCode).toBe(1);
expect(result2.failed).toBe(1);
Expand All @@ -260,7 +260,7 @@ test('should suppport component tests', async ({ runInlineTest, git, writeFiles
'src/contents.ts': `
export const content = 'Changed Content';
`
}, { 'workers': 1, 'only-changed': true });
}, { 'only-changed': true });

expect(result3.exitCode).toBe(1);
expect(result3.failed).toBe(2);
Expand Down

0 comments on commit dfa4ab8

Please sign in to comment.