@bagaar/ember-graphql-mocking 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,24 +1,24 @@
1
1
 
2
+ ## v0.11.0 (2024-03-06)
2
3
 
4
+ #### :boom: Breaking Change
5
+ * [#196](https://github.com/Bagaar/ember-graphql-mocking/pull/196) Convert to v2 addon ([@bertdeblock](https://github.com/bertdeblock))
3
6
 
4
-
5
-
6
-
7
-
8
-
7
+ #### Committers: 1
8
+ - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
9
9
 
10
10
  ## v0.10.0 (2024-02-08)
11
11
 
12
12
  #### :boom: Breaking Change
13
- * [#195](https://github.com/Bagaar/ember-graphql-mocking/pull/195) Remove automatic inclusion/exclusion of msw's worker file ([@bertdeblock](https://github.com/bertdeblock))
14
- * [#194](https://github.com/Bagaar/ember-graphql-mocking/pull/194) Convert to TS ([@bertdeblock](https://github.com/bertdeblock))
15
- * [#193](https://github.com/Bagaar/ember-graphql-mocking/pull/193) Don't leak msw `worker.start` return value ([@bertdeblock](https://github.com/bertdeblock))
13
+ * [#195](https://github.com/bagaar/ember-graphql-mocking/pull/195) Remove automatic inclusion/exclusion of msw's worker file ([@bertdeblock](https://github.com/bertdeblock))
14
+ * [#194](https://github.com/bagaar/ember-graphql-mocking/pull/194) Convert to TS ([@bertdeblock](https://github.com/bertdeblock))
15
+ * [#193](https://github.com/bagaar/ember-graphql-mocking/pull/193) Don't leak msw `worker.start` return value ([@bertdeblock](https://github.com/bertdeblock))
16
16
 
17
17
  #### :rocket: Enhancement
18
- * [#194](https://github.com/Bagaar/ember-graphql-mocking/pull/194) Convert to TS ([@bertdeblock](https://github.com/bertdeblock))
18
+ * [#194](https://github.com/bagaar/ember-graphql-mocking/pull/194) Convert to TS ([@bertdeblock](https://github.com/bertdeblock))
19
19
 
20
20
  #### :bug: Bug Fix
21
- * [#193](https://github.com/Bagaar/ember-graphql-mocking/pull/193) Don't leak msw `worker.start` return value ([@bertdeblock](https://github.com/bertdeblock))
21
+ * [#193](https://github.com/bagaar/ember-graphql-mocking/pull/193) Don't leak msw `worker.start` return value ([@bertdeblock](https://github.com/bertdeblock))
22
22
 
23
23
  #### Committers: 1
24
24
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
@@ -26,16 +26,16 @@
26
26
  ## v0.9.0 (2023-11-27)
27
27
 
28
28
  #### :boom: Breaking Change
29
- * [#191](https://github.com/Bagaar/ember-graphql-mocking/pull/191) Support MSW v2 ([@bertdeblock](https://github.com/bertdeblock))
30
- * [#189](https://github.com/Bagaar/ember-graphql-mocking/pull/189) Drop support for Ember v4.4 ([@bertdeblock](https://github.com/bertdeblock))
31
- * [#177](https://github.com/Bagaar/ember-graphql-mocking/pull/177) Drop support for Node.js v16 ([@bertdeblock](https://github.com/bertdeblock))
29
+ * [#191](https://github.com/bagaar/ember-graphql-mocking/pull/191) Support MSW v2 ([@bertdeblock](https://github.com/bertdeblock))
30
+ * [#189](https://github.com/bagaar/ember-graphql-mocking/pull/189) Drop support for Ember v4.4 ([@bertdeblock](https://github.com/bertdeblock))
31
+ * [#177](https://github.com/bagaar/ember-graphql-mocking/pull/177) Drop support for Node.js v16 ([@bertdeblock](https://github.com/bertdeblock))
32
32
 
33
33
  #### :rocket: Enhancement
34
- * [#191](https://github.com/Bagaar/ember-graphql-mocking/pull/191) Support MSW v2 ([@bertdeblock](https://github.com/bertdeblock))
34
+ * [#191](https://github.com/bagaar/ember-graphql-mocking/pull/191) Support MSW v2 ([@bertdeblock](https://github.com/bertdeblock))
35
35
 
36
36
  #### :house: Internal
37
- * [#176](https://github.com/Bagaar/ember-graphql-mocking/pull/176) Update dependencies ([@bertdeblock](https://github.com/bertdeblock))
38
- * [#175](https://github.com/Bagaar/ember-graphql-mocking/pull/175) Update to Ember v5.4 ([@bertdeblock](https://github.com/bertdeblock))
37
+ * [#176](https://github.com/bagaar/ember-graphql-mocking/pull/176) Update dependencies ([@bertdeblock](https://github.com/bertdeblock))
38
+ * [#175](https://github.com/bagaar/ember-graphql-mocking/pull/175) Update to Ember v5.4 ([@bertdeblock](https://github.com/bertdeblock))
39
39
 
40
40
  #### Committers: 1
41
41
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
@@ -43,7 +43,7 @@
43
43
  ## v0.8.0 (2023-07-06)
44
44
 
45
45
  #### :boom: Breaking Change
46
- * [#143](https://github.com/Bagaar/ember-graphql-mocking/pull/143) Drop support for Ember versions below v4.4 and Node v14 ([@bertdeblock](https://github.com/bertdeblock))
46
+ * [#143](https://github.com/bagaar/ember-graphql-mocking/pull/143) Drop support for Ember versions below v4.4 and Node v14 ([@bertdeblock](https://github.com/bertdeblock))
47
47
 
48
48
  #### Committers: 1
49
49
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
@@ -51,14 +51,14 @@
51
51
  ## v0.7.0 (2023-02-22)
52
52
 
53
53
  #### :boom: Breaking Change
54
- * [#104](https://github.com/Bagaar/ember-graphql-mocking/pull/104) Update `msw` to v1 and make it a peer dependency ([@gvdp](https://github.com/gvdp))
54
+ * [#104](https://github.com/bagaar/ember-graphql-mocking/pull/104) Update `msw` to v1 and make it a peer dependency ([@gvdp](https://github.com/gvdp))
55
55
 
56
56
  #### :rocket: Enhancement
57
- * [#104](https://github.com/Bagaar/ember-graphql-mocking/pull/104) Update `msw` to v1 and make it a peer dependency ([@gvdp](https://github.com/gvdp))
58
- * [#100](https://github.com/Bagaar/ember-graphql-mocking/pull/100) Speed up requiring `index.js` file ([@bertdeblock](https://github.com/bertdeblock))
57
+ * [#104](https://github.com/bagaar/ember-graphql-mocking/pull/104) Update `msw` to v1 and make it a peer dependency ([@gvdp](https://github.com/gvdp))
58
+ * [#100](https://github.com/bagaar/ember-graphql-mocking/pull/100) Speed up requiring `index.js` file ([@bertdeblock](https://github.com/bertdeblock))
59
59
 
60
60
  #### :memo: Documentation
61
- * [#106](https://github.com/Bagaar/ember-graphql-mocking/pull/106) Update compatibility and installation section ([@bertdeblock](https://github.com/bertdeblock))
61
+ * [#106](https://github.com/bagaar/ember-graphql-mocking/pull/106) Update compatibility and installation section ([@bertdeblock](https://github.com/bertdeblock))
62
62
 
63
63
  #### Committers: 2
64
64
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
@@ -67,12 +67,12 @@
67
67
  ## v0.6.0 (2022-09-05)
68
68
 
69
69
  #### :boom: Breaking Change
70
- * [#38](https://github.com/Bagaar/ember-graphql-mocking/pull/38) Make `setupEmberGraphqlMocking` async ([@bertdeblock](https://github.com/bertdeblock))
71
- * [#37](https://github.com/Bagaar/ember-graphql-mocking/pull/37) Update `graphql` and `msw` dependencies ([@bertdeblock](https://github.com/bertdeblock))
72
- * [#34](https://github.com/Bagaar/ember-graphql-mocking/pull/34) Update `msw` to v0.43.0 ([@bertdeblock](https://github.com/bertdeblock))
70
+ * [#38](https://github.com/bagaar/ember-graphql-mocking/pull/38) Make `setupEmberGraphqlMocking` async ([@bertdeblock](https://github.com/bertdeblock))
71
+ * [#37](https://github.com/bagaar/ember-graphql-mocking/pull/37) Update `graphql` and `msw` dependencies ([@bertdeblock](https://github.com/bertdeblock))
72
+ * [#34](https://github.com/bagaar/ember-graphql-mocking/pull/34) Update `msw` to v0.43.0 ([@bertdeblock](https://github.com/bertdeblock))
73
73
 
74
74
  #### :bug: Bug Fix
75
- * [#38](https://github.com/Bagaar/ember-graphql-mocking/pull/38) Make `setupEmberGraphqlMocking` async ([@bertdeblock](https://github.com/bertdeblock))
75
+ * [#38](https://github.com/bagaar/ember-graphql-mocking/pull/38) Make `setupEmberGraphqlMocking` async ([@bertdeblock](https://github.com/bertdeblock))
76
76
 
77
77
  #### Committers: 1
78
78
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
@@ -80,9 +80,9 @@
80
80
  ## v0.5.0 (2022-06-24)
81
81
 
82
82
  #### :boom: Breaking Change
83
- * [#29](https://github.com/Bagaar/ember-graphql-mocking/pull/29) Update `msw` to v0.42.3 ([@bertdeblock](https://github.com/bertdeblock))
84
- * [#27](https://github.com/Bagaar/ember-graphql-mocking/pull/27) Drop support for Ember v3.24 ([@bertdeblock](https://github.com/bertdeblock))
85
- * [#26](https://github.com/Bagaar/ember-graphql-mocking/pull/26) Drop support for Node v12 ([@bertdeblock](https://github.com/bertdeblock))
83
+ * [#29](https://github.com/bagaar/ember-graphql-mocking/pull/29) Update `msw` to v0.42.3 ([@bertdeblock](https://github.com/bertdeblock))
84
+ * [#27](https://github.com/bagaar/ember-graphql-mocking/pull/27) Drop support for Ember v3.24 ([@bertdeblock](https://github.com/bertdeblock))
85
+ * [#26](https://github.com/bagaar/ember-graphql-mocking/pull/26) Drop support for Node v12 ([@bertdeblock](https://github.com/bertdeblock))
86
86
 
87
87
  #### Committers: 1
88
88
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
@@ -90,13 +90,13 @@
90
90
  ## v0.4.1 (2022-02-09)
91
91
 
92
92
  #### :bug: Bug Fix
93
- * [#24](https://github.com/Bagaar/ember-graphql-mocking/pull/24) Don't automatically stop the worker when all tests are done (fix compat with `ember-cli-code-coverage@v1`) ([@bertdeblock](https://github.com/bertdeblock))
93
+ * [#24](https://github.com/bagaar/ember-graphql-mocking/pull/24) Don't automatically stop the worker when all tests are done (fix compat with `ember-cli-code-coverage@v1`) ([@bertdeblock](https://github.com/bertdeblock))
94
94
 
95
95
  #### :memo: Documentation
96
- * [#19](https://github.com/Bagaar/ember-graphql-mocking/pull/19) Fix install command in docs ([@bertdeblock](https://github.com/bertdeblock))
96
+ * [#19](https://github.com/bagaar/ember-graphql-mocking/pull/19) Fix install command in docs ([@bertdeblock](https://github.com/bertdeblock))
97
97
 
98
98
  #### :house: Internal
99
- * [#22](https://github.com/Bagaar/ember-graphql-mocking/pull/22) Don't publish `.husky` folder and `RELEASE.md` file ([@bertdeblock](https://github.com/bertdeblock))
99
+ * [#22](https://github.com/bagaar/ember-graphql-mocking/pull/22) Don't publish `.husky` folder and `RELEASE.md` file ([@bertdeblock](https://github.com/bertdeblock))
100
100
 
101
101
  #### Committers: 1
102
102
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
@@ -104,7 +104,7 @@
104
104
  ## v0.4.0 (2022-02-03)
105
105
 
106
106
  #### :rocket: Enhancement
107
- * [#18](https://github.com/Bagaar/ember-graphql-mocking/pull/18) Make `msw` start options configurable ([@bertdeblock](https://github.com/bertdeblock))
107
+ * [#18](https://github.com/bagaar/ember-graphql-mocking/pull/18) Make `msw` start options configurable ([@bertdeblock](https://github.com/bertdeblock))
108
108
 
109
109
  #### Committers: 1
110
110
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
@@ -112,7 +112,7 @@
112
112
  ## v0.3.2 (2022-02-02)
113
113
 
114
114
  #### :house: Internal
115
- * [#17](https://github.com/Bagaar/ember-graphql-mocking/pull/17) Fix release commit message ([@bertdeblock](https://github.com/bertdeblock))
115
+ * [#17](https://github.com/bagaar/ember-graphql-mocking/pull/17) Fix release commit message ([@bertdeblock](https://github.com/bertdeblock))
116
116
 
117
117
  #### Committers: 1
118
118
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
@@ -121,7 +121,7 @@
121
121
  ## v0.3.1 (2022-02-02)
122
122
 
123
123
  #### :house: Internal
124
- * [#16](https://github.com/Bagaar/ember-graphql-mocking/pull/16) Update publish config ([@bertdeblock](https://github.com/bertdeblock))
124
+ * [#16](https://github.com/bagaar/ember-graphql-mocking/pull/16) Update publish config ([@bertdeblock](https://github.com/bertdeblock))
125
125
 
126
126
  #### Committers: 1
127
127
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
@@ -130,8 +130,7 @@
130
130
  ## v0.2.2 (2022-02-02)
131
131
 
132
132
  #### :house: Internal
133
- * [#14](https://github.com/Bagaar/ember-graphql-mocking/pull/14) Release setup ([@bertdeblock](https://github.com/bertdeblock))
133
+ * [#14](https://github.com/bagaar/ember-graphql-mocking/pull/14) Release setup ([@bertdeblock](https://github.com/bertdeblock))
134
134
 
135
135
  #### Committers: 1
136
136
  - Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
137
-
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021
3
+ Copyright (c) Bagaar NV
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # Ember GraphQL Mocking
1
+ # @bagaar/ember-graphql-mocking
2
2
 
3
- [![CI](https://github.com/Bagaar/ember-graphql-mocking/workflows/CI/badge.svg)](https://github.com/Bagaar/ember-graphql-mocking/actions?query=workflow%3ACI)
3
+ [![CI](https://github.com/bagaar/ember-graphql-mocking/workflows/CI/badge.svg)](https://github.com/bagaar/ember-graphql-mocking/actions?query=workflow%3ACI)
4
4
  [![NPM Version](https://badge.fury.io/js/%40bagaar%2Fember-graphql-mocking.svg)](https://badge.fury.io/js/%40bagaar%2Fember-graphql-mocking)
5
5
 
6
6
  Ember addon for mocking GraphQL requests using [Mock Service Worker (MSW)](https://github.com/mswjs/msw).
@@ -8,8 +8,7 @@ Ember addon for mocking GraphQL requests using [Mock Service Worker (MSW)](https
8
8
  ## Compatibility
9
9
 
10
10
  - Ember.js v4.8 or above
11
- - Ember CLI v4.8 or above
12
- - Node.js v18 or above
11
+ - Embroider or ember-auto-import v2
13
12
  - MSW v2 or above
14
13
 
15
14
  ## Installation
@@ -121,7 +120,7 @@ module('Acceptance | ember graphql mocking', function (hooks) {
121
120
  > Calling `mockResolvers` multiple times within a single test, will simply merge all resolvers into a single root.
122
121
 
123
122
  > [!NOTE]
124
- > Working versions of these code examples can be found in [this addon's `tests` folder](./tests/).
123
+ > Working versions of these code examples can be found in [this addon's test app](./test-app/).
125
124
 
126
125
  ## Contributing
127
126
 
package/addon-main.cjs ADDED
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ const { addonV1Shim } = require('@embroider/addon-shim');
4
+ module.exports = addonV1Shim(__dirname);
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export default interface Registry {
2
+ }
3
+ //# sourceMappingURL=template-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-registry.d.ts","sourceRoot":"","sources":["../src/template-registry.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,WAAW,QAAQ;CAEhC"}
@@ -1,11 +1,15 @@
1
- import { type setupApplicationTest } from 'ember-qunit';
2
1
  import { type DocumentNode } from 'graphql';
3
2
  import { type SetupWorker, type StartOptions } from 'msw/browser';
4
3
  interface Options {
5
4
  mswStartOptions: StartOptions;
6
5
  }
6
+ type Hooks = {
7
+ after(fn: () => void | Promise<void>): void;
8
+ afterEach(fn: () => void | Promise<void>): void;
9
+ before(fn: () => void | Promise<void>): void;
10
+ };
7
11
  export declare function setupEmberGraphqlMocking(schemaDocument: DocumentNode, providedOptions?: Options): Promise<void>;
8
- export declare function setupGraphqlTest(hooks: Parameters<typeof setupApplicationTest>[0]): void;
12
+ export declare function setupGraphqlTest(hooks: Hooks): void;
9
13
  export declare function mockResolvers(resolvers: object): void;
10
14
  export declare function getWorker(): SetupWorker;
11
15
  export declare function destroyWorker(): void;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-support/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAGrE,OAAO,EAAe,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE/E,UAAU,OAAO;IACf,eAAe,EAAE,YAAY,CAAC;CAC/B;AAGD,KAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAChD,MAAM,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC9C,CAAC;AAkBF,wBAAsB,wBAAwB,CAC5C,cAAc,EAAE,YAAY,EAC5B,eAAe,CAAC,EAAE,OAAO,iBAQ1B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,QAe5C;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,QAO9C;AAED,wBAAgB,SAAS,gBAOxB;AAED,wBAAgB,aAAa,SAS5B"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=template-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-registry.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,94 @@
1
+ import { assert } from '@ember/debug';
2
+ import { buildASTSchema, graphql as graphql$1 } from 'graphql';
3
+ import merge from 'lodash.merge';
4
+ import { graphql, HttpResponse } from 'msw';
5
+ import { setupWorker } from 'msw/browser';
6
+
7
+ const IS_TESTEM = Boolean(window.Testem);
8
+ const DEFAULT_OPTIONS = {
9
+ mswStartOptions: {
10
+ quiet: IS_TESTEM,
11
+ serviceWorker: {
12
+ options: {
13
+ scope: IS_TESTEM ? window.location.pathname : '/tests'
14
+ }
15
+ }
16
+ }
17
+ };
18
+ let isSetupGraphqlTestCalled = false;
19
+ let root = null;
20
+ let worker = null;
21
+ async function setupEmberGraphqlMocking(schemaDocument, providedOptions) {
22
+ const options = merge({}, DEFAULT_OPTIONS, providedOptions);
23
+ createWorker();
24
+ createGraphqlOperationHandler(schemaDocument);
25
+ await startWorker(options.mswStartOptions);
26
+ }
27
+ function setupGraphqlTest(hooks) {
28
+ assert('Cannot call `setupGraphqlTest` without providing the `hooks` argument. Please make sure to call `setupGraphqlTest(hooks);`.', hooks);
29
+ hooks.before(() => {
30
+ isSetupGraphqlTestCalled = true;
31
+ });
32
+ hooks.after(() => {
33
+ isSetupGraphqlTestCalled = false;
34
+ });
35
+ hooks.afterEach(clearRoot);
36
+ }
37
+ function mockResolvers(resolvers) {
38
+ assert('Cannot call `mockResolvers` before calling `setupGraphqlTest`. Please make sure to call `setupGraphqlTest(hooks);`.', isSetupGraphqlTestCalled);
39
+ root = {
40
+ ...root,
41
+ ...resolvers
42
+ };
43
+ }
44
+ function getWorker() {
45
+ assert('Cannot call `getWorker` before calling `setupEmberGraphqlMocking`. Please make sure to call `setupEmberGraphqlMocking(yourSchemaDocument[, yourProvidedOptions]);`.', worker);
46
+ return worker;
47
+ }
48
+ function destroyWorker() {
49
+ assert('Cannot call `destroyWorker` before calling `setupEmberGraphqlMocking`. Please make sure to call `setupEmberGraphqlMocking(yourSchemaDocument[, yourProvidedOptions]);`.', worker);
50
+ worker.stop();
51
+ worker = null;
52
+ }
53
+ function createWorker() {
54
+ worker = setupWorker();
55
+ }
56
+ function createGraphqlOperationHandler(schemaDocument) {
57
+ assert('[BUG] `worker` is not set.', worker);
58
+ const schema = buildASTSchema(schemaDocument);
59
+ const graphqlOperation = graphql.operation(async ({
60
+ request
61
+ }) => {
62
+ const {
63
+ query,
64
+ variables
65
+ } = (await request.json()) || {
66
+ query: '',
67
+ variables: {}
68
+ };
69
+ const {
70
+ data,
71
+ errors
72
+ } = await graphql$1({
73
+ rootValue: root,
74
+ schema,
75
+ source: query,
76
+ variableValues: variables
77
+ });
78
+ return HttpResponse.json({
79
+ data,
80
+ errors
81
+ });
82
+ });
83
+ worker.use(graphqlOperation);
84
+ }
85
+ async function startWorker(mswStartOptions) {
86
+ assert('[BUG] `worker` is not set.', worker);
87
+ await worker.start(mswStartOptions);
88
+ }
89
+ function clearRoot() {
90
+ root = null;
91
+ }
92
+
93
+ export { destroyWorker, getWorker, mockResolvers, setupEmberGraphqlMocking, setupGraphqlTest };
94
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/test-support/index.ts"],"sourcesContent":["import { assert } from '@ember/debug';\nimport { buildASTSchema, graphql, type DocumentNode } from 'graphql';\nimport merge from 'lodash.merge';\nimport { graphql as mswGraphql, HttpResponse } from 'msw';\nimport { setupWorker, type SetupWorker, type StartOptions } from 'msw/browser';\n\ninterface Options {\n mswStartOptions: StartOptions;\n}\n\ntype WindowWithTestem = typeof window & { Testem: unknown };\ntype Hooks = {\n after(fn: () => void | Promise<void>): void;\n afterEach(fn: () => void | Promise<void>): void;\n before(fn: () => void | Promise<void>): void;\n};\n\nconst IS_TESTEM = Boolean((window as WindowWithTestem).Testem);\nconst DEFAULT_OPTIONS: Options = {\n mswStartOptions: {\n quiet: IS_TESTEM,\n serviceWorker: {\n options: {\n scope: IS_TESTEM ? window.location.pathname : '/tests',\n },\n },\n },\n};\n\nlet isSetupGraphqlTestCalled = false;\nlet root: object | null = null;\nlet worker: SetupWorker | null = null;\n\nexport async function setupEmberGraphqlMocking(\n schemaDocument: DocumentNode,\n providedOptions?: Options,\n) {\n const options = merge({}, DEFAULT_OPTIONS, providedOptions);\n\n createWorker();\n createGraphqlOperationHandler(schemaDocument);\n\n await startWorker(options.mswStartOptions);\n}\n\nexport function setupGraphqlTest(hooks: Hooks) {\n assert(\n 'Cannot call `setupGraphqlTest` without providing the `hooks` argument. Please make sure to call `setupGraphqlTest(hooks);`.',\n hooks,\n );\n\n hooks.before(() => {\n isSetupGraphqlTestCalled = true;\n });\n\n hooks.after(() => {\n isSetupGraphqlTestCalled = false;\n });\n\n hooks.afterEach(clearRoot);\n}\n\nexport function mockResolvers(resolvers: object) {\n assert(\n 'Cannot call `mockResolvers` before calling `setupGraphqlTest`. Please make sure to call `setupGraphqlTest(hooks);`.',\n isSetupGraphqlTestCalled,\n );\n\n root = { ...root, ...resolvers };\n}\n\nexport function getWorker() {\n assert(\n 'Cannot call `getWorker` before calling `setupEmberGraphqlMocking`. Please make sure to call `setupEmberGraphqlMocking(yourSchemaDocument[, yourProvidedOptions]);`.',\n worker,\n );\n\n return worker;\n}\n\nexport function destroyWorker() {\n assert(\n 'Cannot call `destroyWorker` before calling `setupEmberGraphqlMocking`. Please make sure to call `setupEmberGraphqlMocking(yourSchemaDocument[, yourProvidedOptions]);`.',\n worker,\n );\n\n worker.stop();\n\n worker = null;\n}\n\nfunction createWorker() {\n worker = setupWorker();\n}\n\nfunction createGraphqlOperationHandler(schemaDocument: DocumentNode) {\n assert('[BUG] `worker` is not set.', worker);\n\n const schema = buildASTSchema(schemaDocument);\n const graphqlOperation = mswGraphql.operation(async ({ request }) => {\n const { query, variables } = (await request.json()) || {\n query: '',\n variables: {},\n };\n\n const { data, errors } = await graphql({\n rootValue: root,\n schema,\n source: query,\n variableValues: variables,\n });\n\n return HttpResponse.json({ data, errors });\n });\n\n worker.use(graphqlOperation);\n}\n\nasync function startWorker(mswStartOptions: Options['mswStartOptions']) {\n assert('[BUG] `worker` is not set.', worker);\n\n await worker.start(mswStartOptions);\n}\n\nfunction clearRoot() {\n root = null;\n}\n"],"names":["IS_TESTEM","Boolean","window","Testem","DEFAULT_OPTIONS","mswStartOptions","quiet","serviceWorker","options","scope","location","pathname","isSetupGraphqlTestCalled","root","worker","setupEmberGraphqlMocking","schemaDocument","providedOptions","merge","createWorker","createGraphqlOperationHandler","startWorker","setupGraphqlTest","hooks","assert","before","after","afterEach","clearRoot","mockResolvers","resolvers","getWorker","destroyWorker","stop","setupWorker","schema","buildASTSchema","graphqlOperation","mswGraphql","operation","request","query","variables","json","data","errors","graphql","rootValue","source","variableValues","HttpResponse","use","start"],"mappings":"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"}
package/package.json CHANGED
@@ -1,152 +1,137 @@
1
1
  {
2
2
  "name": "@bagaar/ember-graphql-mocking",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Ember addon for mocking GraphQL requests using Mock Service Worker (MSW).",
5
5
  "keywords": [
6
- "ember-addon"
6
+ "ember-addon",
7
+ "graphql",
8
+ "msw"
7
9
  ],
8
- "repository": "https://github.com/Bagaar/ember-graphql-mocking",
10
+ "repository": "https://github.com/bagaar/ember-graphql-mocking",
9
11
  "license": "MIT",
10
12
  "author": "Bagaar",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./declarations/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "./*": {
19
+ "types": "./declarations/*.d.ts",
20
+ "default": "./dist/*.js"
21
+ },
22
+ "./addon-main.js": "./addon-main.cjs",
23
+ "./test-support": {
24
+ "types": "./declarations/test-support/index.d.ts",
25
+ "default": "./dist/test-support/index.js"
26
+ }
27
+ },
11
28
  "typesVersions": {
12
29
  "*": {
13
30
  "test-support": [
14
- "declarations/addon-test-support/index.d.ts"
15
- ],
16
- "test-support/*": [
17
- "declarations/addon-test-support/*",
18
- "declarations/addon-test-support/*/index.d.ts"
31
+ "declarations/test-support/index.d.ts"
19
32
  ],
20
33
  "*": [
21
- "declarations/addon/*",
22
- "declarations/addon/*/index.d.ts"
34
+ "declarations/*"
23
35
  ]
24
36
  }
25
37
  },
26
- "directories": {
27
- "doc": "doc",
28
- "test": "tests"
29
- },
38
+ "files": [
39
+ "addon-main.cjs",
40
+ "CHANGELOG.md",
41
+ "declarations",
42
+ "dist"
43
+ ],
30
44
  "scripts": {
31
- "build": "ember build --environment=production",
32
- "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
33
- "lint:css": "stylelint \"**/*.css\"",
34
- "lint:css:fix": "concurrently \"npm:lint:css -- --fix\"",
35
- "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
36
- "lint:hbs": "ember-template-lint .",
37
- "lint:hbs:fix": "ember-template-lint . --fix",
45
+ "build": "concurrently 'npm:build:*'",
46
+ "build:js": "rollup --config",
47
+ "build:types": "glint --declaration",
48
+ "lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
49
+ "lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
50
+ "lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
51
+ "lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
38
52
  "lint:js": "eslint . --cache",
39
53
  "lint:js:fix": "eslint . --fix",
40
- "lint:types": "tsc --noEmit",
41
- "prepack": "tsc --project tsconfig.declarations.json",
42
- "postpack": "rimraf declarations",
43
- "prepare": "husky install",
44
- "start": "ember serve",
45
- "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
46
- "test:ember": "ember test",
47
- "test:ember-compatibility": "ember try:each"
48
- },
49
- "commitlint": {
50
- "extends": [
51
- "@commitlint/config-conventional"
52
- ]
54
+ "lint:types": "glint",
55
+ "prepack": "rollup --config",
56
+ "start": "concurrently 'npm:start:*'",
57
+ "start:js": "rollup --config --watch --no-watch.clearScreen",
58
+ "start:types": "glint --declaration --watch",
59
+ "test": "echo 'A v2 addon does not have tests, run tests in test-app'"
53
60
  },
54
61
  "dependencies": {
55
- "@babel/core": "^7.23.3",
56
- "ember-auto-import": "^2.7.0",
57
- "ember-cli-babel": "^8.2.0",
62
+ "@embroider/addon-shim": "^1.8.7",
63
+ "decorator-transforms": "^1.0.1",
58
64
  "lodash.merge": "^4.6.2"
59
65
  },
60
66
  "devDependencies": {
61
- "@apollo/client": "^3.9.4",
62
- "@commitlint/cli": "^18.4.3",
63
- "@commitlint/config-conventional": "^18.4.3",
64
- "@ember/optional-features": "^2.0.0",
65
- "@ember/test-helpers": "^3.2.1",
66
- "@embroider/test-setup": "^3.0.3",
67
- "@glimmer/component": "^1.1.2",
68
- "@glimmer/tracking": "^1.1.2",
67
+ "@babel/core": "^7.23.6",
68
+ "@babel/plugin-transform-typescript": "^7.23.6",
69
+ "@babel/runtime": "^7.17.0",
70
+ "@embroider/addon-dev": "^4.1.0",
71
+ "@glint/core": "^1.2.1",
72
+ "@glint/environment-ember-loose": "^1.2.1",
73
+ "@glint/environment-ember-template-imports": "^1.2.1",
74
+ "@glint/template": "^1.2.1",
69
75
  "@release-it-plugins/lerna-changelog": "^6.0.0",
70
- "@tsconfig/ember": "^3.0.3",
76
+ "@rollup/plugin-babel": "^6.0.4",
77
+ "@tsconfig/ember": "^3.0.2",
71
78
  "@types/lodash.merge": "^4.6.9",
72
- "@types/qunit": "^2.19.10",
73
- "@types/rsvp": "^4.0.9",
74
- "@typescript-eslint/eslint-plugin": "^6.19.1",
75
- "@typescript-eslint/parser": "^6.19.1",
76
- "broccoli-asset-rev": "^3.0.0",
79
+ "@typescript-eslint/eslint-plugin": "^6.14.0",
80
+ "@typescript-eslint/parser": "^6.14.0",
81
+ "babel-plugin-ember-template-compilation": "^2.2.1",
77
82
  "concurrently": "^8.2.2",
78
- "ember-cli": "~5.6.0",
79
- "ember-cli-clean-css": "^3.0.0",
80
- "ember-cli-dependency-checker": "^3.3.2",
81
- "ember-cli-htmlbars": "^6.3.0",
82
- "ember-cli-inject-live-reload": "^2.1.0",
83
- "ember-cli-sri": "^2.1.1",
84
- "ember-cli-terser": "^4.0.2",
85
- "ember-load-initializers": "^2.1.2",
86
- "ember-page-title": "^8.2.0",
87
- "ember-qunit": "^8.0.2",
88
- "ember-resolver": "^11.0.1",
89
83
  "ember-source": "~5.6.0",
90
- "ember-source-channel-url": "^3.0.0",
91
84
  "ember-template-lint": "^5.13.0",
92
- "ember-try": "^3.0.0",
93
85
  "eslint": "^8.56.0",
94
86
  "eslint-config-prettier": "^9.1.0",
95
- "eslint-plugin-ember": "^12.0.0",
96
- "eslint-plugin-n": "^16.6.2",
97
- "eslint-plugin-prettier": "^5.1.3",
98
- "eslint-plugin-qunit": "^8.0.1",
87
+ "eslint-plugin-ember": "^11.12.0",
88
+ "eslint-plugin-n": "^16.4.0",
89
+ "eslint-plugin-prettier": "^5.0.1",
99
90
  "graphql": "^16.8.1",
100
- "husky": "^9.0.10",
101
- "loader.js": "^4.7.0",
102
- "msw": "^2.0.9",
103
- "prettier": "^3.2.4",
104
- "qunit": "^2.20.0",
105
- "qunit-dom": "^3.0.0",
91
+ "msw": "^2.2.2",
92
+ "prettier": "^3.1.1",
93
+ "prettier-plugin-ember-template-tag": "^1.1.0",
106
94
  "release-it": "^17.0.3",
107
- "rimraf": "^5.0.1",
108
- "stylelint": "^16.2.1",
109
- "stylelint-config-standard": "^36.0.0",
110
- "stylelint-prettier": "^5.0.0",
111
- "typescript": "^5.3.3",
112
- "webpack": "^5.89.0"
95
+ "rollup": "^4.9.1",
96
+ "rollup-plugin-copy": "^3.5.0",
97
+ "typescript": "^5.3.3"
113
98
  },
114
99
  "peerDependencies": {
115
- "ember-qunit": "^8.0.0",
116
100
  "ember-source": ">= 4.8.0",
117
- "graphql": "^16.0.0",
118
- "msw": "^2.0.0"
119
- },
120
- "engines": {
121
- "node": ">= 18"
101
+ "graphql": ">= 16.0.0",
102
+ "msw": ">= 2.0.0"
122
103
  },
123
104
  "publishConfig": {
124
- "access": "public",
125
105
  "registry": "https://registry.npmjs.org"
126
106
  },
127
107
  "ember": {
128
108
  "edition": "octane"
129
109
  },
130
110
  "ember-addon": {
131
- "configPath": "tests/dummy/config"
132
- },
133
- "msw": {
134
- "workerDirectory": "tests/dummy/public"
111
+ "version": 2,
112
+ "type": "addon",
113
+ "main": "addon-main.cjs",
114
+ "app-js": {}
135
115
  },
136
116
  "release-it": {
137
- "plugins": {
138
- "@release-it-plugins/lerna-changelog": {
139
- "infile": "CHANGELOG.md",
140
- "launchEditor": false
141
- }
142
- },
143
117
  "git": {
144
- "commitMessage": "chore(release): ${version}",
118
+ "commitMessage": "Release v${version}",
145
119
  "tagName": "v${version}"
146
120
  },
147
121
  "github": {
148
- "release": true,
149
- "tokenRef": "GITHUB_AUTH"
122
+ "release": true
123
+ },
124
+ "hooks": {
125
+ "before:git:release": "git add ../"
126
+ },
127
+ "plugins": {
128
+ "@release-it-plugins/lerna-changelog": {
129
+ "infile": "../CHANGELOG.md",
130
+ "launchEditor": false
131
+ }
150
132
  }
133
+ },
134
+ "volta": {
135
+ "extends": "../package.json"
151
136
  }
152
137
  }
@@ -1,125 +0,0 @@
1
- import { assert } from '@ember/debug';
2
- import { type setupApplicationTest } from 'ember-qunit';
3
- import { buildASTSchema, graphql, type DocumentNode } from 'graphql';
4
- import merge from 'lodash.merge';
5
- import { graphql as mswGraphql, HttpResponse } from 'msw';
6
- import { setupWorker, type SetupWorker, type StartOptions } from 'msw/browser';
7
-
8
- interface Options {
9
- mswStartOptions: StartOptions;
10
- }
11
-
12
- type WindowWithTestem = typeof window & { Testem: unknown };
13
-
14
- const IS_TESTEM = Boolean((window as WindowWithTestem).Testem);
15
- const DEFAULT_OPTIONS: Options = {
16
- mswStartOptions: {
17
- quiet: IS_TESTEM,
18
- serviceWorker: {
19
- options: {
20
- scope: IS_TESTEM ? window.location.pathname : '/tests',
21
- },
22
- },
23
- },
24
- };
25
-
26
- let isSetupGraphqlTestCalled = false;
27
- let root: object | null = null;
28
- let worker: SetupWorker | null = null;
29
-
30
- export async function setupEmberGraphqlMocking(
31
- schemaDocument: DocumentNode,
32
- providedOptions?: Options,
33
- ) {
34
- const options = merge({}, DEFAULT_OPTIONS, providedOptions);
35
-
36
- createWorker();
37
- createGraphqlOperationHandler(schemaDocument);
38
-
39
- await startWorker(options.mswStartOptions);
40
- }
41
-
42
- export function setupGraphqlTest(
43
- hooks: Parameters<typeof setupApplicationTest>[0],
44
- ) {
45
- assert(
46
- 'Cannot call `setupGraphqlTest` without providing the `hooks` argument. Please make sure to call `setupGraphqlTest(hooks);`.',
47
- hooks,
48
- );
49
-
50
- hooks.before(() => {
51
- isSetupGraphqlTestCalled = true;
52
- });
53
-
54
- hooks.after(() => {
55
- isSetupGraphqlTestCalled = false;
56
- });
57
-
58
- hooks.afterEach(clearRoot);
59
- }
60
-
61
- export function mockResolvers(resolvers: object) {
62
- assert(
63
- 'Cannot call `mockResolvers` before calling `setupGraphqlTest`. Please make sure to call `setupGraphqlTest(hooks);`.',
64
- isSetupGraphqlTestCalled,
65
- );
66
-
67
- root = { ...root, ...resolvers };
68
- }
69
-
70
- export function getWorker() {
71
- assert(
72
- 'Cannot call `getWorker` before calling `setupEmberGraphqlMocking`. Please make sure to call `setupEmberGraphqlMocking(yourSchemaDocument[, yourProvidedOptions]);`.',
73
- worker,
74
- );
75
-
76
- return worker;
77
- }
78
-
79
- export function destroyWorker() {
80
- assert(
81
- 'Cannot call `destroyWorker` before calling `setupEmberGraphqlMocking`. Please make sure to call `setupEmberGraphqlMocking(yourSchemaDocument[, yourProvidedOptions]);`.',
82
- worker,
83
- );
84
-
85
- worker.stop();
86
-
87
- worker = null;
88
- }
89
-
90
- function createWorker() {
91
- worker = setupWorker();
92
- }
93
-
94
- function createGraphqlOperationHandler(schemaDocument: DocumentNode) {
95
- assert('[BUG] `worker` is not set.', worker);
96
-
97
- const schema = buildASTSchema(schemaDocument);
98
- const graphqlOperation = mswGraphql.operation(async ({ request }) => {
99
- const { query, variables } = (await request.json()) || {
100
- query: '',
101
- variables: {},
102
- };
103
-
104
- const { data, errors } = await graphql({
105
- rootValue: root,
106
- schema,
107
- source: query,
108
- variableValues: variables,
109
- });
110
-
111
- return HttpResponse.json({ data, errors });
112
- });
113
-
114
- worker.use(graphqlOperation);
115
- }
116
-
117
- async function startWorker(mswStartOptions: Options['mswStartOptions']) {
118
- assert('[BUG] `worker` is not set.', worker);
119
-
120
- await worker.start(mswStartOptions);
121
- }
122
-
123
- function clearRoot() {
124
- root = null;
125
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../addon-test-support/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAGrE,OAAO,EAAe,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE/E,UAAU,OAAO;IACf,eAAe,EAAE,YAAY,CAAC;CAC/B;AAoBD,wBAAsB,wBAAwB,CAC5C,cAAc,EAAE,YAAY,EAC5B,eAAe,CAAC,EAAE,OAAO,iBAQ1B;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,QAgBlD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,QAO9C;AAED,wBAAgB,SAAS,gBAOxB;AAED,wBAAgB,aAAa,SAS5B"}
package/index.js DELETED
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- name: require('./package').name,
5
-
6
- options: {
7
- 'ember-cli-babel': {
8
- enableTypeScriptTransform: true,
9
- },
10
- },
11
- };