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

(feat): support custom jest config paths via --config #526

Merged
merged 4 commits into from Mar 9, 2020

Conversation

agilgur5
Copy link
Collaborator

@agilgur5 agilgur5 commented Feb 28, 2020

  • --config will now be parsed shallow merged with the defaults,
    just like package.json.jest already is

  • previously adding --config to tsdx test would result in jest
    outputting a usage prompt (I believe due to the second --config
    that's added internally) and then the somewhat cryptic
    "argv.config.match is not a function"

    • if --config is detected, it will be parsed, merged, and then
      deleted from argv so that this error doesn't occur anymore

Also dogfood tsdx test internally (this was the last thing needed for it to be possible) & improve Jest config typings

Fixes #150 , or rather what's left of it after #229 .

- --config will now be parsed shallow merged with the defaults,
  just like package.json.jest already is

- previously adding --config to tsdx test would result in jest
  outputting a usage prompt (I believe due to the second --config
  that's added internally) and then the somewhat cryptic
  "argv.config.match is not a function"
  - if --config is detected, it will be parsed, merged, and then
    deleted from argv so that this error doesn't occur anymore
- now that --config is supported, this is fairly straightforward
  - rootDir had to be added because TSDX defaults use app root, and not
    the directory of the jest.config file
- that matches Jest's default and means no changes have to be made for
  the internal jest.config.json to work with `tsdx test`
Copy link
Collaborator Author

@agilgur5 agilgur5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok to me. Would be good if there were a simpler way to remove the config argument or to customize Jest but probably can't do much better as of right now due to Jest's very bare API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot set custom jest.config.{js,ts} even with --config flag in test CLI command
1 participant