1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Resolved ember-cli-mirage import deprecations

refs https://github.com/TryGhost/Admin/pull/2209

- `miragejs` has been extracted to a framework-independent library, the re-exports of `miragejs` elements in `ember-cli-mirage` have been deprecated making our test logs very noisy
- added `miragejs` as a top-level dependency
- updated all relevant imports to pull from `miragejs` instead of `ember-cli-mirage`
This commit is contained in:
Kevin Ansfield 2022-03-08 11:32:01 +00:00
parent a77fff3526
commit 66290622e0
59 changed files with 63 additions and 62 deletions

View file

@ -1,5 +1,5 @@
/* eslint-disable camelcase */
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {dasherize} from '@ember/string';
import {isBlank} from '@ember/utils';

View file

@ -1,5 +1,5 @@
import moment from 'moment';
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {paginatedResponse} from '../utils';
export default function mockIntegrations(server) {

View file

@ -1,5 +1,5 @@
import moment from 'moment';
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {paginatedResponse} from '../utils';
export default function mockInvites(server) {

View file

@ -1,7 +1,7 @@
import faker from 'faker';
import moment from 'moment';
import nql from '@nexes/nql';
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {extractFilterParam, paginateModelCollection} from '../utils';
import {underscore} from '@ember/string';

View file

@ -1,5 +1,5 @@
import moment from 'moment';
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {dasherize} from '@ember/string';
import {isArray} from '@ember/array';
import {isBlank, isEmpty} from '@ember/utils';

View file

@ -1,5 +1,5 @@
import moment from 'moment';
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {dasherize} from '@ember/string';
import {extractFilterParam, paginateModelCollection} from '../utils';
import {isBlank, isEmpty} from '@ember/utils';

View file

@ -1,4 +1,4 @@
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
let themeCount = 1;

View file

@ -1,4 +1,4 @@
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {paginateModelCollection} from '../utils';
export default function mockUsers(server) {

View file

@ -1,4 +1,4 @@
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {isEmpty} from '@ember/utils';
import {paginatedResponse} from '../utils';

View file

@ -1,5 +1,5 @@
import moment from 'moment';
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
export default Factory.extend({
type: 'content',

View file

@ -1,4 +1,4 @@
import {Factory, trait} from 'ember-cli-mirage';
import {Factory, trait} from 'miragejs';
export default Factory.extend({
emailCount: 0,

View file

@ -1,5 +1,5 @@
import moment from 'moment';
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
export default Factory.extend({
name(i) { return `Integration ${i + 1}`;},

View file

@ -1,5 +1,5 @@
import moment from 'moment';
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
export default Factory.extend({
token(i) { return `${i}-token`; },

View file

@ -1,5 +1,5 @@
import moment from 'moment';
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
export default Factory.extend({
createdAt() { return moment().toISOString(); },

View file

@ -1,6 +1,6 @@
import faker from 'faker';
import moment from 'moment';
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
const EVENT_TYPES = [
'newsletter_event',

View file

@ -1,6 +1,6 @@
import faker from 'faker';
import moment from 'moment';
import {Factory, trait} from 'ember-cli-mirage';
import {Factory, trait} from 'miragejs';
let randomDate = function randomDate(start = moment().subtract(30, 'days').toDate(), end = new Date()) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));

View file

@ -1,4 +1,4 @@
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
export default Factory.extend({
dismissible: true,

View file

@ -1,6 +1,6 @@
import faker from 'faker';
import moment from 'moment';
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
let randomDate = function randomDate(start = moment().subtract(30, 'days').toDate(), end = new Date()) {
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));

View file

@ -1,4 +1,4 @@
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
import {isEmpty} from '@ember/utils';
export default Factory.extend({

View file

@ -1,4 +1,4 @@
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
export default Factory.extend({
name(i) { return `Product ${i}`; },

View file

@ -1,4 +1,4 @@
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
export default Factory.extend({
createdAt: '2013-11-25T14:48:11.000Z',

View file

@ -1,4 +1,4 @@
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
export default Factory.extend({
createdAt: '2015-09-11T09:44:29.871Z',

View file

@ -1,4 +1,4 @@
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
export default Factory.extend({
accessibility: null,

View file

@ -1,6 +1,6 @@
import moment from 'moment';
import {AVAILABLE_EVENTS} from 'ghost-admin/helpers/event-name';
import {Factory} from 'ember-cli-mirage';
import {Factory} from 'miragejs';
export default Factory.extend({
name(i) { return `Integration ${i + 1}`;},

View file

@ -1,4 +1,4 @@
import {Model, belongsTo} from 'ember-cli-mirage';
import {Model, belongsTo} from 'miragejs';
export default Model.extend({
integration: belongsTo()

View file

@ -1,4 +1,4 @@
import {Model} from 'ember-cli-mirage';
import {Model} from 'miragejs';
export default Model.extend({
});

View file

@ -1,3 +1,3 @@
import {Model} from 'ember-cli-mirage';
import {Model} from 'miragejs';
export default Model.extend({});

View file

@ -1,4 +1,4 @@
import {Model, belongsTo} from 'ember-cli-mirage';
import {Model, belongsTo} from 'miragejs';
export default Model.extend({
post: belongsTo()

View file

@ -1,4 +1,4 @@
import {Model, hasMany} from 'ember-cli-mirage';
import {Model, hasMany} from 'miragejs';
export default Model.extend({
apiKeys: hasMany(),

View file

@ -1,4 +1,4 @@
import {Model, belongsTo} from 'ember-cli-mirage';
import {Model, belongsTo} from 'miragejs';
export default Model.extend({
role: belongsTo()

View file

@ -1,4 +1,4 @@
import {Model, hasMany} from 'ember-cli-mirage';
import {Model, hasMany} from 'miragejs';
export default Model.extend({
members: hasMany()

View file

@ -1,4 +1,4 @@
import {Model, belongsTo} from 'ember-cli-mirage';
import {Model, belongsTo} from 'miragejs';
export default Model.extend({
email: belongsTo(),

View file

@ -1,4 +1,4 @@
import {Model, hasMany} from 'ember-cli-mirage';
import {Model, hasMany} from 'miragejs';
export default Model.extend({
labels: hasMany(),

View file

@ -1,4 +1,4 @@
import {Model} from 'ember-cli-mirage';
import {Model} from 'miragejs';
export default Model.extend({
});

View file

@ -1,4 +1,4 @@
import {Model, belongsTo, hasMany} from 'ember-cli-mirage';
import {Model, belongsTo, hasMany} from 'miragejs';
export default Model.extend({
tags: hasMany(),

View file

@ -1,4 +1,4 @@
import {Model, belongsTo} from 'ember-cli-mirage';
import {Model, belongsTo} from 'miragejs';
export default Model.extend({
product: belongsTo('product')

View file

@ -1,4 +1,4 @@
import {Model, hasMany} from 'ember-cli-mirage';
import {Model, hasMany} from 'miragejs';
export default Model.extend({
// ran into odd relationship bugs when called `benefits`

View file

@ -1,4 +1,4 @@
import {Model} from 'ember-cli-mirage';
import {Model} from 'miragejs';
export default Model.extend({
});

View file

@ -1,4 +1,4 @@
import {Model} from 'ember-cli-mirage';
import {Model} from 'miragejs';
export default Model.extend({
});

View file

@ -1,3 +1,3 @@
import {Model} from 'ember-cli-mirage';
import {Model} from 'miragejs';
export default Model.extend({});

View file

@ -1,4 +1,4 @@
import {Model} from 'ember-cli-mirage';
import {Model} from 'miragejs';
export default Model.extend({
});

View file

@ -1,4 +1,4 @@
import {Model, hasMany} from 'ember-cli-mirage';
import {Model, hasMany} from 'miragejs';
export default Model.extend({
posts: hasMany()

View file

@ -1,4 +1,4 @@
import {Model} from 'ember-cli-mirage';
import {Model} from 'miragejs';
export default Model.extend({
});

View file

@ -1,4 +1,4 @@
import {Model, hasMany} from 'ember-cli-mirage';
import {Model, hasMany} from 'miragejs';
export default Model.extend({
// used by the serializer to determine whether

View file

@ -1,4 +1,4 @@
import {Model, belongsTo} from 'ember-cli-mirage';
import {Model, belongsTo} from 'miragejs';
export default Model.extend({
integration: belongsTo()

View file

@ -1,5 +1,5 @@
import {Collection, RestSerializer} from 'ember-cli-mirage';
import {pluralize} from 'ember-cli-mirage/utils/inflector';
import {Collection, RestSerializer} from 'miragejs';
import {pluralize} from 'ember-inflector';
import {underscore} from '@ember/string';
export default RestSerializer.extend({

View file

@ -1,5 +1,5 @@
import BaseSerializer from './application';
import {RestSerializer} from 'ember-cli-mirage';
import {RestSerializer} from 'miragejs';
export default BaseSerializer.extend({
embed: true,

View file

@ -1,5 +1,5 @@
/* eslint-disable max-statements-per-line */
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {isArray} from '@ember/array';
export function paginatedResponse(modelName) {

View file

@ -135,6 +135,7 @@
"markdown-it-lazy-headers": "0.1.3",
"markdown-it-mark": "3.0.1",
"matchdep": "2.0.0",
"miragejs": "0.1.43",
"normalize.css": "3.0.3",
"papaparse": "5.3.1",
"postcss-color-mod-function": "3.0.3",

View file

@ -1,5 +1,5 @@
import windowProxy from 'ghost-admin/utils/window-proxy';
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {afterEach, beforeEach, describe, it} from 'mocha';
import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support';
import {click, currentRouteName, currentURL, fillIn, findAll, visit} from '@ember/test-helpers';

View file

@ -1,7 +1,7 @@
import Mirage from 'ember-cli-mirage';
import ctrlOrCmd from 'ghost-admin/utils/ctrl-or-cmd';
import moment from 'moment';
import sinon from 'sinon';
import {Response} from 'miragejs';
import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support';
import {beforeEach, describe, it} from 'mocha';
import {blur, click, currentRouteName, currentURL, fillIn, find, findAll, triggerEvent} from '@ember/test-helpers';
@ -433,7 +433,7 @@ describe('Acceptance: Editor', function () {
it('handles validation errors when scheduling', async function () {
this.server.put('/posts/:id/', function () {
return new Mirage.Response(422, {}, {
return new Response(422, {}, {
errors: [{
type: 'ValidationError',
message: 'Error test'

View file

@ -1,4 +1,4 @@
import Mirage from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {authenticateSession} from 'ember-simple-auth/test-support';
import {beforeEach, describe, it} from 'mocha';
import {click, currentRouteName, fillIn, find, findAll, visit} from '@ember/test-helpers';
@ -8,7 +8,7 @@ import {setupMirage} from 'ember-cli-mirage/test-support';
import {versionMismatchResponse} from 'ghost-admin/mirage/utils';
let htmlErrorResponse = function () {
return new Mirage.Response(
return new Response(
504,
{'Content-Type': 'text/html'},
'<!DOCTYPE html><head><title>Server Error</title></head><body>504 Gateway Timeout</body></html>'

View file

@ -1,4 +1,4 @@
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {authenticateSession} from 'ember-simple-auth/test-support';
import {click, currentURL, find, findAll} from '@ember/test-helpers';
import {expect} from 'chai';

View file

@ -1,5 +1,5 @@
import Mirage from 'ember-cli-mirage';
import ctrlOrCmd from 'ghost-admin/utils/ctrl-or-cmd';
import {Response} from 'miragejs';
import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support';
import {beforeEach, describe, it} from 'mocha';
import {blur, click, currentURL, fillIn, find, findAll, triggerEvent} from '@ember/test-helpers';
@ -95,7 +95,7 @@ describe('Acceptance: Settings - Integrations - Slack', function () {
.to.not.exist;
this.server.put('/settings/', function () {
return new Mirage.Response(422, {}, {
return new Response(422, {}, {
errors: [
{
type: 'ValidationError',

View file

@ -1,5 +1,5 @@
import windowProxy from 'ghost-admin/utils/window-proxy';
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {afterEach, beforeEach, describe, it} from 'mocha';
import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support';
import {blur, click, currentRouteName, currentURL, fillIn, find, findAll, settled} from '@ember/test-helpers';

View file

@ -1,5 +1,5 @@
import moment from 'moment';
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support';
import {beforeEach, describe, it} from 'mocha';
import {blur, click, currentURL, fillIn, find, findAll} from '@ember/test-helpers';

View file

@ -1,4 +1,4 @@
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support';
import {
beforeEach,

View file

@ -1,7 +1,7 @@
import ctrlOrCmd from 'ghost-admin/utils/ctrl-or-cmd';
import moment from 'moment';
import windowProxy from 'ghost-admin/utils/window-proxy';
import {Response} from 'ember-cli-mirage';
import {Response} from 'miragejs';
import {afterEach, beforeEach, describe, it} from 'mocha';
import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support';
import {

View file

@ -11388,7 +11388,7 @@ minipass@^2.2.0:
safe-buffer "^5.1.2"
yallist "^3.0.0"
miragejs@^0.1.43:
miragejs@0.1.43, miragejs@^0.1.43:
version "0.1.43"
resolved "https://registry.yarnpkg.com/miragejs/-/miragejs-0.1.43.tgz#47a8546b9e3489f806073e681f380ccfe13d757d"
integrity sha512-BhkyxssOZ2i4JqRjWpRnUQu9AFAKHyft8dJbqsg/N64+gCn2vw6vRteMpTKXllLjCPOA9Os8PhGRVXlXs4Ojhw==