Skip to content

Commit

Permalink
fix(test): fix runtime moduleNameMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Jul 7, 2022
1 parent c4221cb commit ff208ca
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/taro-mini-runner/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module.exports = {
}
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'jsx', 'node'],
moduleNameMapper: {
'@tarojs/runtime': '<rootDir>/src/__tests__/mocks/taro-runtime',
},
preset: 'ts-jest',
setupFilesAfterEnv: ['./src/__tests__/setup/index.ts'],
testEnvironment: 'node',
Expand Down
1 change: 0 additions & 1 deletion packages/taro-mini-runner/src/__tests__/utils/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export async function compile (app: string, customConfig: Partial<IBuildConfig>
chain.merge({
resolve: {
alias: {
'@tarojs/runtime': path.resolve(__dirname, '../mocks/taro-runtime'),
'@tarojs/components$': path.resolve(__dirname, '../mocks/taro-components'),
'@tarojs/react': path.resolve(__dirname, '../mocks/taro-react'),
'@tarojs/taro': path.resolve(__dirname, '../mocks/taro'),
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-webpack-runner/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'jsx', 'node'],
moduleNameMapper: {
'@pmmmwh/react-refresh-webpack-plugin': '<rootDir>/src/__tests__/mocks/react-refresh',
'@prefresh/webpack': '<rootDir>/src/__tests__/mocks/react-refresh'
'@prefresh/webpack': '<rootDir>/src/__tests__/mocks/react-refresh',
'@tarojs/runtime': '<rootDir>/src/__tests__/mocks/taro-runtime',
},
preset: 'ts-jest',
setupFilesAfterEnv: ['./src/__tests__/setup/index.ts'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export async function compile (app: string, customConfig: Partial<BuildConfig> =
webpackChain.merge({
resolve: {
alias: {
'@tarojs/runtime': path.resolve(__dirname, '../mocks/taro-runtime'),
'@tarojs/shared': path.resolve(__dirname, '../mocks/taro-shared'),
'@tarojs/taro-h5': path.resolve(__dirname, '../mocks/taro-h5'),
'@tarojs/router': path.resolve(__dirname, '../mocks/taro-router'),
Expand Down

0 comments on commit ff208ca

Please sign in to comment.