diff options
Diffstat (limited to 'jest.config.base.js')
-rw-r--r-- | jest.config.base.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/jest.config.base.js b/jest.config.base.js index 0897bc66b30..3cbf2fdd61b 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -40,6 +40,11 @@ module.exports = (path, options = {}) => { Object.assign(vueModuleNameMappers, { '^vue$': '@vue/compat', '^@vue/test-utils$': '@vue/test-utils-vue3', + + // Library wrappers + '^vuex$': '<rootDir>/app/assets/javascripts/lib/utils/vue3compat/vuex.js', + '^vue-apollo$': '<rootDir>/app/assets/javascripts/lib/utils/vue3compat/vue_apollo.js', + '^vue-router$': '<rootDir>/app/assets/javascripts/lib/utils/vue3compat/vue_router.js', }); Object.assign(globals, { 'vue-jest': { @@ -84,6 +89,10 @@ module.exports = (path, options = {}) => { } const TEST_FIXTURES_PATTERN = 'test_fixtures(/.*)$'; + const TEST_FIXTURES_HOME = '/tmp/tests/frontend/fixtures'; + const TEST_FIXTURES_HOME_EE = '/tmp/tests/frontend/fixtures-ee'; + const TEST_FIXTURES_STATIC_HOME = '/spec/frontend/fixtures/static'; + const TEST_FIXTURES_RAW_LOADER_PATTERN = `(${TEST_FIXTURES_HOME}|${TEST_FIXTURES_STATIC_HOME}).*\\.html$`; const moduleNameMapper = { '^~(/.*)\\?(worker|raw)$': '<rootDir>/app/assets/javascripts$1', @@ -99,8 +108,8 @@ module.exports = (path, options = {}) => { '^any_else_ce(/.*)$': '<rootDir>/app/assets/javascripts$1', '^helpers(/.*)$': '<rootDir>/spec/frontend/__helpers__$1', '^vendor(/.*)$': '<rootDir>/vendor/assets/javascripts$1', - [TEST_FIXTURES_PATTERN]: '<rootDir>/tmp/tests/frontend/fixtures$1', - '^test_fixtures_static(/.*)$': '<rootDir>/spec/frontend/fixtures/static$1', + [TEST_FIXTURES_PATTERN]: `<rootDir>${TEST_FIXTURES_HOME}$1`, + '^test_fixtures_static(/.*)$': `<rootDir>${TEST_FIXTURES_STATIC_HOME}$1`, '\\.(jpg|jpeg|png|svg|css)$': '<rootDir>/spec/frontend/__mocks__/file_mock.js', '\\.svg\\?url$': '<rootDir>/spec/frontend/__mocks__/file_mock.js', '^public(/.*)$': '<rootDir>/public$1', @@ -110,6 +119,7 @@ module.exports = (path, options = {}) => { '^ee_else_ce_jest/(.*)$': '<rootDir>/spec/frontend/$1', '^jquery$': '<rootDir>/node_modules/jquery/dist/jquery.slim.js', '^@sentry/browser$': '<rootDir>/app/assets/javascripts/sentry/sentry_browser_wrapper.js', + '^dexie$': '<rootDir>/node_modules/dexie/dist/dexie.min.js', ...extModuleNameMapper, ...vueModuleNameMappers, }; @@ -127,7 +137,7 @@ module.exports = (path, options = {}) => { '^ee_else_ce_jest/(.*)$': specDirEE, '^any_else_ce(/.*)$': rootDirEE, '^jh_else_ee(/.*)$': rootDirEE, - [TEST_FIXTURES_PATTERN]: '<rootDir>/tmp/tests/frontend/fixtures-ee$1', + [TEST_FIXTURES_PATTERN]: `<rootDir>${TEST_FIXTURES_HOME_EE}$1`, ...extModuleNameMapperEE, }); @@ -189,6 +199,7 @@ module.exports = (path, options = {}) => { 'vue-test-utils-compat', '@gitlab/ui', '@gitlab/favicon-overlay', + '@gitlab/cluster-client', 'bootstrap-vue', 'three', 'monaco-editor', @@ -203,6 +214,7 @@ module.exports = (path, options = {}) => { 'lowlight', 'vscode-languageserver-types', 'yaml', + 'dexie', ...gfmParserDependencies, ]; @@ -210,7 +222,7 @@ module.exports = (path, options = {}) => { globals, clearMocks: true, testMatch, - moduleFileExtensions: ['js', 'json', 'vue', 'gql', 'graphql', 'yaml', 'yml'], + moduleFileExtensions: ['js', 'json', 'vue', 'gql', 'graphql', 'yaml', 'yml', 'html'], moduleNameMapper, collectCoverageFrom, coverageDirectory: coverageDirectory(), @@ -232,6 +244,7 @@ module.exports = (path, options = {}) => { 'spec/frontend/editor/schema/ci/yaml_tests/.+\\.(yml|yaml)$': './spec/frontend/__helpers__/yaml_transformer.js', '^.+\\.(md|zip|png|yml|yaml|sh|ps1)$': './spec/frontend/__helpers__/raw_transformer.js', + [TEST_FIXTURES_RAW_LOADER_PATTERN]: './spec/frontend/__helpers__/raw_transformer.js', }, transformIgnorePatterns: [`node_modules/(?!(${transformIgnoreNodeModules.join('|')}))`], fakeTimers: { |