Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
0060de1c
Unverified
Commit
0060de1c
authored
Feb 06, 2024
by
Will Binns-Smith
Committed by
GitHub
Feb 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reapply "Turbopack: convert between locations correctly (#61477)" (#61733) (#61735)
This reverts commit
a32d654c
. Closes PACK-2421
parent
ad15817f
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
130 additions
and
119 deletions
+130
-119
project.rs
packages/next-swc/crates/napi/src/next_api/project.rs
+8
-3
index.ts
packages/next/src/build/swc/index.ts
+12
-2
setup-dev-bundler.ts
...ges/next/src/server/lib/router-utils/setup-dev-bundler.ts
+1
-1
middleware-turbopack.ts
packages/react-dev-overlay/src/middleware-turbopack.ts
+3
-1
middleware.ts
packages/react-dev-overlay/src/middleware.ts
+3
-2
ReactRefreshLogBox-builtins.test.ts
...opment/acceptance-app/ReactRefreshLogBox-builtins.test.ts
+11
-8
ReactRefreshLogBox.test.ts
test/development/acceptance-app/ReactRefreshLogBox.test.ts
+2
-2
ReactRefreshRegression.test.ts
...development/acceptance-app/ReactRefreshRegression.test.ts
+6
-6
ReactRefreshLogBox.test.ts.snap
...eptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap
+23
-21
error-recovery.test.ts
test/development/acceptance-app/error-recovery.test.ts
+12
-26
rsc-build-errors.test.ts
test/development/acceptance-app/rsc-build-errors.test.ts
+1
-1
ReactRefreshLogBox-builtins.test.ts
...evelopment/acceptance/ReactRefreshLogBox-builtins.test.ts
+11
-8
ReactRefreshLogBox.test.ts
test/development/acceptance/ReactRefreshLogBox.test.ts
+2
-2
ReactRefreshRegression.test.ts
test/development/acceptance/ReactRefreshRegression.test.ts
+1
-1
ReactRefreshLogBox.test.ts.snap
.../acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap
+12
-12
error-recovery.test.ts.snap
...ment/acceptance/__snapshots__/error-recovery.test.ts.snap
+2
-2
error-recovery.test.ts
test/development/acceptance/error-recovery.test.ts
+4
-4
server-component-compiler-errors-in-pages.test.ts
...eptance/server-component-compiler-errors-in-pages.test.ts
+2
-2
hmr.test.ts
test/development/basic/hmr.test.ts
+2
-2
index.test.ts
test/development/pages-dir/client-navigation/index.test.ts
+2
-2
index.test.js
test/integration/config-devtool-dev/test/index.test.js
+2
-2
index.test.js
test/integration/server-side-dev-errors/test/index.test.js
+4
-4
turbopack-tests-manifest.json
test/turbopack-tests-manifest.json
+4
-5
No files found.
packages/next-swc/crates/napi/src/next_api/project.rs
View file @
0060de1c
...
...
@@ -791,7 +791,9 @@ pub fn project_update_info_subscribe(
#[derive(Debug)]
#[napi(object)]
pub
struct
StackFrame
{
// 1-indexed, unlike source map tokens
pub
column
:
Option
<
u32
>
,
// 1-indexed, unlike source map tokens
pub
file
:
String
,
pub
is_server
:
bool
,
pub
line
:
u32
,
...
...
@@ -876,7 +878,10 @@ pub async fn project_trace_source(
};
let
token
=
map
.lookup_token
(
frame
.line
as
usize
,
frame
.column
.unwrap_or
(
0
)
as
usize
)
.lookup_token
(
(
frame
.line
as
usize
)
.saturating_sub
(
1
),
(
frame
.column
.unwrap_or
(
1
)
as
usize
)
.saturating_sub
(
1
),
)
.await
?
.clone_value
()
.context
(
"Unable to trace token from sourcemap"
)
?
;
...
...
@@ -893,8 +898,8 @@ pub async fn project_trace_source(
Ok
(
Some
(
StackFrame
{
file
:
source_file
.to_string
(),
method_name
:
token
.name
,
line
:
token
.original_line
as
u32
,
column
:
Some
(
token
.original_column
as
u32
),
line
:
token
.original_line
as
u32
+
1
,
column
:
Some
(
token
.original_column
as
u32
+
1
),
is_server
:
frame
.is_server
,
}))
})
...
...
packages/next/src/build/swc/index.ts
View file @
0060de1c
...
...
@@ -507,8 +507,18 @@ export interface Issue {
content
?:
string
}
range
?:
{
start
:
{
line
:
number
;
column
:
number
}
end
:
{
line
:
number
;
column
:
number
}
start
:
{
// 0-indexed
line
:
number
// 0-indexed
column
:
number
}
end
:
{
// 0-indexed
line
:
number
// 0-indexed
column
:
number
}
}
}
documentationLink
:
string
...
...
packages/next/src/server/lib/router-utils/setup-dev-bundler.ts
View file @
0060de1c
...
...
@@ -339,7 +339,7 @@ async function startWatcher(opts: SetupOpts) {
if (source && source.range) {
const { start } = source.range
message = `${formattedFilePath}:${start.line + 1}:${
start.column
start.column
+ 1
}
\
n${formattedTitle}`
} else if (formattedFilePath) {
message = `${formattedFilePath}
\
n${formattedTitle}`
...
...
packages/react-dev-overlay/src/middleware-turbopack.ts
View file @
0060de1c
...
...
@@ -16,7 +16,9 @@ interface Project {
}
interface
TurbopackStackFrame
{
// 1-based
column
:
number
|
null
// 1-based
file
:
string
isServer
:
boolean
line
:
number
...
...
@@ -87,7 +89,7 @@ export async function createOriginalStackFrame(
{
start
:
{
line
:
traced
.
frame
.
lineNumber
,
column
:
traced
.
frame
.
column
??
0
,
column
:
traced
.
frame
.
column
??
1
,
},
},
{
forceColor
:
true
}
...
...
packages/react-dev-overlay/src/middleware.ts
View file @
0060de1c
...
...
@@ -194,6 +194,7 @@ export async function createOriginalStackFrame({
return
moduleNotFoundResult
}
// This returns 1-based lines and 0-based columns
return
await
findOriginalSourcePositionAndContent
(
source
,
{
line
,
column
,
...
...
@@ -225,7 +226,7 @@ export async function createOriginalStackFrame({
?
path
.
relative
(
rootDirectory
,
filePath
)
:
sourcePosition
.
source
,
lineNumber
:
sourcePosition
.
line
,
column
:
sourcePosition
.
column
,
column
:
(
sourcePosition
.
column
??
0
)
+
1
,
methodName
:
sourcePosition
.
name
||
// default is not a valid identifier in JS so webpack uses a custom variable when it's an unnamed default export
...
...
@@ -245,7 +246,7 @@ export async function createOriginalStackFrame({
{
start
:
{
line
:
sourcePosition
.
line
,
column
:
sourcePosition
.
column
??
0
,
column
:
(
sourcePosition
.
column
??
0
)
+
1
,
},
},
{
forceColor
:
true
}
...
...
test/development/acceptance-app/ReactRefreshLogBox-builtins.test.ts
View file @
0060de1c
...
...
@@ -52,7 +52,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect
(
await
session
.
hasRedbox
()).
toBe
(
true
)
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
await
session
.
getRedboxSource
()).
toMatchInlineSnapshot
(
`
"./node_modules/my-package/index.js:1:1
2
"./node_modules/my-package/index.js:1:1
3
Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns')
| ^^^^^^^^^^^^^^
...
...
@@ -62,7 +62,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`
)
}
else
{
expect
(
await
session
.
getRedboxSource
()).
toMatchInlineSnapshot
(
`
"./node_modules/my-package/index.js:1:1
2
"./node_modules/my-package/index.js:1:1
3
Module not found: Can't resolve 'dns'
https://nextjs.org/docs/messages/module-not-found
...
...
@@ -98,7 +98,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const
source
=
await
session
.
getRedboxSource
()
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./index.js:1:
0
"./index.js:1:
1
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^
...
...
@@ -110,9 +110,10 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`
)
}
else
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./index.js:1:
0
"./index.js:1:
1
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^
2 | export default function Oops() {
3 | return (
4 | <div>
...
...
@@ -150,7 +151,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const
source
=
await
session
.
getRedboxSource
()
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./app/page.js:2:
0
"./app/page.js:2:
1
Module not found: Can't resolve 'b'
1 | 'use client'
> 2 | import Comp from 'b'
...
...
@@ -163,10 +164,11 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`
)
}
else
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./app/page.js:2:
0
"./app/page.js:2:
1
Module not found: Can't resolve 'b'
1 | 'use client'
> 2 | import Comp from 'b'
| ^
3 | export default function Oops() {
4 | return (
5 | <div>
...
...
@@ -199,7 +201,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const
source
=
await
session
.
getRedboxSource
()
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./app/page.js:2:
0
"./app/page.js:2:
1
Module not found: Can't resolve './non-existent.css'
1 | 'use client'
> 2 | import './non-existent.css'
...
...
@@ -212,10 +214,11 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
`
)
}
else
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./app/page.js:2:
0
"./app/page.js:2:
1
Module not found: Can't resolve './non-existent.css'
1 | 'use client'
> 2 | import './non-existent.css'
| ^
3 | export default function Page(props) {
4 | return <p>index page</p>
5 | }
...
...
test/development/acceptance-app/ReactRefreshLogBox.test.ts
View file @
0060de1c
...
...
@@ -222,7 +222,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
const
source
=
next
.
normalizeTestDirContent
(
await
session
.
getRedboxSource
())
if
(
IS_TURBOPACK
)
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./index.js:7:
0
"./index.js:7:
1
Parsing ecmascript source code failed
5 | div
6 | )
...
...
@@ -357,7 +357,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox app %s', () => {
expect
(
await
session
.
hasRedbox
()).
toBe
(
true
)
const
source
=
await
session
.
getRedboxSource
()
expect
(
source
).
toMatch
(
IS_TURBOPACK
?
'./index.module.css:1:
8
'
:
'./index.module.css:1:1'
IS_TURBOPACK
?
'./index.module.css:1:
9
'
:
'./index.module.css:1:1'
)
if
(
!
IS_TURBOPACK
)
{
expect
(
source
).
toMatch
(
'Syntax error: '
)
...
...
test/development/acceptance-app/ReactRefreshRegression.test.ts
View file @
0060de1c
...
...
@@ -286,7 +286,7 @@ describe('ReactRefreshRegression app', () => {
const
source
=
await
session
.
getRedboxSource
()
expect
(
source
.
split
(
/
\r?\n
/g
).
slice
(
2
).
join
(
'
\
n'
)).
toMatchInlineSnapshot
(
`
"> 1 | export default function () { throw new Error('boom'); }
| ^"
|
^"
`
)
await
cleanup
()
...
...
@@ -305,7 +305,7 @@ describe('ReactRefreshRegression app', () => {
const
source
=
await
session
.
getRedboxSource
()
expect
(
source
.
split
(
/
\r?\n
/g
).
slice
(
2
).
join
(
'
\
n'
)).
toMatchInlineSnapshot
(
`
"> 1 | export default function Page() { throw new Error('boom'); }
| ^"
|
^"
`
)
await
cleanup
()
...
...
@@ -326,10 +326,10 @@ describe('ReactRefreshRegression app', () => {
const
source
=
await
session
.
getRedboxSource
()
expect
(
source
.
split
(
/
\r?\n
/g
).
slice
(
2
).
join
(
'
\
n'
)).
toMatchInlineSnapshot
(
`
" 1 | 'use client'
> 2 | export default function Page() { throw new Error('boom'); }
|
^"
`
)
" 1 | 'use client'
> 2 | export default function Page() { throw new Error('boom'); }
|
^"
`
)
await
cleanup
()
})
...
...
test/development/acceptance-app/__snapshots__/ReactRefreshLogBox.test.ts.snap
View file @
0060de1c
...
...
@@ -11,9 +11,10 @@ Import trace for requested module:
`;
exports[`ReactRefreshLogBox app default Import trace when module not found in layout 1`] = `
"./app/module.js:1:
0
"./app/module.js:1:
1
Module not found: Can't resolve 'non-existing-module'
> 1 | import "non-existing-module"
| ^
https://nextjs.org/docs/messages/module-not-found
...
...
@@ -22,31 +23,31 @@ Import trace for requested module:
`;
exports[`ReactRefreshLogBox app default Should not show __webpack_exports__ when exporting anonymous arrow function 1`] = `
"index.js (3:1
0
) @ default
"index.js (3:1
1
) @ default
1 | export default () => {
2 | if (typeof window !== 'undefined') {
> 3 | throw new Error('test')
| ^
|
^
4 | }
5 |
6 | return null"
`;
exports[`ReactRefreshLogBox app default boundaries 1`] = `
"FunctionDefault.js (1:5
0
) @ FunctionDefault
"FunctionDefault.js (1:5
1
) @ FunctionDefault
> 1 | export default function FunctionDefault() { throw new Error('no'); }
| ^"
|
^"
`;
exports[`ReactRefreshLogBox app default conversion to class component (1) 1`] = `
"Child.js (4:1
0
) @ ClickCount.render
"Child.js (4:1
1
) @ ClickCount.render
2 | export default class ClickCount extends Component {
3 | render() {
> 4 | throw new Error()
| ^
|
^
5 | }
6 | }"
`;
...
...
@@ -76,31 +77,31 @@ exports[`ReactRefreshLogBox app default logbox: anchors links in error messages
exports[`ReactRefreshLogBox app default logbox: anchors links in error messages 9`] = `"http://example.com/"`;
exports[`ReactRefreshLogBox app default module init error not shown 1`] = `
"index.js (3:
6
) @ eval
"index.js (3:
7
) @ eval
1 | // top offset for snapshot
2 | import * as React from 'react';
> 3 | throw new Error('no')
| ^
|
^
4 | class ClassDefault extends React.Component {
5 | render() {
6 | return <h1>Default Export</h1>;"
`;
exports[`ReactRefreshLogBox app default should strip whitespace correctly with newline 1`] = `
"index.js (7:1
4
) @ onClick
"index.js (7:1
5
) @ onClick
5 |
6 | <a onClick={() => {
> 7 | throw new Error('idk')
| ^
|
^
8 | }}>
9 | click me
10 | </a>"
`;
exports[`ReactRefreshLogBox app turbo Can't resolve @import in CSS file 1`] = `
"./app/styles1.css:1:
0
"./app/styles1.css:1:
1
Parsing css source code failed
> 1 | @import "./styles2.css"
| ^^^^^^^^^^^^^^^^^^^^^^^
...
...
@@ -109,7 +110,7 @@ Unexpected end of file, but expected ';' or '{'"
`;
exports[`ReactRefreshLogBox app turbo Import trace when module not found in layout 1`] = `
"./app/module.js:1:
0
"./app/module.js:1:
1
Module not found: Can't resolve 'non-existing-module'
> 1 | import "non-existing-module"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
...
@@ -118,21 +119,22 @@ https://nextjs.org/docs/messages/module-not-found"
`;
exports[`ReactRefreshLogBox app turbo Should not show __webpack_exports__ when exporting anonymous arrow function 1`] = `
"index.js (3:
2
) @ {default export}
"index.js (3:
11
) @ {default export}
1 | export default () => {
2 | if (typeof window !== 'undefined') {
> 3 | throw new Error('test')
| ^
|
^
4 | }
5 |
6 | return null"
`;
exports[`ReactRefreshLogBox app turbo boundaries 1`] = `
"FunctionDefault.js (
0:67
) @ FunctionDefault
"FunctionDefault.js (
1:51
) @ FunctionDefault
1 | export default function FunctionDefault() { throw new Error('no'); }"
> 1 | export default function FunctionDefault() { throw new Error('no'); }
| ^"
`;
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 1`] = `"Error: end http://nextjs.org"`;
...
...
@@ -152,24 +154,24 @@ exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 8`
exports[`ReactRefreshLogBox app turbo logbox: anchors links in error messages 9`] = `"http://example.com/"`;
exports[`ReactRefreshLogBox app turbo module init error not shown 1`] = `
"index.js (3:
6
) @ <unknown>
"index.js (3:
7
) @ <unknown>
1 | // top offset for snapshot
2 | import * as React from 'react';
> 3 | throw new Error('no')
| ^
|
^
4 | class ClassDefault extends React.Component {
5 | render() {
6 | return <h1>Default Export</h1>;"
`;
exports[`ReactRefreshLogBox app turbo should strip whitespace correctly with newline 1`] = `
"index.js (7:
6
) @ onClick
"index.js (7:
15
) @ onClick
5 |
6 | <a onClick={() => {
> 7 | throw new Error('idk')
| ^
|
^
8 | }}>
9 | click me
10 | </a>"
...
...
test/development/acceptance-app/error-recovery.test.ts
View file @
0060de1c
...
...
@@ -6,7 +6,7 @@ import path from 'path'
import
{
outdent
}
from
'outdent'
describe
.
each
([
'default'
,
'turbo'
])(
'Error recovery app %s'
,
()
=>
{
const
{
next
,
isTurbopack
}
=
nextTestSetup
({
const
{
next
}
=
nextTestSetup
({
files
:
new
FileRef
(
path
.
join
(
__dirname
,
'fixtures'
,
'default-template'
)),
dependencies
:
{
react
:
'latest'
,
...
...
@@ -144,31 +144,17 @@ describe.each(['default', 'turbo'])('Error recovery app %s', () => {
await
session
.
waitForAndOpenRuntimeError
()
if
(
isTurbopack
)
{
expect
(
await
session
.
getRedboxSource
()).
toMatchInlineSnapshot
(
`
"index.js (7:5) @ eval
5 | const increment = useCallback(() => {
6 | setCount(c => c + 1)
> 7 | throw new Error('oops')
| ^
8 | }, [setCount])
9 | return (
10 | <main>"
`
)
}
else
{
expect
(
await
session
.
getRedboxSource
()).
toMatchInlineSnapshot
(
`
"index.js (7:10) @ eval
5 | const increment = useCallback(() => {
6 | setCount(c => c + 1)
> 7 | throw new Error('oops')
| ^
8 | }, [setCount])
9 | return (
10 | <main>"
`
)
}
expect
(
await
session
.
getRedboxSource
()).
toMatchInlineSnapshot
(
`
"index.js (7:11) @ eval
5 | const increment = useCallback(() => {
6 | setCount(c => c + 1)
> 7 | throw new Error('oops')
| ^
8 | }, [setCount])
9 | return (
10 | <main>"
`
)
await
session
.
patch
(
'index.js'
,
...
...
test/development/acceptance-app/rsc-build-errors.test.ts
View file @
0060de1c
...
...
@@ -359,7 +359,7 @@ describe('Error overlay - RSC build errors', () => {
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
next
.
normalizeTestDirContent
(
await
session
.
getRedboxSource
()))
.
toMatchInlineSnapshot
(
`
"./app/server-with-errors/error-file/error.js:1:
0
"./app/server-with-errors/error-file/error.js:1:
1
Parsing ecmascript source code failed
> 1 | export default function Error() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
...
test/development/acceptance/ReactRefreshLogBox-builtins.test.ts
View file @
0060de1c
...
...
@@ -48,7 +48,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
expect
(
await
session
.
getRedboxSource
()).
toMatchInlineSnapshot
(
process
.
env
.
TURBOPACK
?
`
"./node_modules/my-package/index.js:1:1
2
"./node_modules/my-package/index.js:1:1
3
Module not found: Can't resolve 'dns'
> 1 | const dns = require('dns')
| ^^^^^^^^^^^^^^
...
...
@@ -57,7 +57,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
https://nextjs.org/docs/messages/module-not-found"
`
:
`
"./node_modules/my-package/index.js:1:
0
"./node_modules/my-package/index.js:1:
1
Module not found: Can't resolve 'dns'
https://nextjs.org/docs/messages/module-not-found
...
...
@@ -94,7 +94,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const
source
=
await
session
.
getRedboxSource
()
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./index.js:1:
0
"./index.js:1:
1
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^
...
...
@@ -106,9 +106,10 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`
)
}
else
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./index.js:1:
0
"./index.js:1:
1
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^
2 |
3 | export default function Oops() {
4 | return (
...
...
@@ -146,7 +147,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const
source
=
await
session
.
getRedboxSource
()
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./pages/index.js:1:
0
"./pages/index.js:1:
1
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^^^^^^^^^^^^^^^^^^^^
...
...
@@ -158,9 +159,10 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`
)
}
else
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./pages/index.js:1:
0
"./pages/index.js:1:
1
Module not found: Can't resolve 'b'
> 1 | import Comp from 'b'
| ^
2 |
3 | export default function Oops() {
4 | return (
...
...
@@ -201,7 +203,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const
source
=
await
session
.
getRedboxSource
()
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./pages/_app.js:1:
0
"./pages/_app.js:1:
1
Module not found: Can't resolve './non-existent.css'
> 1 | import './non-existent.css'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
...
@@ -213,9 +215,10 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
`
)
}
else
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./pages/_app.js:1:
0
"./pages/_app.js:1:
1
Module not found: Can't resolve './non-existent.css'
> 1 | import './non-existent.css'
| ^
2 |
3 | export default function App({ Component, pageProps }) {
4 | return <Component {...pageProps} />
...
...
test/development/acceptance/ReactRefreshLogBox.test.ts
View file @
0060de1c
...
...
@@ -211,7 +211,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const
source
=
next
.
normalizeTestDirContent
(
await
session
.
getRedboxSource
())
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./index.js:7:
0
"./index.js:7:
1
Parsing ecmascript source code failed
5 | div
6 | )
...
...
@@ -347,7 +347,7 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
const
source
=
await
session
.
getRedboxSource
()
expect
(
source
).
toMatch
(
process
.
env
.
TURBOPACK
?
'./index.module.css:1:
8
'
?
'./index.module.css:1:
9
'
:
'./index.module.css:1:1'
)
if
(
!
process
.
env
.
TURBOPACK
)
{
...
...
test/development/acceptance/ReactRefreshRegression.test.ts
View file @
0060de1c
...
...
@@ -288,7 +288,7 @@ describe('ReactRefreshRegression', () => {
const
source
=
await
session
.
getRedboxSource
()
expect
(
source
.
split
(
/
\r?\n
/g
).
slice
(
2
).
join
(
'
\
n'
)).
toMatchInlineSnapshot
(
`
"> 1 | export default function () { throw new Error('boom'); }
| ^"
|
^"
`
)
await
cleanup
()
...
...
test/development/acceptance/__snapshots__/ReactRefreshLogBox.test.ts.snap
View file @
0060de1c
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ReactRefreshLogBox default boundaries 1`] = `
"FunctionDefault.js (1:5
0
) @ FunctionDefault
"FunctionDefault.js (1:5
1
) @ FunctionDefault
> 1 | export default function FunctionDefault() { throw new Error('no'); }
| ^"
|
^"
`;
exports[`ReactRefreshLogBox default conversion to class component (1) 1`] = `
"Child.js (4:1
0
) @ ClickCount.render
"Child.js (4:1
1
) @ ClickCount.render
2 | export default class ClickCount extends Component {
3 | render() {
> 4 | throw new Error()
| ^
|
^
5 | }
6 | }"
`;
...
...
@@ -47,24 +47,24 @@ exports[`ReactRefreshLogBox default logbox: anchors links in error messages 11`]
exports[`ReactRefreshLogBox default logbox: anchors links in error messages 12`] = `"http://example.com/"`;
exports[`ReactRefreshLogBox default module init error not shown 1`] = `
"index.js (3:
6
) @ eval
"index.js (3:
7
) @ eval
1 | // top offset for snapshot
2 | import * as React from 'react';
> 3 | throw new Error('no')
| ^
|
^
4 | class ClassDefault extends React.Component {
5 | render() {
6 | return <h1>Default Export</h1>;"
`;
exports[`ReactRefreshLogBox default should strip whitespace correctly with newline 1`] = `
"index.js (8:2
6
) @ onClick
"index.js (8:2
7
) @ onClick
6 |
7 | <a onClick={() => {
> 8 | throw new Error('idk')
| ^
|
^
9 | }}>
10 | click me
11 | </a>"
...
...
@@ -93,24 +93,24 @@ exports[`ReactRefreshLogBox turbo logbox: anchors links in error messages 11`] =
exports[`ReactRefreshLogBox turbo logbox: anchors links in error messages 12`] = `"http://example.com/"`;
exports[`ReactRefreshLogBox turbo module init error not shown 1`] = `
"index.js (3:
6
) @ <unknown>
"index.js (3:
7
) @ <unknown>
1 | // top offset for snapshot
2 | import * as React from 'react';
> 3 | throw new Error('no')
| ^
|
^
4 | class ClassDefault extends React.Component {
5 | render() {
6 | return <h1>Default Export</h1>;"
`;
exports[`ReactRefreshLogBox turbo should strip whitespace correctly with newline 1`] = `
"index.js (8:
18
) @ onClick
"index.js (8:
27
) @ onClick
6 |
7 | <a onClick={() => {
> 8 | throw new Error('idk')
| ^
|
^
9 | }}>
10 | click me
11 | </a>"
...
...
test/development/acceptance/__snapshots__/error-recovery.test.ts.snap
View file @
0060de1c
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`ReactRefreshLogBox default syntax > runtime error 1`] = `
"index.js (5:
8
) @ Error
"index.js (5:
9
) @ Error
3 | setInterval(() => {
4 | i++
> 5 | throw Error('no ' + i)
| ^
|
^
6 | }, 1000)
7 | export default function FunctionNamed() {
8 | return <div />"
...
...
test/development/acceptance/error-recovery.test.ts
View file @
0060de1c
...
...
@@ -107,24 +107,24 @@ describe.each(['default', 'turbo'])('ReactRefreshLogBox %s', () => {
expect
(
await
session
.
hasRedbox
()).
toBe
(
true
)
if
(
isTurbopack
)
{
expect
(
await
session
.
getRedboxSource
()).
toMatchInlineSnapshot
(
`
"index.js (7:
5
) @ <unknown>
"index.js (7:
11
) @ <unknown>
5 | const increment = useCallback(() => {
6 | setCount(c => c + 1)
> 7 | throw new Error('oops')
| ^
|
^
8 | }, [setCount])
9 | return (
10 | <main>"
`
)
}
else
{
expect
(
await
session
.
getRedboxSource
()).
toMatchInlineSnapshot
(
`
"index.js (7:1
0
) @ eval
"index.js (7:1
1
) @ eval
5 | const increment = useCallback(() => {
6 | setCount(c => c + 1)
> 7 | throw new Error('oops')
| ^
|
^
8 | }, [setCount])
9 | return (
10 | <main>"
...
...
test/development/acceptance/server-component-compiler-errors-in-pages.test.ts
View file @
0060de1c
...
...
@@ -57,7 +57,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
next
.
normalizeTestDirContent
(
await
session
.
getRedboxSource
()))
.
toMatchInlineSnapshot
(
`
"./components/Comp.js:1:
0
"./components/Comp.js:1:
1
Parsing ecmascript source code failed
> 1 | import { cookies } from 'next/headers'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
...
@@ -116,7 +116,7 @@ describe('Error Overlay for server components compiler errors in pages', () => {
if
(
process
.
env
.
TURBOPACK
)
{
expect
(
next
.
normalizeTestDirContent
(
await
session
.
getRedboxSource
()))
.
toMatchInlineSnapshot
(
`
"./components/Comp.js:1:
0
"./components/Comp.js:1:
1
Parsing ecmascript source code failed
> 1 | import 'server-only'
| ^^^^^^^^^^^^^^^^^^^^
...
...
test/development/basic/hmr.test.ts
View file @
0060de1c
...
...
@@ -524,7 +524,7 @@ describe.each([[''], ['/docs']])(
`
)
}
else
if
(
basePath
===
''
&&
process
.
env
.
TURBOPACK
)
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./pages/hmr/about2.js:7:
0
"./pages/hmr/about2.js:7:
1
Parsing ecmascript source code failed
5 | div
6 | )
...
...
@@ -562,7 +562,7 @@ describe.each([[''], ['/docs']])(
`
)
}
else
if
(
basePath
===
'/docs'
&&
process
.
env
.
TURBOPACK
)
{
expect
(
source
).
toMatchInlineSnapshot
(
`
"./pages/hmr/about2.js:7:
0
"./pages/hmr/about2.js:7:
1
Parsing ecmascript source code failed
5 | div
6 | )
...
...
test/development/pages-dir/client-navigation/index.test.ts
View file @
0060de1c
...
...
@@ -1385,7 +1385,7 @@ createNextDescribe(
const
text
=
await
getRedboxSource
(
browser
)
expect
(
text
).
toMatch
(
/An Expected error occurred/
)
expect
(
text
).
toMatch
(
/pages
[\\/]
error-inside-browser-page
\.
js
\(
5:1
2
\)
/
/pages
[\\/]
error-inside-browser-page
\.
js
\(
5:1
3
\)
/
)
}
finally
{
if
(
browser
)
{
...
...
@@ -1404,7 +1404,7 @@ createNextDescribe(
expect
(
await
hasRedbox
(
browser
)).
toBe
(
true
)
const
text
=
await
getRedboxSource
(
browser
)
expect
(
text
).
toMatch
(
/An Expected error occurred/
)
expect
(
text
).
toMatch
(
/error-in-the-browser-global-scope
\.
js
\(
2:
8
\)
/
)
expect
(
text
).
toMatch
(
/error-in-the-browser-global-scope
\.
js
\(
2:
9
\)
/
)
}
finally
{
if
(
browser
)
{
await
browser
.
close
()
...
...
test/integration/config-devtool-dev/test/index.test.js
View file @
0060de1c
...
...
@@ -40,12 +40,12 @@ const appDir = join(__dirname, '../')
// TODO: add win32 snapshot
}
else
{
expect
(
await
getRedboxSource
(
browser
)).
toMatchInlineSnapshot
(
`
"pages/index.js (5:1
0
) @ eval
"pages/index.js (5:1
1
) @ eval
3 | export default function Index(props) {
4 | useEffect(() => {
> 5 | throw new Error('this should render')
| ^
|
^
6 | }, [])
7 | return <div>Index Page</div>
8 | }"
...
...
test/integration/server-side-dev-errors/test/index.test.js
View file @
0060de1c
...
...
@@ -206,7 +206,7 @@ describe('server-side dev errors', () => {
const
err
=
stderr
.
slice
(
stderrIdx
)
return
err
.
includes
(
'pages/uncaught-rejection.js'
)
&&
(
err
.
includes
(
'7:19'
)
||
err
.
includes
(
'7:5'
)
)
&&
err
.
includes
(
'7:20'
)
&&
err
.
includes
(
'getServerSideProps'
)
&&
err
.
includes
(
'catch this rejection'
)
?
'success'
...
...
@@ -222,7 +222,7 @@ describe('server-side dev errors', () => {
const
cleanStderr
=
stripAnsi
(
stderr
.
slice
(
stderrIdx
))
return
cleanStderr
.
includes
(
'pages/uncaught-empty-rejection.js'
)
&&
(
cleanStderr
.
includes
(
'7:19'
)
||
cleanStderr
.
includes
(
'7:5'
)
)
&&
cleanStderr
.
includes
(
'7:20'
)
&&
cleanStderr
.
includes
(
'getServerSideProps'
)
&&
cleanStderr
.
includes
(
'new Error()'
)
?
'success'
...
...
@@ -238,7 +238,7 @@ describe('server-side dev errors', () => {
const
err
=
stderr
.
slice
(
stderrIdx
)
return
err
.
includes
(
'pages/uncaught-exception.js'
)
&&
(
err
.
includes
(
'7:10'
)
||
err
.
includes
(
'7:5'
)
)
&&
err
.
includes
(
'7:11'
)
&&
err
.
includes
(
'getServerSideProps'
)
&&
err
.
includes
(
'catch this exception'
)
?
'success'
...
...
@@ -254,7 +254,7 @@ describe('server-side dev errors', () => {
const
cleanStderr
=
stripAnsi
(
stderr
.
slice
(
stderrIdx
))
return
cleanStderr
.
includes
(
'pages/uncaught-empty-exception.js'
)
&&
(
cleanStderr
.
includes
(
'7:10'
)
||
cleanStderr
.
includes
(
'7:5'
)
)
&&
cleanStderr
.
includes
(
'7:11'
)
&&
cleanStderr
.
includes
(
'getServerSideProps'
)
&&
cleanStderr
.
includes
(
'new Error()'
)
?
'success'
...
...
test/turbopack-tests-manifest.json
View file @
0060de1c
...
...
@@ -990,11 +990,11 @@
},
"test/development/acceptance-app/ReactRefreshRegression.test.ts"
:
{
"passed"
:
[
"ReactRefreshRegression app can fast refresh a page with static generation"
"ReactRefreshRegression app can fast refresh a page with static generation"
,
"ReactRefreshRegression app shows an overlay for server-side error in client component"
],
"failed"
:
[
"ReactRefreshRegression app shows an overlay for anonymous function server-side error"
,
"ReactRefreshRegression app shows an overlay for server-side error in client component"
,
"ReactRefreshRegression app shows an overlay for server-side error in server component"
],
"pending"
:
[
...
...
@@ -1336,11 +1336,10 @@
"ReactRefreshRegression can fast refresh a page with config"
,
"ReactRefreshRegression can fast refresh a page with getServerSideProps"
,
"ReactRefreshRegression can fast refresh a page with getStaticProps"
,
"ReactRefreshRegression shows an overlay for a server-side error"
,
"ReactRefreshRegression styled-components hydration mismatch"
],
"failed"
:
[
"ReactRefreshRegression shows an overlay for a server-side error"
],
"failed"
:
[],
"pending"
:
[
"ReactRefreshRegression Turbopack skipped tests custom loader (mdx) should have Fast Refresh enabled"
],
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment