Skip to content

Commit fa7afb4

Browse files
Application tests
1 parent 3ffe8c9 commit fa7afb4

17 files changed

+3076
-29
lines changed

jest.base-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ const configurator = (customization = {}) => {
174174
transform: {
175175
'^.+\\.(js|jsx|mjs|cjs|ts|tsx)$': path.resolve(__dirname, 'jest', 'babelTransform.js'),
176176
'^.+\\.(css|less)$': path.resolve(__dirname, 'jest', 'cssTransform.js'),
177-
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': path.resolve(__dirname, 'jest', 'fileTransform.js'),
177+
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json|info)$)': path.resolve(__dirname, 'jest', 'fileTransform.js'),
178+
'^.+\\.info$': 'jest-raw-loader',
178179
},
179180

180181
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"css-minimizer-webpack-plugin": "^3.1.1",
2525
"html-webpack-plugin": "^5.4.0",
2626
"jest": "^27.3.0",
27+
"jest-raw-loader": "^1.0.1",
2728
"json-minimizer-webpack-plugin": "^3.1.0",
2829
"less": "^4.1.2",
2930
"less-loader": "^10.2.0",

packages/app/jest.config.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const configurator = require('../../jest.base-config');
2+
3+
const config = configurator({
4+
coverageReporters: [
5+
'lcov',
6+
'@lcov-viewer/istanbul-report',
7+
],
8+
moduleNameMapper: {
9+
'^react$': 'preact/compat',
10+
'^react-dom/test-utils$': 'preact/test-utils',
11+
'^react-dom$': 'preact/compat',
12+
'^react/jsx-runtime$': 'preact/jsx-runtime',
13+
},
14+
coveragePathIgnorePatterns: [
15+
'/node_modules/',
16+
'/mocks/',
17+
],
18+
});
19+
20+
module.exports = config;

packages/app/mocks/lcov/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import unix_relative_multi_root from './unix_relative_multi_root.info';
2+
import unix_relative_single_root from './unix_relative_single_root.info';
3+
import unix_absolute from './unix_absolute.info';
4+
import win_relative_multi_root from './win_relative_multi_root.info';
5+
import win_relative_single_root from './win_relative_single_root.info';
6+
import win_absolute from './win_absolute.info';
7+
8+
const mocks = {
9+
unixRelativeMultiRoot: unix_relative_multi_root,
10+
unixRelativeSingleRoot: unix_relative_single_root,
11+
unixAbsolute: unix_absolute,
12+
winRelativeMultiRoot: win_relative_multi_root,
13+
winRelativeSingleRoot: win_relative_single_root,
14+
winAbsolute: win_absolute,
15+
};
16+
17+
export default mocks;

0 commit comments

Comments
 (0)