Skip to content
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

Support a nicer way of mocking shim modules when using dojo/testing #275

Closed
matt-gadd opened this issue Feb 25, 2019 · 1 comment
Closed
Assignees
Labels
enhancement New feature or request

Comments

@matt-gadd
Copy link
Contributor

Enhancement
Currently their is no canonical way to mock @dojo/shim modules. This is a little annoying when wanting to mock things such as fetch and requires messing with the global.

Perhaps inside our shim modules we can have a wrapper that wraps the shim itself and when a test has flag is enabled provides an additional export that allows you to mutate it.

For example something like:

import fetch, { replace } from '@dojo/framework/shim/fetch'
replace(myMockFetch);

where replace (not attached to the name), is only available with the test has flag. This would allow you to swap the implementation.

@maier49
Copy link
Contributor

maier49 commented Apr 29, 2019

With the PRs here, in cli-test-intern, and in cli-build-app merged this should be done.

@maier49 maier49 closed this as completed Apr 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants