-
Notifications
You must be signed in to change notification settings - Fork 33
Migrate from ember-cli-mirage to miragejs
#3088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hashicc
wants to merge
20
commits into
main
Choose a base branch
from
ember-mirage
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2807e77
chore: 🤖 import explicit mirage references
hashicc 82ee865
chore: 🤖 add mirage setupMirage helper
hashicc 538ae64
chore: 🤖 working example with application adapter test
hashicc b72c562
chore: 🤖 use internal setupMirage test helper from api addon
hashicc c5f3580
chore: 🤖 conditionally load mirage
hashicc 853a081
chore: 🤖 filter mirage folder inclusion in production builds
hashicc d582e67
chore: 🤖 drop ember-mirage and use our own test helpers
hashicc ffe2a5a
chore: 🤖 collapse reference to import declaration
hashicc 797b32e
docs: ✏️ add comment better explaining the mirage test env
hashicc 7a30c84
chore: 🤖 update configuration and manage mirage-related deps
hashicc f86586e
fix: 🐛 restore ipc mock and add missing checkOS handler
hashicc 57d8c50
chore: 🤖 add comment explaining omitting mirage deps in build
hashicc 745eb5b
chore: 🤖 allow mirage.enabled to include deps and handlers
hashicc e641cdf
chore: 🤖 re-enable mirage for core dummy app
hashicc 7ef0eed
Add missing copyright headers
hashicc aa1d435
chore: 🤖 use embroider macros to conditionally start mirage
hashicc 3ccf386
docs: ✏️ update api readme for mirage changes
hashicc 86e098f
chore: 🤖 replace remaining ember-cli-mirage references
hashicc 1fbc493
chore: 🤖 add mirage to test builds
hashicc 20f81e8
fix: 🐛 ensure that auto mirage start doesn't happen in test env
hashicc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
|
|
||
| import { settled } from '@ember/test-helpers'; | ||
| import startMirage from 'api/mirage/config'; | ||
|
|
||
| export function setupMirage(hooks) { | ||
| hooks.beforeEach(function () { | ||
| if (!this.owner) { | ||
| throw new Error( | ||
| 'Must call one of the ember-qunit setupTest() / setupRenderingTest() / setupApplicationTest() first', | ||
| ); | ||
| } | ||
|
|
||
| // the environment property here is configuration to the mirage server: | ||
| // https://github.com/miragejs/miragejs/blob/7ff4f3f6fe56bf0cb1648f5af3f5210fcb07e20b/types/index.d.ts#L383 | ||
| // It is not related to ember's build environment. In this case for mirage the "test" environment does | ||
| // not load the default scenario: | ||
| // https://github.com/miragejs/miragejs/blob/7ff4f3f6fe56bf0cb1648f5af3f5210fcb07e20b/lib/server.js#L302 | ||
| this.server = startMirage({ environment: 'test' }); | ||
| }); | ||
|
|
||
| hooks.afterEach(function () { | ||
| return settled().then(() => { | ||
| if (this.server) { | ||
| this.server.shutdown(); | ||
| delete this.server; | ||
| } | ||
| }); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of the build magic
ember-cli-mirageprovided was auto-discovery and inclusion of various models, factories, serializers based on the folder structure. This now has to be done manually. When we move to vite we should be able to useimport.meta.globand specify all the models in one glob pattern but until then they'll have to be done manually, one-by-one.