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
When using td.replace on big modules such as request-promise it take a lot of time (almost 1 second!)
I've created a runkit to demostrate this. When i'm running it on my browser it takes around 500ms (which is still a lot for a test i believe) https://runkit.com/slavab89/5a845a337bdbe50012dea485
When i have a lot of tests that do that logic in BeforeEach, it makes it very slow.
Maybe there should be a possibility to reset only the call counters of all the "when"s somehow?
The text was updated successfully, but these errors were encountered:
Personally, I'd recommend isolating most 3rd party dependencies to the periphery of the app by making custom wrappers (i.e. wrap/request-promise.js) that only exports the minimum functions your app uses, potentially translating them to cleaner function signatures that mirror how you design the rest of your code.
I don't think a productive workaround to this would be absorbing some amount of state pollution across test cases to avoid the cost of imitating the dependency (since tracking changes at every single level of a complex replacement would probably cost as much as just re-imitating it, but it'd be an interesting perf optimization experiment)
p.s. Thanks for coming in to ask the question—I hope this reply doesn't read too curtly
When using
td.replace
on big modules such asrequest-promise
it take a lot of time (almost 1 second!)I've created a runkit to demostrate this. When i'm running it on my browser it takes around 500ms (which is still a lot for a test i believe)
https://runkit.com/slavab89/5a845a337bdbe50012dea485
When i have a lot of tests that do that logic in BeforeEach, it makes it very slow.
Maybe there should be a possibility to reset only the call counters of all the "when"s somehow?
The text was updated successfully, but these errors were encountered: