0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-23 20:33:16 -05:00
logto/packages/ui/razzle.config.js
simeng-li aafc258ad9
ci(codecov): add jest coverage report (#167)
* ci(codecov): add jest coverage report

add coverage report on core and ui project
add codecov uploader job

* ci: add report upload github workflow action

add report upload github workflow action

* ci: fix ci replace github test actions with test:report

 fix ci replace github test actions with test:report
2022-01-10 10:04:00 +08:00

53 lines
1.4 KiB
JavaScript

'use strict';
const path = require('path');
module.exports = {
options: {
buildType: 'spa',
},
plugins: ['scss'],
modifyWebpackConfig: ({ webpackConfig }) => {
/** @type {import('webpack').Configuration} **/
const config = { ...webpackConfig };
// eslint-disable-next-line @silverhand/fp/no-mutation
config.resolve.alias = {
'@': path.resolve('src/'),
};
// eslint-disable-next-line @silverhand/fp/no-mutating-methods
config.module.rules.push({
test: require.resolve('ky'),
use: {
loader: 'imports-loader',
options: {
imports: 'side-effects @ungap/global-this',
},
},
});
return config;
},
modifyJestConfig: ({ jestConfig }) => {
/** @type {import('@jest/types').Config.InitialOptions} **/
const config = {
...jestConfig,
transformIgnorePatterns: [
'^.+\\.module\\.(css|sass|scss)$',
'[/\\\\]node_modules[/\\\\]((?!ky[/\\\\]).)+\\.(js|jsx|mjs|cjs|ts|tsx)$',
],
moduleNameMapper: {
...jestConfig.moduleNameMapper,
'^.+\\.(css|less|scss)$': 'babel-jest',
'@/(.*)': '<rootDir>/src/$1',
},
setupFilesAfterEnv: [...jestConfig.setupFilesAfterEnv, './src/jest.setup.ts'],
coveragePathIgnorePatterns: ['/node_modules/', '/build/'],
coverageReporters: ['text-summary', 'lcov'],
};
return config;
},
};