Skip to content

Commit 6090343

Browse files
authored
Add next-custom-transforms tests to verify source maps (#75005)
1 parent 5e175e3 commit 6090343

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

crates/next-custom-transforms/tests/fixture.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,36 @@ fn test_edge_assert(input: PathBuf) {
916916
);
917917
}
918918

919+
#[fixture("tests/fixture/source-maps/**/input.js")]
920+
fn test_source_maps(input: PathBuf) {
921+
let output = input.parent().unwrap().join("output.js");
922+
test_fixture(
923+
syntax(),
924+
&|_tr| {
925+
(
926+
resolver(Mark::new(), Mark::new(), false),
927+
server_actions(
928+
&FileName::Real("/app/item.js".into()),
929+
server_actions::Config {
930+
is_react_server_layer: true,
931+
dynamic_io_enabled: true,
932+
hash_salt: "".into(),
933+
cache_kinds: FxHashSet::from_iter([]),
934+
},
935+
_tr.comments.as_ref().clone(),
936+
),
937+
)
938+
},
939+
&input,
940+
&output,
941+
FixtureTestConfig {
942+
module: Some(true),
943+
sourcemap: true,
944+
..Default::default()
945+
},
946+
);
947+
}
948+
919949
fn lint_to_fold<R>(r: R) -> impl Pass
920950
where
921951
R: Visit,
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use cache'
2+
3+
const foo = async () => {
4+
'use cache'
5+
}
6+
7+
export async function bar() {
8+
return foo()
9+
}

crates/next-custom-transforms/tests/fixture/source-maps/use-cache/1/output.js

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/next-custom-transforms/tests/fixture/source-maps/use-cache/1/output.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)