Skip to content

Commit fce5c3a

Browse files
committed
fix: run tests preparation through turbo
1 parent 6aa0e9a commit fce5c3a

File tree

5 files changed

+17
-26
lines changed

5 files changed

+17
-26
lines changed

packages/new-compiler/tests/QUICK_START.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pnpm install
1010
pnpm playwright:install
1111

1212
# 3. Prepare test fixtures (takes 2-3 minutes)
13-
pnpm test:prepare
13+
pnpm test:e2e:prepare
1414
```
1515

1616
## Running Tests
@@ -37,7 +37,7 @@ Instead of installing dependencies on every test run, we use a two-stage approac
3737

3838
```
3939
┌─────────────────────────────────────────────────────────────┐
40-
│ Stage 1: Preparation (ONE TIME - run pnpm test:prepare) │
40+
│ Stage 1: Preparation (ONE TIME - run pnpm test:e2e:prepare) │
4141
├─────────────────────────────────────────────────────────────┤
4242
│ │
4343
│ demo/next16/ ──────┐ │
@@ -79,7 +79,7 @@ Instead of installing dependencies on every test run, we use a two-stage approac
7979

8080
**10x faster test execution!**
8181

82-
## When to Re-run `pnpm test:prepare`
82+
## When to Re-run `pnpm test:e2e:prepare`
8383

8484
- When demo app `package.json` changes
8585
- When you update demo app dependencies
@@ -124,17 +124,3 @@ test("my test", async ({ page }) => {
124124
}
125125
});
126126
```
127-
128-
## CI/CD Integration
129-
130-
In CI, run both stages:
131-
132-
```yaml
133-
- name: Prepare fixtures
134-
run: pnpm test:prepare
135-
136-
- name: Run E2E tests
137-
run: pnpm test:e2e
138-
```
139-
140-
You could also cache the `tests/fixtures/` directory to speed up CI runs.

packages/new-compiler/tests/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pnpm playwright:install
1919
3. **Prepare test fixtures** (one-time setup):
2020

2121
```bash
22-
pnpm test:prepare
22+
pnpm test:e2e:prepare
2323
```
2424

2525
This will:
@@ -28,7 +28,7 @@ This will:
2828
- Install dependencies in each fixture
2929
- Takes 2-3 minutes but only needs to be run once
3030

31-
**Note:** You only need to re-run `pnpm test:prepare` if:
31+
**Note:** You only need to re-run `pnpm test:e2e:prepare` if:
3232

3333
- Demo app dependencies change
3434
- You want to test with updated demo apps
@@ -86,7 +86,7 @@ tests/
8686
1. **Preparation Stage** (once):
8787
- Demo apps are copied to `tests/fixtures/`
8888
- Dependencies are installed in each fixture
89-
- Run with: `pnpm test:prepare`
89+
- Run with: `pnpm test:e2e:prepare`
9090

9191
2. **Test Execution** (fast):
9292
- Each test copies the prepared fixture (with node_modules) to a temp directory
@@ -158,7 +158,7 @@ test("my test", async ({ page }) => {
158158

159159
### "Fixture not found" error
160160

161-
Run `pnpm test:prepare` to prepare the fixtures before running tests.
161+
Run `pnpm test:e2e:prepare` to prepare the fixtures before running tests.
162162

163163
### Port conflicts
164164

@@ -178,4 +178,4 @@ Failed tests may leave temp directories. They're in your OS temp folder with `li
178178

179179
### Outdated fixtures
180180

181-
If demo apps change significantly, re-run `pnpm test:prepare` to update the fixtures.
181+
If demo apps change significantly, re-run `pnpm test:e2e:prepare` to update the fixtures.

packages/new-compiler/tests/helpers/fixture-integrity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export async function verifyFixtureIntegrity(
130130
const checksumsPath = getChecksumFilePath(fixturePath);
131131
if (!fsSync.existsSync(checksumsPath)) {
132132
errors.push(
133-
"Checksums file not found. Please run 'pnpm test:prepare' to generate it.",
133+
"Checksums file not found. Please run 'pnpm test:e2e:prepare' to generate it.",
134134
);
135135
return { valid: false, errors };
136136
}

packages/new-compiler/tests/helpers/setup-fixture.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export async function setupFixture(
117117
const fixturePath = path.join(process.cwd(), "tests", "fixtures", framework);
118118
if (!fsSync.existsSync(fixturePath)) {
119119
throw new Error(
120-
`Fixture for ${framework} not found. Run "pnpm test:prepare" first.`,
120+
`Fixture for ${framework} not found. Run "pnpm test:e2e:prepare" first.`,
121121
);
122122
}
123123

@@ -126,7 +126,7 @@ export async function setupFixture(
126126
console.error(`❌ Fixture integrity check failed for ${framework}:`);
127127
errors.forEach((error) => console.error(` - ${error}`));
128128
throw new Error(
129-
`Fixture integrity check failed. Please run "pnpm test:prepare" to recreate fixtures.`,
129+
`Fixture integrity check failed. Please run "pnpm test:e2e:prepare" to recreate fixtures.`,
130130
);
131131
}
132132
console.log(

turbo.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@
1717
"^build"
1818
]
1919
},
20-
"test:e2e": {
20+
"prepare:e2e": {
2121
"dependsOn": [
2222
"^build"
2323
]
2424
},
25+
"test:e2e": {
26+
"dependsOn": [
27+
"prepare:e2e"
28+
]
29+
},
2530
"deploy": {
2631
"dependsOn": [
2732
"build",

0 commit comments

Comments
 (0)