Running tsdx test does not pull in options from .babelrc.
Run yarn test and the .babelrc configuration is not respected.
However, run yarn run jest and the .babelrc configuration _is_ respected.
I have a repo that reproduces this: https://github.com/epicfaace/test-repro.
| Software | Version(s) |
| ---------------- | ---------- |
| TSDX | 0.12.3
| TypeScript | 3.8.3
| Browser | Chrome
| npm/Yarn | yarn 1.21.1
| Node | 10.19.0
| Operating System | Ubuntu
Closely related to #383 .
Currently you have to configure Jest to get Babel support, it is unfortunately not quite supported out-of-the-box (which creates some confusion given that this behavior is currently different from build).
You can see how to do that with ts-jest here: https://kulshekhar.github.io/ts-jest/user/config/babelConfig#use-default-babelrc-file
Summary:
// jest.config.js
module.exports = {
// [...]
globals: {
'ts-jest': {
babelConfig: true
}
}
};
As far as I can see, the issue with this is it will use only the local babel configuration file, meaning we can't depend on tsdx's babel configuration merge. Is this on the roadmap? Otherwise, is there a workaround to this?
@rafamel yes, as mentioned in my first comment, there's a separate issue for that: #383.
I'm tackling them together as, while implementing this one is simple, it would be a breaking and incomplete change without #383. But it may suffice for some users, so I have left this issue open (i.e., not closed as duplicate) as an available workaround.
Per the milestones listed here, I was planning to get these in for v0.14.0, but per the release notes, I did not quite get to #383 as it's quite complex. So far I have not been able to fully separate out TSDX's config as a preset because the merging logic can't be done in a preset. But I've removed a good portion of the merging logic with #795