Skip to content

Commit

Permalink
fix: adjust the kill app mechanism for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattjoh committed Jun 1, 2023
1 parent e5c45b7 commit 0f3f77f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/integration/telemetry/test/page-features.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ describe('page features telemetry', () => {
}

try {
expect(stderr).toContain('NEXT_CLI_SESSION_STARTED')
const event1 = /NEXT_CLI_SESSION_STARTED[\s\S]+?{([\s\S]+?)}/
.exec(stderr)
.pop()
Expand Down Expand Up @@ -94,10 +95,11 @@ describe('page features telemetry', () => {
await check(() => stderr, /NEXT_CLI_SESSION_STARTED/)

if (app) {
await app.kill('SIGINT')
await killApp(app)
}
await check(() => stderr, /NEXT_CLI_SESSION_STOPPED/)

expect(stderr).toContain('NEXT_CLI_SESSION_STOPPED')
const event1 = /NEXT_CLI_SESSION_STOPPED[\s\S]+?{([\s\S]+?)}/
.exec(stderr)
.pop()
Expand Down Expand Up @@ -133,10 +135,12 @@ describe('page features telemetry', () => {
await check(() => stderr, /NEXT_CLI_SESSION_STARTED/)

if (app) {
await app.kill('SIGINT')
await killApp(app)
}

await check(() => stderr, /NEXT_CLI_SESSION_STOPPED/)

expect(stderr).toContain('NEXT_CLI_SESSION_STOPPED')
const event1 = /NEXT_CLI_SESSION_STOPPED[\s\S]+?{([\s\S]+?)}/
.exec(stderr)
.pop()
Expand Down Expand Up @@ -198,6 +202,7 @@ describe('page features telemetry', () => {
})

try {
expect(stderr).toContain('NEXT_BUILD_OPTIMIZED')
const event1 = /NEXT_BUILD_OPTIMIZED[\s\S]+?{([\s\S]+?)}/
.exec(stderr)
.pop()
Expand All @@ -211,6 +216,7 @@ describe('page features telemetry', () => {
expect(event1).toMatch(/"edgeRuntimeAppCount": 1/)
expect(event1).toMatch(/"edgeRuntimePagesCount": 2/)

expect(stderr).toContain('NEXT_BUILD_COMPLETED')
const event2 = /NEXT_BUILD_COMPLETED[\s\S]+?{([\s\S]+?)}/
.exec(stderr)
.pop()
Expand All @@ -233,6 +239,7 @@ describe('page features telemetry', () => {
env: { NEXT_TELEMETRY_DEBUG: 1 },
})

expect(build.stderr).toContain('NEXT_BUILD_OPTIMIZED')
let event1 = /NEXT_BUILD_OPTIMIZED[\s\S]+?{([\s\S]+?)}/
.exec(build.stderr)
.pop()
Expand Down Expand Up @@ -262,6 +269,7 @@ describe('page features telemetry', () => {
)

try {
expect(build.stderr).toContain('NEXT_BUILD_OPTIMIZED')
const event1 = /NEXT_BUILD_OPTIMIZED[\s\S]+?{([\s\S]+?)}/
.exec(build.stderr)
.pop()
Expand Down Expand Up @@ -295,6 +303,7 @@ describe('page features telemetry', () => {
)

try {
expect(build.stderr).toContain('NEXT_BUILD_OPTIMIZED')
const event1 = /NEXT_BUILD_OPTIMIZED[\s\S]+?{([\s\S]+?)}/
.exec(build.stderr)
.pop()
Expand Down

0 comments on commit 0f3f77f

Please sign in to comment.