From 1a5e983a77a43d3198eb5bdc07c2b4b3f7285cd3 Mon Sep 17 00:00:00 2001 From: Kristoffer K Date: Thu, 1 Jun 2023 22:07:40 +0200 Subject: [PATCH] test: fix range for parent URL test (#5463) **What's the problem this PR addresses?** The test added in https://github.com/yarnpkg/berry/pull/5362 doesn't run on Node.js v17. Fixes https://github.com/yarnpkg/berry/actions/runs/5060283241/jobs/9083017466 **How did you fix it?** Updated the range to match Node.js versions containing https://github.com/nodejs/node/pull/42881 **Checklist** - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). - [x] I have set the packages that need to be released for my changes to be effective. - [x] I will check that all automated PR checks pass before the PR gets reviewed. --- .yarn/versions/c594112e.yml | 2 ++ .../acceptance-tests/pkg-tests-specs/sources/pnp-esm.test.ts | 2 +- packages/yarnpkg-pnp/sources/esm-loader/loaderFlags.ts | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .yarn/versions/c594112e.yml diff --git a/.yarn/versions/c594112e.yml b/.yarn/versions/c594112e.yml new file mode 100644 index 000000000000..9f2a58084c4d --- /dev/null +++ b/.yarn/versions/c594112e.yml @@ -0,0 +1,2 @@ +declined: + - "@yarnpkg/pnp" diff --git a/packages/acceptance-tests/pkg-tests-specs/sources/pnp-esm.test.ts b/packages/acceptance-tests/pkg-tests-specs/sources/pnp-esm.test.ts index 2a57b20ba891..494467fd7bad 100644 --- a/packages/acceptance-tests/pkg-tests-specs/sources/pnp-esm.test.ts +++ b/packages/acceptance-tests/pkg-tests-specs/sources/pnp-esm.test.ts @@ -972,7 +972,7 @@ describe(`Plug'n'Play - ESM`, () => { ), ); - (loaderFlags.HAS_CONSOLIDATED_HOOKS ? test : test.skip)( + (loaderFlags.ALLOWS_NON_FILE_PARENT ? test : test.skip)( `it should allow importing files regardless of parent URL`, makeTemporaryEnv( { diff --git a/packages/yarnpkg-pnp/sources/esm-loader/loaderFlags.ts b/packages/yarnpkg-pnp/sources/esm-loader/loaderFlags.ts index 19cabe4f422f..c575f4139d3e 100644 --- a/packages/yarnpkg-pnp/sources/esm-loader/loaderFlags.ts +++ b/packages/yarnpkg-pnp/sources/esm-loader/loaderFlags.ts @@ -15,3 +15,6 @@ export const WATCH_MODE_MESSAGE_USES_ARRAYS = major > 19 || (major === 19 && min // https://github.com/nodejs/node/pull/45659 changed the internal translators to be lazy loaded // TODO: Update the version range if https://github.com/nodejs/node/pull/46425 lands. export const HAS_LAZY_LOADED_TRANSLATORS = major > 19 || (major === 19 && minor >= 3); + +// https://github.com/nodejs/node/pull/42881 +export const ALLOWS_NON_FILE_PARENT = major > 18 || (major === 18 && minor >= 1) || (major === 16 && minor >= 17);