Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add next-custom-transforms tests to verify source maps #75005

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions crates/next-custom-transforms/tests/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,36 @@ fn test_edge_assert(input: PathBuf) {
);
}

#[fixture("tests/fixture/source-maps/**/input.js")]
fn test_source_maps(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture(
syntax(),
&|_tr| {
(
resolver(Mark::new(), Mark::new(), false),
server_actions(
&FileName::Real("/app/item.js".into()),
server_actions::Config {
is_react_server_layer: true,
dynamic_io_enabled: true,
hash_salt: "".into(),
cache_kinds: FxHashSet::from_iter([]),
},
_tr.comments.as_ref().clone(),
),
)
},
&input,
&output,
FixtureTestConfig {
module: Some(true),
sourcemap: true,
..Default::default()
},
);
}

fn lint_to_fold<R>(r: R) -> impl Pass
where
R: Visit,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use cache'

const foo = async () => {
'use cache'
}

export async function bar() {
return foo()
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading