polish(theme-classic): guard against potential definition mistakes in Tabs (#5674)

This commit is contained in:
Joshua Chen 2021-10-14 21:47:03 +08:00 committed by GitHub
parent 8d92e9bcf5
commit c8739ec28e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 224 additions and 23 deletions

View file

@ -33,11 +33,14 @@ module.exports = {
},
setupFiles: ['./jest/stylelint-rule-test.js', './jest/polyfills.js'],
moduleNameMapper: {
// Jest can't resolve CSS imports
'^.+\\.css$': '<rootDir>/jest/emptyModule.js',
// TODO we need to allow Jest to resolve core Webpack aliases automatically
'@docusaurus/router': 'react-router-dom',
'@docusaurus/Translate': '@docusaurus/core/lib/client/exports/Translate',
'@docusaurus/Interpolate':
'@docusaurus/core/lib/client/exports/Interpolate',
'@generated/codeTranslations': '<rootDir>/jest/emptyModule.js',
'@docusaurus/(browserContext|BrowserOnly|ComponentCreator|constants|docusaurusContext|ExecutionEnvironment|Head|Interpolate|isInternalUrl|Link|Noop|renderRoutes|router|Translate|use.*)':
'@docusaurus/core/lib/client/exports/$1',
// Maybe point to a fixture?
'@generated/.*': '<rootDir>/jest/emptyModule.js',
// TODO maybe use "projects" + multiple configs if we plan to add tests to another theme?
'@theme/(.*)': '@docusaurus/theme-classic/lib-next/theme/$1',
},
};