2023-06-14 11:49:40 +03:00
|
|
|
/**
|
2022-05-25 13:39:08 +03:00
|
|
|
* @copyright Copyright (c) 2020 Marco Ambrosini <marcoambrosini@pm.me>
|
|
|
|
*
|
|
|
|
* @author Marco Ambrosini <marcoambrosini@pm.me>
|
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
2023-06-14 11:49:40 +03:00
|
|
|
import type { Config } from 'jest'
|
2022-05-25 13:39:08 +03:00
|
|
|
|
|
|
|
// TODO: find a way to consolidate this in one place, with webpack.common.js
|
|
|
|
const ignorePatterns = [
|
2023-07-06 20:48:32 +03:00
|
|
|
'@buttercup/fetch',
|
2022-05-25 13:39:08 +03:00
|
|
|
'@juliushaertl',
|
2023-06-14 11:49:40 +03:00
|
|
|
'@mdi/svg',
|
2022-05-25 13:39:08 +03:00
|
|
|
'@nextcloud/vue',
|
2023-06-14 11:49:40 +03:00
|
|
|
'ansi-regex',
|
|
|
|
'char-regex',
|
2023-08-16 13:30:01 +03:00
|
|
|
'hot-patcher',
|
2023-06-30 10:57:40 +03:00
|
|
|
'is-svg',
|
2022-05-25 13:39:08 +03:00
|
|
|
'splitpanes',
|
|
|
|
'string-length',
|
|
|
|
'strip-ansi',
|
2023-06-14 11:49:40 +03:00
|
|
|
'tributejs',
|
|
|
|
'vue-material-design-icons',
|
2023-07-06 20:48:32 +03:00
|
|
|
'webdav',
|
2022-05-25 13:39:08 +03:00
|
|
|
]
|
|
|
|
|
2023-06-14 11:49:40 +03:00
|
|
|
const config: Config = {
|
|
|
|
testMatch: ['<rootDir>/**/*.(spec|test).(ts|js)'],
|
2022-09-26 16:24:15 +03:00
|
|
|
|
2023-06-20 13:12:56 +03:00
|
|
|
clearMocks: true,
|
2023-06-14 11:49:40 +03:00
|
|
|
setupFilesAfterEnv: ['<rootDir>/__tests__/jest-setup.ts'],
|
|
|
|
|
2022-09-26 16:24:15 +03:00
|
|
|
testEnvironment: 'jest-environment-jsdom',
|
2023-06-14 11:49:40 +03:00
|
|
|
preset: 'ts-jest/presets/js-with-ts',
|
2022-09-26 16:24:15 +03:00
|
|
|
|
2023-06-20 13:12:56 +03:00
|
|
|
roots: [
|
|
|
|
'<rootDir>/__mocks__',
|
|
|
|
'<rootDir>/__tests__',
|
|
|
|
'<rootDir>/apps',
|
|
|
|
'<rootDir>/core',
|
|
|
|
],
|
2022-09-26 16:24:15 +03:00
|
|
|
|
2022-05-25 13:39:08 +03:00
|
|
|
transform: {
|
|
|
|
// process `*.js` files with `babel-jest`
|
2023-06-14 11:49:40 +03:00
|
|
|
'^.+\\.js$': 'babel-jest',
|
2022-09-26 16:24:15 +03:00
|
|
|
'^.+\\.vue$': '@vue/vue2-jest',
|
2023-06-27 12:44:59 +03:00
|
|
|
'^.+\\.ts$': ['ts-jest', {
|
|
|
|
// @see https://github.com/kulshekhar/ts-jest/issues/4081
|
|
|
|
tsconfig: './__tests__/tsconfig.json',
|
|
|
|
}],
|
2022-05-25 13:39:08 +03:00
|
|
|
},
|
2023-06-20 13:12:56 +03:00
|
|
|
transformIgnorePatterns: [
|
|
|
|
'node_modules/(?!(' + ignorePatterns.join('|') + ')/)',
|
|
|
|
],
|
|
|
|
|
|
|
|
// Allow mocking svg files
|
|
|
|
moduleNameMapper: {
|
|
|
|
'^.+\\.svg(\\?raw)?$': '<rootDir>/__mocks__/svg.js',
|
2023-09-06 18:02:28 +03:00
|
|
|
'\\.s?css$': '<rootDir>/__mocks__/css.js',
|
2023-06-20 13:12:56 +03:00
|
|
|
},
|
|
|
|
modulePathIgnorePatterns: [
|
|
|
|
'<rootDir>/apps2/',
|
|
|
|
'<rootDir>/apps-extra/',
|
|
|
|
],
|
2022-05-25 13:39:08 +03:00
|
|
|
}
|
2023-06-14 11:49:40 +03:00
|
|
|
|
|
|
|
export default config
|