2023-03-22 11:21:33 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
const moduleNameMapper = {
|
2023-04-19 15:10:50 +01:00
|
|
|
'.*\\.(css|less|styl|scss|sass)$': '@strapi/admin-test-utils/file-mock',
|
2023-03-22 11:21:33 +01:00
|
|
|
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
|
2023-04-19 15:10:50 +01:00
|
|
|
'@strapi/admin-test-utils/file-mock',
|
2023-03-22 11:21:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
rootDir: __dirname,
|
|
|
|
moduleNameMapper,
|
2023-05-23 21:17:13 +02:00
|
|
|
/* Tells jest to ignore duplicated manual mock files, such as index.js */
|
|
|
|
modulePathIgnorePatterns: ['.*__mocks__.*'],
|
2023-04-26 13:09:24 +02:00
|
|
|
testPathIgnorePatterns: ['node_modules/', '__tests__'],
|
2023-04-19 15:10:50 +01:00
|
|
|
globalSetup: '@strapi/admin-test-utils/global-setup',
|
|
|
|
setupFiles: ['@strapi/admin-test-utils/environment'],
|
|
|
|
setupFilesAfterEnv: ['@strapi/admin-test-utils/after-env'],
|
2023-03-22 11:21:33 +01:00
|
|
|
testEnvironment: 'jsdom',
|
|
|
|
transform: {
|
|
|
|
'^.+\\.js$': [
|
|
|
|
'@swc/jest',
|
|
|
|
{
|
|
|
|
env: {
|
|
|
|
coreJs: '3.28.0',
|
|
|
|
mode: 'usage',
|
|
|
|
},
|
|
|
|
|
|
|
|
jsc: {
|
|
|
|
parser: {
|
|
|
|
jsx: true,
|
|
|
|
dynamicImport: true,
|
|
|
|
},
|
|
|
|
// this should match the minimum supported node.js version
|
|
|
|
target: 'es2020',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
|
|
|
path.join(__dirname, 'fileTransformer.js'),
|
|
|
|
},
|
|
|
|
transformIgnorePatterns: [
|
|
|
|
'node_modules/(?!(react-dnd|dnd-core|react-dnd-html5-backend|@strapi/design-system|@strapi/icons|fractional-indexing)/)',
|
|
|
|
],
|
2023-04-26 13:09:24 +02:00
|
|
|
testMatch: ['**/tests/**/?(*.)+(spec|test).[jt]s?(x)'],
|
2023-03-22 11:21:33 +01:00
|
|
|
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'],
|
|
|
|
};
|