mirror of https://github.com/apache/superset.git
fix: suppress translation warning in jest (#20404)
This commit is contained in:
parent
8bbbd6f03f
commit
9fad26fa19
|
@ -16970,9 +16970,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "17.0.21",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz",
|
||||
"integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ=="
|
||||
"version": "18.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.0.tgz",
|
||||
"integrity": "sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA=="
|
||||
},
|
||||
"node_modules/@types/node-fetch": {
|
||||
"version": "2.6.1",
|
||||
|
@ -54322,6 +54322,7 @@
|
|||
"@types/fetch-mock": "^7.3.3",
|
||||
"@types/lodash": "^4.14.149",
|
||||
"@types/math-expression-evaluator": "^1.2.1",
|
||||
"@types/node": "^18.0.0",
|
||||
"@types/prop-types": "^15.7.2",
|
||||
"@types/rison": "0.0.6",
|
||||
"@types/seedrandom": "^2.4.28",
|
||||
|
@ -67442,6 +67443,7 @@
|
|||
"@types/fetch-mock": "^7.3.3",
|
||||
"@types/lodash": "^4.14.149",
|
||||
"@types/math-expression-evaluator": "^1.2.1",
|
||||
"@types/node": "^18.0.0",
|
||||
"@types/prop-types": "^15.7.2",
|
||||
"@types/rison": "0.0.6",
|
||||
"@types/seedrandom": "^2.4.28",
|
||||
|
@ -69036,9 +69038,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "17.0.21",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz",
|
||||
"integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ=="
|
||||
"version": "18.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.0.tgz",
|
||||
"integrity": "sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA=="
|
||||
},
|
||||
"@types/node-fetch": {
|
||||
"version": "2.6.1",
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
"@types/d3-time-format": "^2.1.0",
|
||||
"@types/lodash": "^4.14.149",
|
||||
"@types/math-expression-evaluator": "^1.2.1",
|
||||
"@types/node": "^18.0.0",
|
||||
"@types/rison": "0.0.6",
|
||||
"@types/seedrandom": "^2.4.28",
|
||||
"@types/fetch-mock": "^7.3.3",
|
||||
|
|
|
@ -56,7 +56,7 @@ export default class Translator {
|
|||
*/
|
||||
addTranslation(key: string, texts: ReadonlyArray<string>) {
|
||||
const translations = this.i18n.options.locale_data.superset;
|
||||
if (key in translations) {
|
||||
if (process.env.WEBPACK_MODE !== 'test' && key in translations) {
|
||||
logging.warn(`Duplicate translation key "${key}", will override.`);
|
||||
}
|
||||
translations[key] = texts;
|
||||
|
|
|
@ -41,10 +41,12 @@ describe('Translator', () => {
|
|||
spy.mockImplementation((info: any) => {
|
||||
throw new Error(info);
|
||||
});
|
||||
process.env.WEBPACK_MODE = 'production';
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
spy.mockRestore();
|
||||
process.env.WEBPACK_MODE = 'test';
|
||||
});
|
||||
|
||||
describe('new Translator(config)', () => {
|
||||
|
|
|
@ -81,3 +81,5 @@ setupSupersetClient();
|
|||
jest.mock('src/hooks/useTabId', () => ({
|
||||
useTabId: () => 1,
|
||||
}));
|
||||
|
||||
process.env.WEBPACK_MODE = 'test';
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
"types": [
|
||||
"@emotion/react/types/css-prop",
|
||||
"jest",
|
||||
"@testing-library/jest-dom"
|
||||
"@testing-library/jest-dom",
|
||||
"@types/node"
|
||||
],
|
||||
|
||||
/* Emit */
|
||||
|
|
Loading…
Reference in New Issue