From 23b4822e662b2325693ef78e3bb234a4be04ad72 Mon Sep 17 00:00:00 2001 From: Georgii Dolzhykov Date: Mon, 1 Mar 2021 13:55:20 +0200 Subject: [PATCH] Disable Jest's default transformer (Babel) (#10454) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Disable Jest's default transform (Babel) https://jestjs.io/docs/en/next/code-transformation#defaults Otherwise, I sometimes get this error because Babel tries to resolve Browserslist: ---- ● plugin search should not crash when prettier isn't inside a directory › encountered a declaration exception ENOENT: no such file or directory, stat '/mnt/d/dev/prettier/tests_integration/mnt/d/dev/prettier/tests_integration/runPrettier.js' 52 | jest.spyOn(fs, "statSync").mockImplementation((filename) => { 53 | if (path.basename(filename) === "virtualDirectory") { > 54 | return origStatSync(path.join(__dirname, __filename)); | ^ 55 | } 56 | return origStatSync(filename); 57 | }); at Object. (tests_integration/runPrettier.js:54:14) at isFile (node_modules/browserslist/node.js:38:42) at eachParent (node_modules/browserslist/node.js:46:13) at Object.getStat (node_modules/browserslist/node.js:197:15) at browserslist (node_modules/browserslist/index.js:433:19) at resolveTargets (node_modules/@babel/helper-compilation-targets/lib/index.js:174:46) ---- --- jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index bfe8eb1fb..8dfc1a2bc 100644 --- a/jest.config.js +++ b/jest.config.js @@ -18,7 +18,7 @@ if (INSTALL_PACKAGE || (isProduction && !TEST_STANDALONE)) { process.env.PRETTIER_DIR = PRETTIER_DIR; const testPathIgnorePatterns = []; -let transform; +let transform = {}; if (TEST_STANDALONE) { testPathIgnorePatterns.push("/tests_integration/"); }