From 32df74dba67207300511cf9b7c5ef82dd708c0c1 Mon Sep 17 00:00:00 2001 From: Ricky Date: Mon, 12 Feb 2024 22:03:50 -0500 Subject: [PATCH] Fix jest inline snapshots (#28308) Prettier 3 is not supported for jest inline snapshots: https://jestjs.io/docs/configuration#prettierpath-string --- package.json | 1 + scripts/jest/config.base.js | 1 + yarn.lock | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/package.json b/package.json index a27be0d0e9e3b..cbf3f714efcf7 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "mkdirp": "^0.5.1", "ncp": "^2.0.0", "prettier": "3.0.3", + "prettier-2": "npm:prettier@^2", "pretty-format": "^29.4.1", "prop-types": "^15.6.2", "random-seed": "^0.3.0", diff --git a/scripts/jest/config.base.js b/scripts/jest/config.base.js index 911a6b6e3d74a..26c68bfc26b42 100644 --- a/scripts/jest/config.base.js +++ b/scripts/jest/config.base.js @@ -10,6 +10,7 @@ module.exports = { transform: { '.*': require.resolve('./preprocessor.js'), }, + prettierPath: require.resolve('prettier-2'), setupFiles: [require.resolve('./setupEnvironment.js')], setupFilesAfterEnv: [require.resolve('./setupTests.js')], // Only include files directly in __tests__, not in nested folders. diff --git a/yarn.lock b/yarn.lock index ebbd05c9b42c6..49f44b3119ff4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12591,6 +12591,11 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= +"prettier-2@npm:prettier@^2": + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== + prettier@*, prettier@3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"