You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem and two possible solutions, though I didn't peruse your code enough to determine which one is better..
I need to set a specific configuration for the module under test, like this:
describe('My component', function() {
beforeEach(function() {
requirejs.config({
config: {
'src/MyComponent': {
someVariable: true
}
}
});
});
it('should be able to read its own configuration', function(done) {
require(['isolate!src/MyComponent'], function(MyComponent) {
var comp = new MyComponent();
comp.getSomeVariable().should.be.true;
done();
});
});
});
Now, if the getSomeVariable method inside MyComponent needs to read from the module's configuration (using module().config) it would fail, since that configuration is not passed when the module is required through Isolate.
The solution seems to be simple: when setting the config here at line 178, the actual configuration of the module should be set too:
What I'm not sure is whether we should pass mainCtx.config, or config.config. In my own test they seemed to contain pretty much the same data, which is why I'm not just opening a pull request... 😁
The text was updated successfully, but these errors were encountered:
I have a problem and two possible solutions, though I didn't peruse your code enough to determine which one is better..
I need to set a specific configuration for the module under test, like this:
Now, if the
getSomeVariable
method insideMyComponent
needs to read from the module's configuration (usingmodule().config
) it would fail, since that configuration is not passed when the module is required through Isolate.The solution seems to be simple: when setting the config here at line 178, the actual configuration of the module should be set too:
What I'm not sure is whether we should pass
mainCtx.config
, orconfig.config
. In my own test they seemed to contain pretty much the same data, which is why I'm not just opening a pull request... 😁The text was updated successfully, but these errors were encountered: