ember-browserify icon indicating copy to clipboard operation
ember-browserify copied to clipboard

Could not find module `npm:fetch-mock` trying to test ember-network/fetch

Open stephencattaneo opened this issue 8 years ago • 11 comments

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

stephencattaneo avatar Mar 28 '17 00:03 stephencattaneo

Hey, we are having the same issues. Any update on this?

mani-mishra avatar Apr 04 '17 18:04 mani-mishra

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 avatar Apr 04 '17 18:04 stephencattaneo

@stephencattaneo I'm having the same problem with a different repo

matthewbortolin avatar Apr 06 '17 07:04 matthewbortolin

Getting this as well now.

brancusi avatar Apr 08 '17 17:04 brancusi

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?

denchen avatar Apr 16 '17 01:04 denchen

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 avatar Jun 07 '17 09:06 oskarrough

@oskarrough I wonder if doing that will result in that test code and those dependencies being in your final build.

iamdtang avatar Jun 07 '17 14:06 iamdtang

@skaterdav85 it will. Well not the test code, but the module you imported via app will.

oskarrough avatar Jun 07 '17 15:06 oskarrough

@oskarrough along with that test's dependencies like ember-qunit.

iamdtang avatar Jun 07 '17 16:06 iamdtang

@skaterdav85 oh you're right. OK, guess it's not a workaround afterall. Thanks!

oskarrough avatar Jun 07 '17 19:06 oskarrough

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)

NivBraz avatar Mar 22 '20 15:03 NivBraz