Unverified Commit d8234277 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

test: restore missing NFT `exports*` unit fixtures (#97459)

### What?

Restores the missing `node_modules` fixtures for the `exports`,
`exports-fallback`,
`exports-only` and `exports-path` cases in `turbopack-tracing`'s NFT
unit test suite
(`tests/unit.rs`), and enables the two that pass as-is (`exports-only`,
`exports-path`).
Co-authored-by: 's avatarvercel-fleet[bot] <308483924+vercel-fleet[bot]@users.noreply.github.com>
parent 10439f3c
{
"name": "pkg",
"exports": {
".": ["in:valid", {
"node": {
"import": "./subdir/import-main.js",
"require": "./require-main.cjs"
}
}, "./index.js"]
}
}
{
"name": "pkg",
"main": "index.js",
"exports": {
".": {
"node": {
"import": "./subdir/import-main.js",
"require": "./require-main.cjs"
}
},
"./asdf": {
"node": {
"import": "./subdir/import-main.js"
}
}
}
}
{
"name": "apollo-upload-client",
"exports": {
".": {
"import": "./public/index.mjs",
"require": "./public/index.js"
},
"./public/": "./public/",
"./package": "./package.json",
"./package.json": "./package.json"
}
}
{
"name": "extract-files",
"exports": {
".": {
"import": "./public/index.mjs",
"require": "./public/index.js"
},
"./public/": "./public/",
"./package": "./package.json",
"./package.json": "./package.json"
}
}
\ No newline at end of file
{
"name": "pkg",
"main": "index.js",
"exports": {
".": {
"node": {
"import": "./subdir/import-main.js",
"require": "./require-main.cjs"
}
},
"./asdf": {
"node": {
"import": "./subdir/import-main.js"
}
}
}
}
...@@ -102,11 +102,22 @@ static ALLOC: turbo_tasks_malloc::TurboMalloc = turbo_tasks_malloc::TurboMalloc; ...@@ -102,11 +102,22 @@ static ALLOC: turbo_tasks_malloc::TurboMalloc = turbo_tasks_malloc::TurboMalloc;
#[case::esm_export_wildcard("esm-export-wildcard")] #[case::esm_export_wildcard("esm-export-wildcard")]
#[case::esm_paths("esm-paths")] #[case::esm_paths("esm-paths")]
#[case::esm_paths_trailer("esm-paths-trailer")] #[case::esm_paths_trailer("esm-paths-trailer")]
// nft traces a package's legacy `main` in addition to the target its `exports` field
// resolves to (unless nft's `exportsOnly` option is set), so its reference output lists
// `index.js` next to `require-main.cjs`, while Turbopack only traces the file it actually
// resolves to.
// #[case::exports("exports")] // #[case::exports("exports")]
// Two reasons: as for `exports` above, nft also traces the legacy resolution (here the
// directory index `index.js`). On top of that, Turbopack resolves this fixture's `exports`
// fallback array to nothing at all, because it stops at the invalid first target
// (`"in:valid"`) instead of continuing with the next entry, so `require-main.cjs` is missed.
// #[case::exports_fallback("exports-fallback")] // #[case::exports_fallback("exports-fallback")]
#[case::exports_nomodule("exports-nomodule")] #[case::exports_nomodule("exports-nomodule")]
// #[case::exports_only("exports-only")] // `exports-only` is the same fixture as `exports`, but nft traces it with `exportsOnly:
// #[case::exports_path("exports-path")] // true`, which matches Node's (and Turbopack's) semantics of ignoring `main` when an
// `exports` field is present.
#[case::exports_only("exports-only")]
#[case::exports_path("exports-path")]
#[case::exports_wildcard("exports-wildcard")] #[case::exports_wildcard("exports-wildcard")]
// #[case::ffmpeg_installer("ffmpeg-installer")] // #[case::ffmpeg_installer("ffmpeg-installer")]
#[case::file_folder_slash("file-folder-slash")] #[case::file_folder_slash("file-folder-slash")]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment