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
One major problem with the current Require.js adapter is that it enforces you to call requirejs.config to configure the baseURL. This is unfortunate because Require.js allows you set up a global object called require which it will than read in as configuration. This is a much more flexible way of configuring your loader as it allows you to do overrides for different environments.
Say I have a config.js file that I include in my HTML above the require.js file.
varrequire={baseUrl : '...',paths: {...}};
When Require.js gets loaded onto the page it will load in that require configuration, this allows me to override configuration options for my testing environment.
Which unfortunately overrides whatever baseUrl someone might have configured. This also doesn't account for multiple require.js contexts. See Squire.js for an example of cloning require configuration.
One idea for a workaround is to concatenate the existing baseUrl onto '/base' though like I said this doesn't support multiple contexts very well... Perhaps we should implement testacular to prepend '/base' to all the existing configured baseUrls consequently supporting multiple contexts and require configuration.
Thoughts?
The text was updated successfully, but these errors were encountered:
So I think the best will be just not touch the baseUrl at all and let users do it. It means people need to understand that Testacular serves files under /base/* (which is the basePath from config file) or under /absolute/* (for files that are outside the basePath of the project. However, I think it's gonna be less magical and less confusing.
Beautiful, I think its much better to leave this in the hands of the consumer. And no worries, the code is straightforward enough I've just been using my patched adapter since I filed the bug. :-)
One major problem with the current Require.js adapter is that it enforces you to call
requirejs.config
to configure the baseURL. This is unfortunate because Require.js allows you set up a global object called require which it will than read in as configuration. This is a much more flexible way of configuring your loader as it allows you to do overrides for different environments.Say I have a config.js file that I include in my HTML above the require.js file.
When Require.js gets loaded onto the page it will load in that require configuration, this allows me to override configuration options for my testing environment.
The problem is that the Require adapter calls:
Which unfortunately overrides whatever baseUrl someone might have configured. This also doesn't account for multiple require.js contexts. See Squire.js for an example of cloning require configuration.
One idea for a workaround is to concatenate the existing baseUrl onto '/base' though like I said this doesn't support multiple contexts very well... Perhaps we should implement testacular to prepend '/base' to all the existing configured baseUrls consequently supporting multiple contexts and require configuration.
Thoughts?
The text was updated successfully, but these errors were encountered: