Skip to content

Commit

Permalink
Add next-custom-transforms tests to verify source maps (#75005)
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable authored Jan 17, 2025
1 parent 5e175e3 commit 6090343
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
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.

0 comments on commit 6090343

Please sign in to comment.