-
Notifications
You must be signed in to change notification settings - Fork 26.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix flying-shuttle full mode breaking instrumentation
- Loading branch information
Showing
7 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
test/e2e/instrumentation-hook/flying-shuttle/app/edge/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default function Page() { | ||
return 'edge' | ||
} | ||
|
||
export const runtime = 'edge' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function Layout({ children }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default function Page() { | ||
return 'node' | ||
} | ||
|
||
export const dynamic = 'force-dynamic' |
31 changes: 31 additions & 0 deletions
31
test/e2e/instrumentation-hook/flying-shuttle/flying-shuttle.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import fs from 'fs-extra' | ||
import { nextTestSetup } from 'e2e-utils' | ||
import { retry } from 'next-test-utils' | ||
|
||
describe('instrumentation-hook - flying-shuttle', () => { | ||
const { next, skipped } = nextTestSetup({ | ||
files: __dirname, | ||
skipDeployment: true, | ||
}) | ||
|
||
if (skipped) { | ||
return | ||
} | ||
|
||
beforeAll(async () => { | ||
await fs.remove('.next') | ||
}) | ||
|
||
it('should only register without errors', async () => { | ||
await next.fetch('/') | ||
await next.fetch('/edge') | ||
|
||
await retry(() => { | ||
expect(next.cliOutput).toIncludeRepeated('register:edge', 1) | ||
expect(next.cliOutput).not.toContain( | ||
'An error occurred while loading instrumentation hook' | ||
) | ||
expect(next.cliOutput).toIncludeRepeated('register:nodejs', 1) | ||
}) | ||
}) | ||
}) |
3 changes: 3 additions & 0 deletions
3
test/e2e/instrumentation-hook/flying-shuttle/instrumentation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export function register() { | ||
console.log('register:' + process.env.NEXT_RUNTIME) | ||
} |
11 changes: 11 additions & 0 deletions
11
test/e2e/instrumentation-hook/flying-shuttle/next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* @type {import('next').NextConfig} | ||
*/ | ||
module.exports = { | ||
experimental: { | ||
flyingShuttle: { | ||
mode: 'full', | ||
}, | ||
instrumentationHook: true, | ||
}, | ||
} |