Add tests for HMR (#49206)

This adds tests for Turbopack HMR as part of the Next.js turbo
integration test suite.
This commit is contained in:
Alex Kirszenberg 2023-05-10 12:34:05 +02:00 committed by GitHub
parent c9d87eec7c
commit 6a3f96e6b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 470 additions and 140 deletions

View file

@ -0,0 +1 @@
tests/temp

View file

@ -7,8 +7,10 @@ declare global {
// We need to extract only the call signature as `autoReady(jest.describe)` drops all the other properties
var describe: AutoReady<typeof jest.describe>
var it: AutoReady<typeof jest.it>
var READY: (arg: string) => void
var TURBOPACK_READY: (arg: string) => void
var TURBOPACK_CHANGE_FILE: (arg: string) => void
var nsObj: (obj: any) => any
var __turbopackFileChanged: (id: string, error: Error) => void
interface Window {
NEXT_HYDRATED?: boolean
@ -62,8 +64,8 @@ function markReady() {
isReady = true
requestIdleCallback(
() => {
if (typeof READY === 'function') {
READY('')
if (typeof TURBOPACK_READY === 'function') {
TURBOPACK_READY('')
} else {
console.info(
'%cTurbopack tests:',
@ -83,16 +85,28 @@ export function wait(ms: number): Promise<void> {
})
}
async function waitForPath(contentWindow: Window, path: string): Promise<void> {
export async function waitForCondition(
predicate: () => boolean,
timeout: number | null = null
): Promise<void> {
const start = Date.now()
while (true) {
if (contentWindow.location.pathname === path) {
if (predicate()) {
break
}
await wait(1)
if (timeout != null && Date.now() - start > timeout) {
throw new Error('Timed out waiting for condition')
}
}
}
async function waitForPath(contentWindow: Window, path: string): Promise<void> {
return waitForCondition(() => contentWindow.location.pathname === path)
}
/**
* Loads a new page in an iframe and waits for it to load.
*/
@ -210,3 +224,41 @@ export function markAsHydrated() {
window.onNextHydrated()
}
}
const fileChangedResolvers: Map<
string,
{ resolve: (value: unknown) => void; reject: (error: Error) => void }
> = new Map()
globalThis.__turbopackFileChanged = (id: string, error?: Error) => {
const resolver = fileChangedResolvers.get(id)
if (resolver == null) {
throw new Error(`No resolver found for id ${id}`)
} else if (error != null) {
resolver.reject(error)
} else {
resolver.resolve(null)
}
}
function unsafeUniqueId(): string {
const LENGTH = 10
const BASE = 16
return Math.floor(Math.random() * Math.pow(BASE, LENGTH))
.toString(BASE)
.slice(0, LENGTH)
}
export async function changeFile(
path: string,
find: string,
replaceWith: string
) {
return new Promise((resolve, reject) => {
const id = unsafeUniqueId()
fileChangedResolvers.set(id, { resolve, reject })
TURBOPACK_CHANGE_FILE(JSON.stringify({ path, id, find, replaceWith }))
})
}

View file

@ -22,6 +22,7 @@ use chromiumoxide::{
},
},
error::CdpError::Ws,
Page,
};
use dunce::canonicalize;
use futures::StreamExt;
@ -49,7 +50,7 @@ use turbo_binding::{
},
tasks_fs::{DiskFileSystemVc, FileSystem, FileSystemPathVc},
tasks_memory::MemoryBackend,
tasks_testing::retry::retry_async,
tasks_testing::retry::{retry, retry_async},
},
turbopack::{
core::issue::{
@ -65,6 +66,12 @@ fn register() {
include!(concat!(env!("OUT_DIR"), "/register_test_integration.rs"));
}
#[derive(Debug)]
struct JsResult {
uncaught_exceptions: Vec<String>,
run_result: JestRunResult,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct JestRunResult {
@ -124,7 +131,17 @@ fn test(resource: PathBuf) {
return;
}
let run_result = run_async_test(run_test(resource));
let JsResult {
uncaught_exceptions,
run_result,
} = run_async_test(run_test(resource));
if !uncaught_exceptions.is_empty() {
panic!(
"Uncaught exception(s) in test:\n{}",
uncaught_exceptions.join("\n")
)
}
assert!(
!run_result.test_results.is_empty(),
@ -157,7 +174,11 @@ fn test(resource: PathBuf) {
#[should_panic]
fn test_skipped_fails(resource: PathBuf) {
let resource = resource.parent().unwrap().to_path_buf();
let run_result = run_async_test(run_test(resource));
let JsResult {
// Ignore uncaught exceptions for skipped tests.
uncaught_exceptions: _,
run_result,
} = run_async_test(run_test(resource));
// Assert that this skipped test itself has at least one browser test which
// fails.
@ -172,7 +193,28 @@ fn test_skipped_fails(resource: PathBuf) {
);
}
async fn run_test(resource: PathBuf) -> JestRunResult {
fn copy_recursive(from: &Path, to: &Path) -> std::io::Result<()> {
let from = canonicalize(from)?;
let to = canonicalize(to)?;
let mut entries = vec![];
for entry in from.read_dir()? {
let entry = entry?;
let path = entry.path();
let to_path = to.join(path.file_name().unwrap());
if path.is_dir() {
std::fs::create_dir_all(&to_path)?;
entries.push((path, to_path));
} else {
std::fs::copy(&path, &to_path)?;
}
}
for (from, to) in entries {
copy_recursive(&from, &to)?;
}
Ok(())
}
async fn run_test(resource: PathBuf) -> JsResult {
register();
let resource = canonicalize(resource).unwrap();
@ -184,6 +226,21 @@ async fn run_test(resource: PathBuf) -> JestRunResult {
);
let package_root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let tests_dir = package_root.join("tests");
let integration_tests_dir = tests_dir.join("integration");
let resource_temp: PathBuf = tests_dir.join("temp").join(
resource
.strip_prefix(integration_tests_dir)
.expect("resource path must be within the integration tests directory"),
);
// We don't care about errors when removing the previous temp directory.
// It can still exist if we crashed during a previous test run.
let _ = std::fs::remove_dir_all(&resource_temp);
std::fs::create_dir_all(&resource_temp).expect("failed to create temporary directory");
copy_recursive(&resource, &resource_temp)
.expect("failed to copy test files to temporary directory");
let cargo_workspace_root = canonicalize(package_root)
.unwrap()
.parent()
@ -192,12 +249,12 @@ async fn run_test(resource: PathBuf) -> JestRunResult {
.unwrap()
.to_path_buf();
let test_dir = resource.to_path_buf();
let test_dir = resource_temp.to_path_buf();
let workspace_root = cargo_workspace_root.parent().unwrap().parent().unwrap();
let project_dir = test_dir.join("input");
let requested_addr = get_free_local_addr().unwrap();
let mock_dir = resource.join("__httpmock__");
let mock_dir = resource_temp.join("__httpmock__");
let mock_server_future = get_mock_server_future(&mock_dir);
let (issue_tx, mut issue_rx) = unbounded_channel();
@ -248,7 +305,7 @@ async fn run_test(resource: PathBuf) -> JestRunResult {
let result = tokio::select! {
// Poll the mock_server first to add the env var
_ = mock_server_future => panic!("Never resolves"),
r = run_browser(local_addr) => r.expect("error while running browser"),
r = run_browser(local_addr, &project_dir) => r.expect("error while running browser"),
_ = server.future => panic!("Never resolves"),
};
@ -257,7 +314,7 @@ async fn run_test(resource: PathBuf) -> JestRunResult {
let task = tt.spawn_once_task(async move {
let issues_fs = DiskFileSystemVc::new(
"issues".to_string(),
test_dir.join("issues").to_string_lossy().to_string(),
resource.join("issues").to_string_lossy().to_string(),
)
.as_file_system();
@ -277,6 +334,16 @@ async fn run_test(resource: PathBuf) -> JestRunResult {
});
tt.wait_task_completion(task, true).await.unwrap();
// This sometimes fails for the following test:
// test_tests__integration__next__webpack_loaders__no_options__input
retry(
(),
|()| std::fs::remove_dir_all(&resource_temp),
3,
Duration::from_millis(100),
)
.expect("failed to remove temporary directory");
result
}
@ -318,7 +385,16 @@ async fn create_browser(is_debugging: bool) -> Result<(Browser, JoinSet<()>)> {
Ok((browser, set))
}
async fn run_browser(addr: SocketAddr) -> Result<JestRunResult> {
const TURBOPACK_READY_BINDING: &str = "TURBOPACK_READY";
const TURBOPACK_DONE_BINDING: &str = "TURBOPACK_DONE";
const TURBOPACK_CHANGE_FILE_BINDING: &str = "TURBOPACK_CHANGE_FILE";
const BINDINGS: [&str; 3] = [
TURBOPACK_READY_BINDING,
TURBOPACK_DONE_BINDING,
TURBOPACK_CHANGE_FILE_BINDING,
];
async fn run_browser(addr: SocketAddr, project_dir: &Path) -> Result<JsResult> {
let is_debugging = *DEBUG_BROWSER;
let (browser, mut handle) = create_browser(is_debugging).await?;
@ -334,7 +410,9 @@ async fn run_browser(addr: SocketAddr) -> Result<JestRunResult> {
.await
.context("Failed to create new browser page")?;
page.execute(AddBindingParams::new("READY")).await?;
for binding in BINDINGS {
page.execute(AddBindingParams::new(binding)).await?;
}
let mut errors = page
.event_listener::<EventExceptionThrown>()
@ -365,7 +443,7 @@ async fn run_browser(addr: SocketAddr) -> Result<JestRunResult> {
if is_debugging {
let _ = page.evaluate(
r#"console.info("%cTurbopack tests:", "font-weight: bold;", "Waiting for READY to be signaled by page...");"#,
r#"console.info("%cTurbopack tests:", "font-weight: bold;", "Waiting for TURBOPACK_READY to be signaled by page...");"#,
)
.await;
}
@ -374,6 +452,7 @@ async fn run_browser(addr: SocketAddr) -> Result<JestRunResult> {
let mut bindings_next = binding_events.next();
let mut console_next = console_events.next();
let mut network_next = network_response_events.next();
let mut uncaught_exceptions = vec![];
loop {
tokio::select! {
@ -413,10 +492,7 @@ async fn run_browser(addr: SocketAddr) -> Result<JestRunResult> {
let message = message.trim_end();
if !is_debugging {
if !expected_error {
return Err(anyhow!(
"Exception throw in page: {}",
message
))
uncaught_exceptions.push(message.to_string());
}
} else if expected_error {
println!("Exception throw in page:\n{}", message);
@ -429,19 +505,12 @@ async fn run_browser(addr: SocketAddr) -> Result<JestRunResult> {
errors_next = errors.next();
}
event = &mut bindings_next => {
if event.is_some() {
if is_debugging {
let run_tests_msg =
"Entering debug mode. Run `await __jest__.run()` in the browser console to run tests.";
println!("\n\n{}", run_tests_msg);
page.evaluate(format!(
r#"console.info("%cTurbopack tests:", "font-weight: bold;", "{}");"#,
run_tests_msg
))
.await?;
} else {
let value = page.evaluate("__jest__.run()").await?.into_value()?;
return Ok(value);
if let Some(event) = event {
if let Some(run_result) = handle_binding(&page, &*event, project_dir, is_debugging).await? {
return Ok(JsResult {
uncaught_exceptions,
run_result,
});
}
} else {
return Err(anyhow!("Binding events channel ended unexpectedly"));
@ -465,7 +534,7 @@ async fn run_browser(addr: SocketAddr) -> Result<JestRunResult> {
}
() = tokio::time::sleep(Duration::from_secs(60)) => {
if !is_debugging {
return Err(anyhow!("Test timeout while waiting for READY"));
return Err(anyhow!("Test timeout while waiting for TURBOPACK_READY"));
}
}
};
@ -499,6 +568,87 @@ async fn get_mock_server_future(mock_dir: &Path) -> Result<(), String> {
}
}
async fn handle_binding(
page: &Page,
event: &EventBindingCalled,
project_dir: &Path,
is_debugging: bool,
) -> Result<Option<JestRunResult>, anyhow::Error> {
match event.name.as_str() {
TURBOPACK_READY_BINDING => {
if is_debugging {
let run_tests_msg = "Entering debug mode. Run `await __jest__.run()` in the \
browser console to run tests.";
println!("\n\n{}", run_tests_msg);
page.evaluate(format!(
r#"console.info("%cTurbopack tests:", "font-weight: bold;", "{}");"#,
run_tests_msg
))
.await?;
} else {
page.evaluate_expression(
"(() => { __jest__.run().then((runResult) => \
TURBOPACK_DONE(JSON.stringify(runResult))) })()",
)
.await?;
}
}
TURBOPACK_DONE_BINDING => {
let run_result: JestRunResult = serde_json::from_str(&event.payload)?;
return Ok(Some(run_result));
}
TURBOPACK_CHANGE_FILE_BINDING => {
let change_file: ChangeFileCommand = serde_json::from_str(&event.payload)?;
let path = Path::new(&change_file.path);
// Ensure `change_file.path` can't escape the project directory.
let path = path
.components()
.filter(|c| match c {
std::path::Component::Normal(_) => true,
_ => false,
})
.collect::<std::path::PathBuf>();
let path: PathBuf = project_dir.join(path);
let mut file_contents = std::fs::read_to_string(&path)?;
if !file_contents.contains(&change_file.find) {
page.evaluate(format!(
"__turbopackFileChanged({}, new Error({}));",
serde_json::to_string(&change_file.id)?,
serde_json::to_string(&format!(
"TURBOPACK_CHANGE_FILE: file {} does not contain {}",
path.display(),
&change_file.find
))?
))
.await?;
} else {
file_contents = file_contents.replace(&change_file.find, &change_file.replace_with);
std::fs::write(&path, file_contents)?;
page.evaluate(format!(
"__turbopackFileChanged({});",
serde_json::to_string(&change_file.id)?
))
.await?;
}
}
_ => {}
};
Ok(None)
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct ChangeFileCommand {
path: String,
id: String,
find: String,
replace_with: String,
}
#[turbo_tasks::value(shared)]
struct TestIssueReporter {
#[turbo_tasks(trace_ignore, debug_ignore)]

View file

@ -69,7 +69,8 @@ function runTests(harness: Harness, iframe: HTMLIFrameElement) {
TIMEOUT
)
it(
// TODO(WEB-980) Fix this test once we no longer throw an error when rendering a 404 page.
it.skip(
'navigates to the segment 404 page',
async () => {
await harness.load(iframe, '/link-segment')
@ -91,7 +92,8 @@ function runTests(harness: Harness, iframe: HTMLIFrameElement) {
TIMEOUT
)
it(
// TODO(WEB-980) Fix this test once we no longer throw an error when rendering a 404 page.
it.skip(
'renders a segment 404 page',
async () => {
await harness.load(iframe, '/segment')

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/route-WEB-627/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/route-WEB-627/input/app",
),
description: "Next.js App Route /api/test",
},

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/route-WEB-627/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/route-WEB-627/input/app",
),
description: "Next.js App Route /api/test",
},

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/route-WEB-869/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/route-WEB-869/input/app",
),
description: "Next.js App Route /[slug]",
},

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/route-WEB-869/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/route-WEB-869/input/app",
),
description: "Next.js App Route /[slug]",
},

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/route/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/route/input/app",
),
description: "Next.js App Route /api/crypto",
},

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/route/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/route/input/app",
),
description: "Next.js App Route /[slug]",
},

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/route/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/route/input/app",
),
description: "Next.js App Route /api/crypto",
},

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/route/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/route/input/app",
),
description: "Next.js App Route /[slug]",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/use-server/input/app/action.tsx",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/use-server/input/app/action.tsx",
category: "unsupported",
title: "Server actions (\"use server\") are not yet supported in Turbopack",
description: "",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/use-server/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/use-server/input/app",
),
description: "Next.js App Page Route /",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/use-server/input/app/action.tsx",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/use-server/input/app/action.tsx",
category: "unsupported",
title: "Server actions (\"use server\") are not yet supported in Turbopack",
description: "",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/app/use-server/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/app/use-server/input/app",
),
description: "Next.js App Page Route /",
},

View file

@ -3,7 +3,7 @@ PlainIssue {
context: "[root of the server]/broken",
category: "rendering",
title: "Error during SSR Rendering",
description: "Error: Broken page (expected error)\n\nDebug info:\n- Error: Broken page (expected error)\n at Page (packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/pages/broken.tsx:2:9)\n 1 | export default function Page() {\n | v\n 2 + throw new Error('Broken page (expected error)')\n | ^\n 3 | }\n 4 | \n ",
description: "Error: Broken page (expected error)\n\nDebug info:\n- Error: Broken page (expected error)\n at Page (packages/next-swc/crates/next-dev-tests/tests/temp/next/error/ssr/input/pages/broken.tsx:2:9)\n 1 | export default function Page() {\n | v\n 2 + throw new Error('Broken page (expected error)')\n | ^\n 3 | }\n 4 | \n ",
detail: "",
documentation_link: "",
source: None,
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/error/ssr/input/pages/broken.tsx",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/error/ssr/input/pages/broken.tsx",
),
description: "Next.js pages directory",
},

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js",
category: "resolve",
title: "Error resolving commonjs request",
description: "unable to resolve module \"fail\"",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: module \"fail\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: module \"fail\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js",
},
start: SourcePos {
line: 2,
@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/cjs-in-esm/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/cjs-in-esm/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js",
category: "resolve",
title: "Error resolving commonjs request",
description: "unable to resolve module \"fail\"",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: module \"fail\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: module \"fail\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/cjs-in-esm/input/node_modules/package/cjs/index.js",
},
start: SourcePos {
line: 2,
@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/cjs-in-esm/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/cjs-in-esm/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/server-component-externals/input/node_modules/package/cjs/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/server-component-externals/input/node_modules/package/cjs/index.js",
category: "resolve",
title: "Error resolving commonjs request",
description: "unable to resolve module \"fail\"",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: module \"fail\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/server-component-externals/input/node_modules/package/cjs/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: module \"fail\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/server-component-externals/input/node_modules/package/cjs/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/server-component-externals/input/node_modules/package/cjs/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/server-component-externals/input/node_modules/package/cjs/index.js",
},
start: SourcePos {
line: 2,
@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/server-component-externals/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/server-component-externals/input/app",
),
description: "Next.js App Page Route /",
},

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/server-component-externals/input/node_modules/package/cjs/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/server-component-externals/input/node_modules/package/cjs/index.js",
category: "resolve",
title: "Error resolving commonjs request",
description: "unable to resolve module \"fail\"",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: module \"fail\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/server-component-externals/input/node_modules/package/cjs/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: module \"fail\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/server-component-externals/input/node_modules/package/cjs/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/server-component-externals/input/node_modules/package/cjs/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/server-component-externals/input/node_modules/package/cjs/index.js",
},
start: SourcePos {
line: 2,
@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/externals/server-component-externals/input/app",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/externals/server-component-externals/input/app",
),
description: "Next.js App Page Route /",
},

View file

@ -0,0 +1,43 @@
import { useRef } from 'react'
import { Harness, useTestHarness } from '@turbo/pack-test-harness'
export default function Page() {
const iframeRef = useRef<HTMLIFrameElement | null>(null)
useTestHarness((harness) => runTests(harness, iframeRef.current!))
return (
<iframe style={{ width: 800, height: 600 }} src="/page" ref={iframeRef} />
)
}
function runTests(harness: Harness, iframe: HTMLIFrameElement) {
// These tests requires a longer timeout because we're rendering another page as well.
const TIMEOUT = 20000
it(
'updates the page without reloading',
async () => {
await harness.waitForLoaded(iframe)
await harness.waitForHydration(iframe, '/page')
iframe.contentWindow!.__NEXT_TEST_HMR = true
let element = iframe.contentDocument!.getElementById('element')!
expect(element).not.toBeNull()
expect(getComputedStyle(element).color).toBe('rgb(255, 0, 0)')
console.log(getComputedStyle(element).color)
await harness.changeFile('pages/page.module.css', 'red', 'blue')
await harness.waitForCondition(
() => getComputedStyle(element).color === 'rgb(0, 0, 255)'
)
console.log(getComputedStyle(element).color)
// Make sure the page didn't reload.
expect(iframe.contentWindow!.__NEXT_TEST_HMR).toBe(true)
},
TIMEOUT
)
}

View file

@ -0,0 +1,12 @@
import { useTestHarness } from '@turbo/pack-test-harness'
import styles from './page.module.css'
export default function Page() {
useTestHarness((harness) => harness.markAsHydrated())
return (
<div id="element" className={styles.page}>
Hello Worls
</div>
)
}

View file

@ -0,0 +1,56 @@
import { useRef } from 'react'
import { Harness, useTestHarness } from '@turbo/pack-test-harness'
export default function Page() {
const iframeRef = useRef<HTMLIFrameElement | null>(null)
useTestHarness((harness) => runTests(harness, iframeRef.current!))
return (
<iframe style={{ width: 800, height: 600 }} src="/page" ref={iframeRef} />
)
}
async function waitForMutations(node: Node) {
return new Promise((resolve, reject) => {
const observer = new MutationObserver((mutations) => {
resolve(mutations)
observer.disconnect()
})
observer.observe(node, {
attributes: true,
childList: true,
subtree: true,
characterData: true,
})
})
}
function runTests(harness: Harness, iframe: HTMLIFrameElement) {
// These tests requires a longer timeout because we're rendering another page as well.
const TIMEOUT = 20000
it(
'updates the page without reloading',
async () => {
await harness.waitForLoaded(iframe)
await harness.waitForHydration(iframe, '/page')
iframe.contentWindow!.__NEXT_TEST_HMR = true
let replacement = iframe.contentDocument!.getElementById('replacement')!
expect(replacement).not.toBeNull()
expect(replacement.textContent).toBe('World')
await Promise.all([
harness.changeFile('pages/page.tsx', 'World', 'Next.js'),
waitForMutations(replacement),
])
expect(replacement.textContent).toBe('Next.js')
// Make sure the page didn't reload.
expect(iframe.contentWindow!.__NEXT_TEST_HMR).toBe(true)
},
TIMEOUT
)
}

View file

@ -0,0 +1,11 @@
import { useTestHarness } from '@turbo/pack-test-harness'
export default function Page() {
useTestHarness((harness) => harness.markAsHydrated())
return (
<>
Hello <span id="replacement">World</span>
</>
)
}

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/image/basic/input/public/broken.svg",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/image/basic/input/public/broken.svg",
category: "image",
title: "Processing image failed",
description: "Input image is not valid utf-8\n\nCaused by:\n- invalid utf-8 sequence of 1 bytes from index 0",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/image/basic/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/image/basic/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/image/basic/input/public/broken.jpeg",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/image/basic/input/public/broken.jpeg",
category: "image",
title: "Processing image failed",
description: "unable to decode image data\n\nCaused by:\n- failed to fill whole buffer",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/image/basic/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/image/basic/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/image/basic/input/public/broken.jpeg",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/image/basic/input/public/broken.jpeg",
category: "image",
title: "Processing image failed",
description: "unable to decode image data\n\nCaused by:\n- failed to fill whole buffer",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/image/basic/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/image/basic/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/image/basic/input/public/broken.svg",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/image/basic/input/public/broken.svg",
category: "image",
title: "Processing image failed",
description: "Input image is not valid utf-8\n\nCaused by:\n- invalid utf-8 sequence of 1 bytes from index 0",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/image/basic/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/image/basic/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/image/remotepattern/input/pages/invalid.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/image/remotepattern/input/pages/invalid.js",
),
description: "Next.js pages directory",
},

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/pages/index.jsx",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/pages/index.jsx",
),
description: "Next.js pages directory",
},
@ -38,7 +38,7 @@ PlainIssue {
},
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/styles/globals.css",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/styles/globals.css",
),
description: "PostCSS processing",
},

View file

@ -26,13 +26,13 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/pages/index.jsx",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/pages/index.jsx",
),
description: "Next.js pages directory",
},
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/styles/globals.css",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/styles/globals.css",
),
description: "PostCSS processing",
},

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/pages/index.jsx",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/pages/index.jsx",
),
description: "Next.js pages directory",
},
@ -38,7 +38,7 @@ PlainIssue {
},
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/styles/globals.css",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/styles/globals.css",
),
description: "PostCSS processing",
},

View file

@ -26,13 +26,13 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/pages/index.jsx",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/pages/index.jsx",
),
description: "Next.js pages directory",
},
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/styles/globals.css",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/styles/globals.css",
),
description: "PostCSS processing",
},

View file

@ -26,7 +26,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/pages/index.jsx",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/pages/index.jsx",
),
description: "Next.js pages directory",
},
@ -38,7 +38,7 @@ PlainIssue {
},
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/styles/globals.css",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/styles/globals.css",
),
description: "PostCSS processing",
},

View file

@ -26,13 +26,13 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/pages/index.jsx",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/pages/index.jsx",
),
description: "Next.js pages directory",
},
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/tailwind/basic/input/styles/globals.css",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/tailwind/basic/input/styles/globals.css",
),
description: "PostCSS processing",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Warning,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Warning!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:80:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:58:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:50:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:74)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Error!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:80:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:58:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:50:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:74)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Warning,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Warning!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:80:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:58:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:50:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:74)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Error!",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Error!",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Warning,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Warning!",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Warning,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Warning!",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/hello.emit",
category: "loaders",
title: "Issue while running loader",
description: "Error: Error!\n at readResource (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:80:11)\n at (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:58:5)\n at Module.transform (/turbopack/[turbopack-node]/transforms/webpack-loaders.ts:50:10)\n at (/turbopack/[turbopack-node]/ipc/evaluate.ts/evaluate.js:1:74)\n at Module.run (/turbopack/[turbopack-node]/ipc/evaluate.ts:49:31)",
@ -12,7 +12,7 @@ PlainIssue {
[
PlainIssueProcessingPathItem {
context: Some(
"[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/webpack-loaders/emitted-errors/input/pages/index.js",
"[project]/packages/next-swc/crates/next-dev-tests/tests/temp/next/webpack-loaders/emitted-errors/input/pages/index.js",
),
description: "Next.js pages directory",
},

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/comptime/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/comptime/input/index.js",
category: "resolve",
title: "Error resolving commonjs request",
description: "unable to resolve relative \"./not-existing-file\"",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./not-existing-file\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/comptime/input/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./not-existing-file\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/comptime/input/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/comptime/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/comptime/input/index.js",
},
start: SourcePos {
line: 3,

View file

@ -1,6 +1,6 @@
it('should throw a good error when parsing file fails', async () => {
await expect(import('./broken')).rejects.toMatchObject({
message:
"Could not parse module '[project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/error/input/broken.js'",
"Could not parse module '[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/error/input/broken.js'",
})
})

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/error/input/broken.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/error/input/broken.js",
category: "parse",
title: "Reading source code for parsing failed",
description: "An unexpected error happened while trying to read the source code to parse: failed to convert rope into string\n\nCaused by:\n- invalid utf-8 sequence of 1 bytes from index 1",

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/node-default-import/input/node_modules/esm-package/invalid-exports.cjs",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/node-default-import/input/node_modules/esm-package/invalid-exports.cjs",
category: "module type",
title: "Specified module format (CommonJs) is not matching the module format of the source code (EcmaScript Modules)",
description: "The CommonJs module format was specified in the package.json that is affecting this source file or by using an special extension, but Ecmascript import/export syntax is used in the source code.\nThe module was automatically converted to an EcmaScript module, but that is in conflict with the specified module format. Either change the \"type\" field in the package.json or replace EcmaScript import/export syntax with CommonJs syntas in the source file.\nIn some cases EcmaScript import/export syntax is added by an transform and isn't actually part of the source code. In these cases revisit transformation options to inject the correct syntax.",

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Warning,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/node-default-import/input/node_modules/esm-package/invalid-exports.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/basic/node-default-import/input/node_modules/esm-package/invalid-exports.js",
category: "module type",
title: "Specified module format (EcmaScript Modules) is not matching the module format of the source code (CommonJs)",
description: "The EcmaScript module format was specified in the package.json that is affecting this source file or by using an special extension, but it looks like that CommonJs syntax is used in the source code.\nExports made by CommonJs syntax will lead to a runtime error, since the module is in EcmaScript mode. Either change the \"type\" field in the package.json or replace CommonJs syntax with EcmaScript import/export syntax in the source file.",

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Warning,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/sass/warning/input",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/sass/warning/input",
category: "resolve",
title: "Unsupported Sass request: ./styles.sass",
description: "Turbopack does not yet support importing Sass modules.",

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Warning,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/sass/warning/input",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/turbopack/sass/warning/input",
category: "resolve",
title: "Unsupported Sass request: ./styles.scss",
description: "Turbopack does not yet support importing Sass modules.",

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/context-weak/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
category: "parse",
title: "error TP1007 require.context(\".\", false, /two/, \"weak\") is not statically analyze-able: require.context() only supports 1-3 arguments (mode is not supported)",
description: "",
@ -9,7 +9,7 @@ PlainIssue {
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/context-weak/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
},
start: SourcePos {
line: 1,

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/context-weak/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
category: "parse",
title: "error TP1007 require.context(\".\", false, /.+/, \"weak\") is not statically analyze-able: require.context() only supports 1-3 arguments (mode is not supported)",
description: "",
@ -9,7 +9,7 @@ PlainIssue {
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/context-weak/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
},
start: SourcePos {
line: 19,

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/context-weak/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
category: "parse",
title: "error TP1007 require.context(\".\", true, /.+/, \"weak\") is not statically analyze-able: require.context() only supports 1-3 arguments (mode is not supported)",
description: "",
@ -9,7 +9,7 @@ PlainIssue {
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/context-weak/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/context-weak/input/index.js",
},
start: SourcePos {
line: 25,

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/named-chunks/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/named-chunks/input/index.js",
category: "resolve",
title: "Error resolving EcmaScript Modules request",
description: "unable to resolve relative \"./empty?import2-in-chunk1\"",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./empty?import2-in-chunk1\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/named-chunks/input/index.js\nType of request: EcmaScript Modules request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./empty?import2-in-chunk1\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/named-chunks/input/index.js\nType of request: EcmaScript Modules request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/named-chunks/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/named-chunks/input/index.js",
},
start: SourcePos {
line: 114,

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/named-chunks/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/named-chunks/input/index.js",
category: "resolve",
title: "Error resolving EcmaScript Modules request",
description: "unable to resolve relative \"./empty?import1-in-chunk1\"",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./empty?import1-in-chunk1\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/named-chunks/input/index.js\nType of request: EcmaScript Modules request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./empty?import1-in-chunk1\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/named-chunks/input/index.js\nType of request: EcmaScript Modules request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/named-chunks/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/named-chunks/input/index.js",
},
start: SourcePos {
line: 110,

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/named-chunks/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/named-chunks/input/index.js",
category: "resolve",
title: "Error resolving EcmaScript Modules request",
description: "unable to resolve relative \"./empty?import3-in-chunk2\"",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./empty?import3-in-chunk2\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/named-chunks/input/index.js\nType of request: EcmaScript Modules request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./empty?import3-in-chunk2\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/named-chunks/input/index.js\nType of request: EcmaScript Modules request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/named-chunks/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/named-chunks/input/index.js",
},
start: SourcePos {
line: 124,

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/parsing/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/parsing/input/index.js",
category: "resolve",
title: "Error resolving commonjs request",
description: "unable to resolve relative \"./empty?require.ensure:test\"",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./empty?require.ensure:test\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/parsing/input/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: relative \"./empty?require.ensure:test\"\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/parsing/input/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/parsing/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/parsing/input/index.js",
},
start: SourcePos {
line: 29,

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/weak-dependencies-context/input/index.js",
category: "resolve",
title: "Error resolving commonjs request",
description: "unable to resolve dynamic",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: dynamic\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/input/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: dynamic\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/weak-dependencies-context/input/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/weak-dependencies-context/input/index.js",
},
start: SourcePos {
line: 13,

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Warning,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/weak-dependencies-context/input/index.js",
category: "parse",
title: "lint TP1002 require([\"./b\"]) is very dynamic",
description: "",
@ -9,7 +9,7 @@ PlainIssue {
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies-context/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/weak-dependencies-context/input/index.js",
},
start: SourcePos {
line: 13,

View file

@ -1,15 +1,15 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/weak-dependencies/input/index.js",
category: "resolve",
title: "Error resolving commonjs request",
description: "unable to resolve dynamic",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: dynamic\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/input/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
detail: "It was not possible to find the requested file.\nParsed request as written in source code: dynamic\nPath where resolving has started: [project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/weak-dependencies/input/index.js\nType of request: commonjs request\nImport map: No import map entry\n",
documentation_link: "",
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/weak-dependencies/input/index.js",
},
start: SourcePos {
line: 5,

View file

@ -1,6 +1,6 @@
PlainIssue {
severity: Warning,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/input/index.js",
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/weak-dependencies/input/index.js",
category: "parse",
title: "lint TP1002 require([\"./c\"]) is very dynamic",
description: "",
@ -9,7 +9,7 @@ PlainIssue {
source: Some(
PlainIssueSource {
asset: PlainAsset {
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/webpack/chunks/__skipped__/weak-dependencies/input/index.js",
ident: "[project]/packages/next-swc/crates/next-dev-tests/tests/temp/webpack/chunks/__skipped__/weak-dependencies/input/index.js",
},
start: SourcePos {
line: 5,