-
Notifications
You must be signed in to change notification settings - Fork 27
Impossible to return strings #28
Comments
This is not possible currently, as you are correct that it assumes a string is a file path. I would suggest making a |
Having a dummy template is what I am currently doing, but as my project has a rather dynamic structure, this leads to issues during building and testing (using gulp), as files get copied to different locations. If you think is is a valid feature request, I will try to do a PR. |
Unfortunately I don't think this would be a good feature to add, as it would hide errors when referencing an incorrect path/module. For example, Depending on how your code is setup, you might be able to get away with doing something like: const html = {
toString: () => '<html />'
};
mock('./template.html', html);
|
I actually tried that, but it failed as |
Hi,
I am currently having the issue where I want to mock a HTML-file. Unfortunately, I cannot do this because if the second argument of
mock()
is a string, it assumes that it is a path to look for a module to return. But I simply wantmock('../templates/template.html', 'dummytemplate')
to return'dummytemplate'
.Maybe this is already possible somehow...?
The text was updated successfully, but these errors were encountered: