ember-browserify
ember-browserify copied to clipboard
Could not find module `npm:fetch-mock` trying to test ember-network/fetch
Hi. I'm trying to write a test with ember-network/fetch. The testing section (https://github.com/tomdale/ember-network#testing ) says to
npm install fetch-mock
ember install ember-browserify
Then in a test do
import fetchMock from 'npm:fetch-mock';
In a brand new ember-cli project I'm getting --
Could not find module `npm:fetch-mock` imported from `ember-sandbox/tests/acceptance/root-test`
repo for reproduction -- https://github.com/stephencattaneo/ember-browserify-issue/ test -- https://github.com/stephencattaneo/ember-browserify-issue/blob/master/tests/acceptance/root-test.js
Hey, we are having the same issues. Any update on this?
Ended up doing import fetchMock from 'npm:fetch-mock/es5/server'; which seem to have work. I don't really know if thats how ember-browserify is suppose to work shrug
@stephencattaneo I'm having the same problem with a different repo
Getting this as well now.
I'm not sure if this is the same problem, but I can't import deepmerge via ember-browserify.
I'm using:
When I have the following line in one of my services:
import deepmerge from 'npm:deepmerge';
I get:
ember.debug.js:19811 Error: Could not find module `npm:deepmerge` imported from `my-app/pods/authentication/service`
Is there any sort of workaround I can do in this instance?
It is probably this? https://github.com/ef4/ember-browserify/issues/14
As a workaround, import the same module from somewhere in app/ and the import from test/ will work.
@oskarrough I wonder if doing that will result in that test code and those dependencies being in your final build.
@skaterdav85 it will. Well not the test code, but the module you imported via app will.
@oskarrough along with that test's dependencies like ember-qunit.
@skaterdav85 oh you're right. OK, guess it's not a workaround afterall. Thanks!
still having that issue - ember cannot find 'fetch-mock'. im using ember 2.4 node: 6.14.4 trying fetch-mock in latest version - 9.3.0 and older one (7.7.3)