Skip to content
This repository has been archived by the owner on Dec 3, 2018. It is now read-only.

fix aliasing when running inside jest #38

Merged
merged 1 commit into from
Nov 3, 2017
Merged

Conversation

pigoz
Copy link
Contributor

@pigoz pigoz commented Nov 3, 2017

I am not sure why this causes problems when running the loader through jest and not webpack but this simple fix seems to fix my issues. Following is the the commit message.

It looks like when running the loader from jest, process.env looks up
the env property on the process function instead of the global object.
This results in errors like the following:

 FAIL  test/jest_test.re
  ● Test suite failed to run

    TypeError: process.cwd is not a function

      at Function.process (node_modules/bs-loader/index.js:108:13)
          at Generator.next (<anonymous>)

I renamed the process function to something else to remove this name
aliasing issue.

It looks like when running the loader from jest, `process.env` looks up
the env property on the `process` function instead of the global object.
This results in errors like the following:

```
 FAIL  test/jest_test.re
  ● Test suite failed to run

    TypeError: process.cwd is not a function

      at Function.process (node_modules/bs-loader/index.js:108:13)
          at Generator.next (<anonymous>)
```

I renamed the `process` function to something else to remove this name
aliasing issue.
@rrdelaney
Copy link
Owner

Hey @pigoz! Thanks so much for the PR! It makes sense, there’s the global “process” object too - might be interfering in some places. We don’t have any tests for Jest, so thanks for catching this and fixing it!

@rrdelaney rrdelaney merged commit f9b0eb0 into rrdelaney:master Nov 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants