From 9d0a01a051ab5f04c13b09d5671db1645bca5d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20No=C3=ABl?= Date: Mon, 11 Jul 2022 14:40:58 +0200 Subject: [PATCH] fix add-missing-keys-to-other-language.test.js --- jest.base-config.front.js | 4 +++- jest.config.front.js | 5 ++++- .../add-missing-keys-to-other-language.test.js | 4 ++-- scripts/front/{__tests__ => tests}/en.json | 0 scripts/front/{__tests__ => tests}/vi.json | 0 scripts/jest.config.front.js | 8 ++++++++ 6 files changed, 17 insertions(+), 4 deletions(-) rename scripts/front/{__tests__ => tests}/add-missing-keys-to-other-language.test.js (88%) rename scripts/front/{__tests__ => tests}/en.json (100%) rename scripts/front/{__tests__ => tests}/vi.json (100%) create mode 100644 scripts/jest.config.front.js diff --git a/jest.base-config.front.js b/jest.base-config.front.js index 68c162af72..7908e1ac7f 100644 --- a/jest.base-config.front.js +++ b/jest.base-config.front.js @@ -59,7 +59,9 @@ module.exports = { }, transformIgnorePatterns: ['node_modules/(?!(react-dnd|dnd-core|react-dnd-html5-backend)/)'], testMatch: ['/**/tests/**/?(*.)+(spec|test).[jt]s?(x)'], - testURL: 'http://localhost:1337/admin', + testEnvironmentOptions: { + url: 'http://localhost:1337/admin', + }, // Use `jest-watch-typeahead` version 0.6.5. Newest version 1.0.0 does not support jest@26 // Reference: https://github.com/jest-community/jest-watch-typeahead/releases/tag/v1.0.0 watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'], diff --git a/jest.config.front.js b/jest.config.front.js index 3d24e0e790..8fe8faf1d6 100644 --- a/jest.config.front.js +++ b/jest.config.front.js @@ -2,5 +2,8 @@ const baseConfig = require('./jest.base-config.front'); module.exports = { ...baseConfig, - projects: ['/packages/**/jest.config.front.js'], + projects: [ + '/packages/**/jest.config.front.js', + '/scripts/**/jest.config.front.js', + ], }; diff --git a/scripts/front/__tests__/add-missing-keys-to-other-language.test.js b/scripts/front/tests/add-missing-keys-to-other-language.test.js similarity index 88% rename from scripts/front/__tests__/add-missing-keys-to-other-language.test.js rename to scripts/front/tests/add-missing-keys-to-other-language.test.js index 3c71391b4c..cb538546b7 100644 --- a/scripts/front/__tests__/add-missing-keys-to-other-language.test.js +++ b/scripts/front/tests/add-missing-keys-to-other-language.test.js @@ -5,8 +5,8 @@ const { updateMissingKeysToJSON } = require('../add-missing-keys-to-other-langua describe('updateMissingKeysToJSON', () => { it('should add missing keys from en.json to translation file', async () => { - const TARGET_TRANSLATION_FILE_PATH = 'scripts/front/__tests__/vi.json'; - const SOURCE_TRANSLATION_FILE_PATH = 'scripts/front/__tests__/en.json'; + const TARGET_TRANSLATION_FILE_PATH = 'scripts/front/tests/vi.json'; + const SOURCE_TRANSLATION_FILE_PATH = 'scripts/front/tests/en.json'; // Save original `vi.json` file content const originalTargetTranslationFileContent = fs.readFileSync( TARGET_TRANSLATION_FILE_PATH, diff --git a/scripts/front/__tests__/en.json b/scripts/front/tests/en.json similarity index 100% rename from scripts/front/__tests__/en.json rename to scripts/front/tests/en.json diff --git a/scripts/front/__tests__/vi.json b/scripts/front/tests/vi.json similarity index 100% rename from scripts/front/__tests__/vi.json rename to scripts/front/tests/vi.json diff --git a/scripts/jest.config.front.js b/scripts/jest.config.front.js new file mode 100644 index 0000000000..b2a632e87f --- /dev/null +++ b/scripts/jest.config.front.js @@ -0,0 +1,8 @@ +'use strict'; + +const baseConfig = require('../jest.base-config.front'); + +module.exports = { + ...baseConfig, + roots: [__dirname], +};