From e848a79801543a9dd5b5df1f12779b841f60c056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 25 Apr 2022 17:25:14 -0400 Subject: [PATCH] chore: check jest version in babel-core test --- packages/babel-core/test/resolution.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/babel-core/test/resolution.js b/packages/babel-core/test/resolution.js index 09b5d1770b50..98f812673adb 100644 --- a/packages/babel-core/test/resolution.js +++ b/packages/babel-core/test/resolution.js @@ -354,7 +354,7 @@ describe("addon resolution", function () { // because Jest 24 has an issue on setting the MODULE_NOT_FOUND error when the native // `require.resolve` is provided. // see https://github.com/babel/babel/pull/12439/files#r535996000 - process.versions.node.startsWith("8.") + jest.getVersion().startsWith("24.") ? /Cannot (?:find|resolve) module 'babel-preset-foo'/ : /Cannot (?:find|resolve) module 'babel-preset-foo'.*\n- If you want to resolve "foo", use "module:foo"/s, ); @@ -370,7 +370,7 @@ describe("addon resolution", function () { plugins: ["foo"], }); }).toThrow( - process.versions.node.startsWith("8.") + jest.getVersion().startsWith("24.") ? /Cannot (?:find|resolve) module 'babel-plugin-foo'/ : /Cannot (?:find|resolve) module 'babel-plugin-foo'.*\n- If you want to resolve "foo", use "module:foo"/s, ); @@ -386,7 +386,7 @@ describe("addon resolution", function () { presets: ["foo"], }); }).toThrow( - process.versions.node.startsWith("8.") + jest.getVersion().startsWith("24.") ? /Cannot (?:find|resolve) module 'babel-preset-foo'/ : /Cannot (?:find|resolve) module 'babel-preset-foo'.*\n- Did you mean "@babel\/foo"\?/s, ); @@ -402,7 +402,7 @@ describe("addon resolution", function () { plugins: ["foo"], }); }).toThrow( - process.versions.node.startsWith("8.") + jest.getVersion().startsWith("24.") ? /Cannot (?:find|resolve) module 'babel-plugin-foo'/ : /Cannot (?:find|resolve) module 'babel-plugin-foo'.*\n- Did you mean "@babel\/foo"\?/s, ); @@ -418,7 +418,7 @@ describe("addon resolution", function () { presets: ["testplugin"], }); }).toThrow( - process.versions.node.startsWith("8.") + jest.getVersion().startsWith("24.") ? /Cannot (?:find|resolve) module 'babel-preset-testplugin'/ : /Cannot (?:find|resolve) module 'babel-preset-testplugin'.*\n- Did you accidentally pass a plugin as a preset\?/s, ); @@ -434,7 +434,7 @@ describe("addon resolution", function () { plugins: ["testpreset"], }); }).toThrow( - process.versions.node.startsWith("8.") + jest.getVersion().startsWith("24.") ? /Cannot (?:find|resolve) module 'babel-plugin-testpreset'/ : /Cannot (?:find|resolve) module 'babel-plugin-testpreset'.*\n- Did you accidentally pass a preset as a plugin\?/s, );