Skip to content

Commit

Permalink
fix jest config
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki0410-dev committed Jun 8, 2024
1 parent 2b4687e commit 3b3d060
Showing 1 changed file with 71 additions and 1 deletion.
72 changes: 71 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
const babelTargetList = [
"helper_components/custom_input\\.tsx",
"calendar_test\\.test\\.tsx",
"datepicker_test\\.test\\.tsx",
"min_time_test\\.test\\.tsx",
"month_dropdown_test\\.test\\.tsx",
"month_test\\.test\\.tsx",
"month_year_dropdown_test\\.test\\.tsx",
"multi_month_test\\.test\\.tsx",
"multiple_selected_dates\\.test\\.tsx",
"week_number_test\\.test\\.tsx",
"year_dropdown_test\\.test\\.tsx",
];

const tsTargetList = [
"helper_components/calendar_icon\\.tsx",
// "helper_components/custom_input\\.tsx",
"helper_components/custom_time_input\\.tsx",
"helper_components/test_wrapper\\.tsx",
"calendar_icon\\.test\\.tsx",
// "calendar_test\\.test\\.tsx",
"date_utils_test\\.test\\.ts",
// "datepicker_test\\.test\\.tsx",
"day_test\\.test\\.tsx",
"exclude_dates\\.test\\.tsx",
"exclude_time_period_test\\.test\\.tsx",
"exclude_times_test\\.test\\.tsx",
"filter_times_test\\.test\\.tsx",
"include_times_test\\.test\\.tsx",
"index\\.ts",
"inject_times_test\\.test\\.tsx",
// "min_time_test\\.test\\.tsx",
// "month_dropdown_test\\.test\\.tsx",
// "month_test\\.test\\.tsx",
// "month_year_dropdown_test\\.test\\.tsx",
// "multi_month_test\\.test\\.tsx",
// "multiple_selected_dates\\.test\\.tsx",
"run_axe\\.tsx",
"show_time_test\\.test\\.tsx",
"test_utils\\.ts",
"time_format_test\\.test\\.tsx",
"time_input_test\\.test\\.tsx",
"timepicker_test\\.test\\.tsx",
// "week_number_test\\.test\\.tsx",
"week_picker_test\\.test\\.tsx",
"week_test\\.test\\.tsx",
"year_dropdown_options_test\\.test\\.tsx",
// "year_dropdown_test\\.test\\.tsx",
"year_picker_test\\.test\\.tsx",
];

module.exports = {
roots: ["./src/test"],
setupFilesAfterEnv: ["<rootDir>/src/test/index.ts"],
Expand All @@ -11,7 +62,26 @@ module.exports = {
],
transformIgnorePatterns: ["/node_modules/(?!date-fns)"],
transform: {
"^.+\\.(js|jsx|ts|tsx)$": "babel-jest",
"^.+\\.(js|jsx)$": "babel-jest",
...babelTargetList.reduce((prev, item) => {
return {
...prev,
// [`^<rootDir>/src/test/${item}$`]: "babel-jest",
[`^.+/src/test/${item}$`]: "babel-jest",
// [`^<rootDir>/${item}$`]: "babel-jest",
// [`^.+/${item}$`]: "babel-jest",
};
}, {}),
...tsTargetList.reduce((prev, item) => {
return {
...prev,
// [`^<rootDir>/src/test/${item}$`]: "ts-jest",
[`^.+/src/test/${item}$`]: "ts-jest",
// [`^<rootDir>/${item}$`]: "ts-jest",
// [`^.+/${item}$`]: "ts-jest",
};
}, {}),
"^.+/src/(?!test/).*\\.(ts|tsx)$": "ts-jest",
// TODO: use it after the migration
// "^.+\\.ts?$": "ts-jest",
"node_modules/(?!date-fns/.*)": "ts-jest",
Expand Down

0 comments on commit 3b3d060

Please sign in to comment.