Skip to content

Commit 19c78cf

Browse files
committed
test(e2e): add debug option to fixture creation pipeline
1 parent daa84dd commit 19c78cf

File tree

7 files changed

+51
-30
lines changed

7 files changed

+51
-30
lines changed

e2e/capture/capture-flood/capture-flood.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import { getDirname } from "../../utils";
66
const { test } = createNextTest({
77
path: join(getDirname(import.meta.url), 'app'),
88
port: 3004,
9-
dependencies: {
10-
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..', '..')}`
11-
}
9+
debug: true,
10+
...(process.env.CI === undefined && {
11+
dependencies: {
12+
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..', '..')}`
13+
}
14+
})
1215
})
1316

1417
test("flood of captures are ignored and doesn't affect app performance", async ({ page }) => {

e2e/capture/error-boundary/next-error-boundary.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ const { test } = createNextTest({
77
path: join(getDirname(import.meta.url), 'app'),
88
port: 3005,
99
id: 'error-boundary',
10-
dependencies: {
11-
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..', '..')}`
12-
}
10+
debug: true,
11+
...(process.env.CI === undefined && {
12+
dependencies: {
13+
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..', '..')}`
14+
}
15+
})
1316
})
1417

1518
test("server component error boundary sends captures", async ({ page }) => {

e2e/capture/next-backend.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ const { test } = createNextTest({
66
path: join(getDirname(import.meta.url), '..', '..', 'examples', 'with-nextjs-api'),
77
port: 3000,
88
id: 'next-backend',
9-
dependencies: {
10-
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..')}`
11-
}
9+
debug: true,
10+
...(process.env.CI === undefined && {
11+
dependencies: {
12+
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..')}`
13+
}
14+
})
1215
})
1316

1417
test("captures backend bug in next.js", async ({ page }) => {

e2e/capture/next-frontend.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ const { test } = createNextTest({
77
path: join(getDirname(import.meta.url), '..', '..', 'examples', 'with-nextjs'),
88
port: 3001,
99
id: 'next-frontend',
10-
dependencies: {
11-
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..')}`
12-
}
10+
debug: true,
11+
...(process.env.CI === undefined && {
12+
dependencies: {
13+
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..')}`
14+
}
15+
})
1316
})
1417

1518
test("captures frontend bug in next.js", async ({ page }) => {

e2e/capture/nuxt-frontend.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ const { test } = createNextTest({
77
port: 3002,
88
serverReadyString: 'warmed up',
99
id: 'nuxt-frontend',
10-
dependencies: {
11-
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..')}`
12-
}
10+
debug: true,
11+
...(process.env.CI === undefined && {
12+
dependencies: {
13+
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..')}`
14+
}
15+
})
1316
})
1417

1518
test("captures frontend bug in nuxt", async ({ page }) => {

e2e/capture/sveltekit-frontend.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ const { test } = createNextTest({
66
path: join(getDirname(import.meta.url), '..', '..', 'examples', 'with-sveltekit'),
77
port: 5173, // should be 3003
88
id: 'sveltekit-frontend',
9-
dependencies: {
10-
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..')}`
11-
}
9+
debug: true,
10+
...(process.env.CI === undefined && {
11+
dependencies: {
12+
"useflytrap": `link:${join(getDirname(import.meta.url), '..', '..')}`
13+
}
14+
})
1215
})
1316

1417
test("captures frontend bug in svelte kit", async ({ page }) => {

e2e/fixture.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export type NextTestOptions = {
1919

2020
export function createNextTest({
2121
path,
22-
timeout = ms("2 minutes"),
22+
timeout = ms("5 minutes"),
2323
port = 3000,
2424
dependencies,
2525
showStdout = false,
@@ -36,23 +36,25 @@ export function createNextTest({
3636
})
3737

3838
test.setTimeout(timeout)
39-
// baseTest.setTimeout(timeout)
39+
40+
const idOr = (id?: string) => id === undefined ? '' : `${id}: `;
4041

4142
// Start Next.js dev server
4243
test.beforeAll(async ({}, testInfo) => {
4344
testInfo.setTimeout(timeout)
4445
tempTestPath = await createTempTestFolder(path)
45-
if (id) {
46-
console.log(id, "CREATED TEMP FOLDER")
46+
47+
if (debug) {
48+
console.log(`${idOr(id)} Created temp folder`)
4749
}
4850

4951
// Patch dependencies
5052
mergePackageJson(tempTestPath, { dependencies });
5153

5254
// Run install
5355
await pnpmInstall(tempTestPath, showStdout)
54-
if (id) {
55-
console.log(id, "RAN PNPM INSTALL")
56+
if (debug) {
57+
console.log(`${idOr(id)} Finished "pnpm install"`)
5658
}
5759

5860
// Start dev server
@@ -64,13 +66,13 @@ export function createNextTest({
6466
}
6567
})
6668

67-
if (id) {
68-
console.log(id, "STARTED SERVER")
69+
if (debug) {
70+
console.log(`${idOr(id)} Started server`)
6971
}
7072

7173
if (true) {
72-
serverProcess.stdout?.on('data', (data: Buffer | string) => console.log(id, data.toString()))
73-
serverProcess.stderr?.on('data', (data: Buffer | string) => console.error(id, data.toString()))
74+
serverProcess.stdout?.on('data', (data: Buffer | string) => console.log(idOr(id), data.toString()))
75+
serverProcess.stderr?.on('data', (data: Buffer | string) => console.error(idOr(id), data.toString()))
7476
}
7577

7678
await new Promise<undefined>(resolve => {
@@ -80,8 +82,9 @@ export function createNextTest({
8082
}
8183
});
8284
});
83-
if (id) {
84-
console.log(id, "SERVER READY")
85+
86+
if (debug) {
87+
console.log(`${idOr(id)} Server ready`)
8588
}
8689
})
8790

0 commit comments

Comments
 (0)