Open jacobdo2 opened 2 years ago
Hi @jacobdo2,
It seems to be related to your Babel version. As described in this issue, since a determined version Babel only supports an array as value for the only
option. So, if you want to use a function you can define an array with a function as unique element:
{
files: {
babelRegister: {
enabled: true,
options: {
only: [(filePath) => {
return filePath.includes("/mocks/") || filePath.includes("/fixtures/");
}],
},
},
},
}
Note: I have tested the change in your repository and it works.
Thanks for the notice, even when it is not related to this project, it would be good to mention it in the guide about how to configure TypeScript. I'll open another issue for that.
Describe the bug When setting up typescript project and following the docs, the
collections
file inside ofmocks
folder stops working the moment I enablefiles.options.only
inmocks.config.js
To Reproduce
yarn
to install depsyarn mocks
to startExpected behavior It should compile and run the project
Logs Error loading file /Users/myName/Projects/mocks-test/mocks/collections.ts: .only must be an array, or undefined Error: .only must be an array, or undefined