0

Facing the same issue - https://github.com/miragejs/ember-cli-mirage/issues/1445

Uncaught Error: Could not find module project-name/tests/helpers/push-mirage-into-store imported from project-name/mirage/factories/addon

Initially got this error and tried @makepanic instructions

After that

Uncaught Error: Could not find module @ember/test-helpers imported from project-name/mirage/helpers/push-mirage-into-store

can you pls help here to resolve this.

tamilmani
  • 591
  • 6
  • 13
  • Can you provide some more context? What does `push-mirage-into-store.js` look like? Are you seeing this issue when running tests or running in development? – seanCodes Jul 10 '20 at 04:40

1 Answers1

0

I bet you are running into the error, which is described in this comment by makepanic in the GitHub issue you linked:

When running the app directly, the browser opens index.html which isn't loading tests.js. This file contains everything related to tests.

If you open tests/index.html, that will also load tests.js and add any modules under tests/* to the loader registry.

This means without the tests file loaded, you can't import anything from tests/*.

You are affected by that issue if you face it when running ember serve.

The comment also includes a possible solution:

With you moving the helpers to /mirage, they gets registered in both index.html and tests/index.html.

An alternative would be to disable mirage in all enrironments except for test. But that is only a feasible solution if you use mirage only for testing but not for development.

jelhan
  • 6,149
  • 1
  • 19
  • 35