speedskater / babel-plugin-rewire

A babel plugin adding the ability to rewire module dependencies. This enables to mock modules for testing purposes.
843 stars 90 forks source link

RC5 broke our mocha-electron test suite #150

Closed lparry closed 7 years ago

lparry commented 7 years ago

first file that tries to load errors out with:

Error encountered in node_modules/babel-core/lib/transformation/file/index.js: Uncaught TypeError: /filepath/aFileStartingWithA.js: Property id of VariableDeclarator expected node to be of a type ["LVal"] but instead got "CallExpression"

going back to RC4 the problem goes away. Not sure what kind of info I can provide that would be useful, the error is a bit cryptic to me

.babelrc for tests looks like:

{
  "presets": ["es2015", "stage-0", "react"],
  "plugins": [
  "transform-decorators-legacy",
      "rewire",
      ["babel-plugin-module-alias", [
      { "src": "./some/aliasec/paths", "expose": "test" },
      ...
      ]]
    ]
  }  
}
chrisblossom commented 7 years ago

I am seeing this same issue but only with one of my test runners (Wallabyjs).

speedskater commented 7 years ago

@lparry thanks for reporting the issue can you please provide a small sample PR ?

speedskater commented 7 years ago

@lparry, @chrisblossom I think rc6 should fix this issue. Could you please try it and let me know if it works for you? Otherwise please feel free to reopen this bug.

davidpadbury commented 7 years ago

@speedskater had a similar issue and just tried rc6. Looks resolved. Thanks!

speedskater commented 7 years ago

@davidpadbury thanks for the fast feedback.

lparry commented 7 years ago

@speedskater sorry I couldn't get back to you with a PR, RC6 did fix it for us, thanks!

chrisblossom commented 7 years ago

@speedskater it fixed it for me too. Thank you!!