I am using the template project that they have for typescript and I would like to modify it to put the different tests in different folders so that it is more organized. I have modified the webpack.config.js file with the following change:
mode: 'production',
entry: GlobEntries('./src/*test*.ts'), // Generates multiple entry for each test
output: {
path: path.join(__dirname, 'dist'),
libraryTarget: 'commonjs',
filename: '[name].js',
},
mode: 'production',
entry: GlobEntries('./src/PlaySpace/Login/Guest/*test*.ts'), // Generates multiple entry for each test
output: {
path: path.join(__dirname, 'dist/PlaySpace/Login/Guest'),
libraryTarget: 'commonjs',
filename: '[name].js',
},
But it only modifies the tests of the last mode. What I want to do can be done?
At a glance, youβre redefining the mode, entry, and output twice. If itβs the case, I assume that one overrides the other. You might want to have a single set of each key and define separate entries for each path containing tests.
Also, Iβm unfamiliar with GlobEntries, but assuming it does what its name hints, you might be able to use a larger glob statement such as GlobEntries('./src/**/*test*.ts')? (meaning go through the src/ folder recursively, and find all files containing test in their name and ending with the .ts extension?
It has worked seems to be to find all test.ts files using ./src/**/test.ts. But the files are still put in the same folder, not in separate directories, which is what we want to keep the project tidy.
I would like to know if your solution can work for a scenario where thereβs a parent folder and inside of it thereβre multiple folders with the tests.