-
Notifications
You must be signed in to change notification settings - Fork 42
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
locals does not appear to set variable inside the module #45
Comments
You can't override existing variables with |
hmm - well, if I take away the module declaration of |
At that point I'm guessing it's a bug :(. |
ok - thanks for taking a look. Does it make sense to also add a feature request to enable overriding of existing variables? In my actual project, I'm looking for a way to fake out internal methods that coordinate more complex, I/O bound operations with a function that simulates latency. I can work around not having this capability by simply adding the function to the module's exports, but doing so adds otherwise unnecessary surface area to the module. |
I don't see how it would be possible to override the existing variables. The existing locals transform is supposed to work by transforming // your code into (function (local1, local2) {
// your code
}(value1, value2)); |
I'm trying to get locals working and suspect I'm doing something wrong as my scenario feels like it should be very basic.
In this simplified scenario, I have a test that should inject a local variable into my module which should override an existing variable. I then have an assertion that verifies the value was set.
mod.js looks like this
and modTests.js looks like this
When I run the tests, I get an error that the function returns undefined. Not sure whether I'm doing something wrong here (I suspect so, as this seems like a really basic scenario) or if there's an issue in the code (I did step into it a bit, but it appeared that the local was at least collected from the options).
The text was updated successfully, but these errors were encountered: