question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests fail to run with Mirage

See original GitHub issue

Versions:

  • Embroider: current master (418af5a7fe53e8947a9a0454fdc01649be6fb22b)
  • ember-cli-mirage: 1.1.0
  • ember-auto-import: 1.5.2

When an application has Mirage installed, test runs give an early failure, when checking if Mirage should be used:

TypeError: Cannot destructure property `getContext` of 'undefined' or 'null'.
    at getRfc232TestContext (webpack:///./node_modules/ember-cli-mirage/get-rfc232-test-context.js?:18:9)
    at _shouldUseMirage (webpack:///./initializers/ember-cli-mirage.js?:57:109)
    at Object.initialize (webpack:///./initializers/ember-cli-mirage.js?:38:9)
    at http://localhost:7357/assets/vendor.js:46464:21

https://github.com/samselikoff/ember-cli-mirage/blob/0e0740a6c7844cbeb159a340924590554d1232ee/addon/get-rfc232-test-context.js#L9-L17

I suspect it might be because those lines in Mirage use require to check if @ember/test-helpers is a project dependency.

I have a reproduction of this on the mirage branch of my Embroider sandbox, here: https://github.com/balinterdi/go-embroider-go/tree/mirage

(The test passes on the master branch, before adding Mirage)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
ef4commented, Jul 23, 2019

Yes, that would be the solution for how to fix this upstream in mirage. Though you should probably hold off until @embroider/macros is updated to match the current RFC.

The more temporary workaround is to use a compatAdapter to force @ember/test-selectors to be included as an implicit-test-module.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing server errors with Mirage | EmberMap
Testing server errors with Mirage. Testing network requests that fail in an Ember app is currently a somewhat inconsistent experience.
Read more >
Tutorial: Part 9 – Testing • Mirage JS
Part 9 – Testing. In this final section, we're going to learn how to use Mirage to test our app given a variety...
Read more >
Ember mirage server is not defined in tests - Stack Overflow
Mirage starts up in an initializer. Since initializers only run when a full Ember app boots up, by default the Mirage server is...
Read more >
UI Testing with React, Mirage, Jest and Testing Library
This video goes over some of the basics of writing UI tests for an existing React application using Mirage, Jest, and Testing Library....
Read more >
Using Mirage JS And Cypress For UI Testing (Part 4)
In this final part of Mirage JS Deep Dive series, ... However, if we run our tests, it will fail because we don't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found