Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsdx test does not pull in options from .babelrc #583

Open
epicfaace opened this issue Mar 16, 2020 · 3 comments
Open

tsdx test does not pull in options from .babelrc #583

epicfaace opened this issue Mar 16, 2020 · 3 comments
Labels
kind: bug Something isn't working kind: feature New feature or request solution: workaround available There is a workaround available for this issue version: minor Increment the minor version when merged

Comments

@epicfaace
Copy link

Current Behavior

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.

Your environment

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
@agilgur5
Copy link
Collaborator

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
    }
  }
};

@rafamel
Copy link

rafamel commented Sep 27, 2020

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?

@agilgur5
Copy link
Collaborator

agilgur5 commented Sep 27, 2020

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working kind: feature New feature or request solution: workaround available There is a workaround available for this issue version: minor Increment the minor version when merged
Projects
None yet
Development

No branches or pull requests

3 participants