Skip to content

Commit

Permalink
Fix jest Config
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis CI authored and WiXSL committed Dec 12, 2021
1 parent c9f59e9 commit 0c9be76
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
const path = require('path');
const fs = require('fs');

const packages = fs.readdirSync(path.resolve(__dirname, './packages'));
const moduleNameMapper = packages.reduce((mapper, dirName) => {
const package = require(path.resolve(
__dirname,
'./packages',
dirName,
'package.json'
));
mapper[`^${package.name}(.*)$`] = path.join(
__dirname,
`./packages/${dirName}/src$1`
);
return mapper;
}, {});

module.exports = {
globalSetup: './test-global-setup.js',
setupFilesAfterEnv: ['./test-setup.js'],
Expand All @@ -21,18 +36,3 @@ module.exports = {
},
moduleNameMapper,
};

const packages = fs.readdirSync(path.resolve(__dirname, './packages'));
const moduleNameMapper = packages.reduce((mapper, dirName) => {
const package = require(path.resolve(
__dirname,
'./packages',
dirName,
'package.json'
));
mapper[`^${package.name}(.*)$`] = path.join(
__dirname,
`./packages/${dirName}/src$1`
);
return mapper;
}, {});

0 comments on commit 0c9be76

Please sign in to comment.