@bagaar/ember-graphql-mocking 0.4.1 → 0.5.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 +11 -0
- package/README.md +18 -7
- package/package.json +22 -22
- package/public/mockServiceWorker.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
|
|
5
|
+
## v0.5.0 (2022-06-24)
|
|
6
|
+
|
|
7
|
+
#### :boom: Breaking Change
|
|
8
|
+
* [#29](https://github.com/Bagaar/ember-graphql-mocking/pull/29) Update `msw` to v0.42.3 ([@bertdeblock](https://github.com/bertdeblock))
|
|
9
|
+
* [#27](https://github.com/Bagaar/ember-graphql-mocking/pull/27) Drop support for Ember v3.24 ([@bertdeblock](https://github.com/bertdeblock))
|
|
10
|
+
* [#26](https://github.com/Bagaar/ember-graphql-mocking/pull/26) Drop support for Node v12 ([@bertdeblock](https://github.com/bertdeblock))
|
|
11
|
+
|
|
12
|
+
#### Committers: 1
|
|
13
|
+
- Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
|
|
14
|
+
|
|
4
15
|
## v0.4.1 (2022-02-09)
|
|
5
16
|
|
|
6
17
|
#### :bug: Bug Fix
|
package/README.md
CHANGED
|
@@ -6,13 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
Ember addon for mocking GraphQL requests using [Mock Service Worker (MSW)](https://github.com/mswjs/msw).
|
|
8
8
|
|
|
9
|
-
> :warning: Experimental mocking package used at Bagaar. You probably shouldn't use this for now.
|
|
10
|
-
|
|
11
9
|
## Compatibility
|
|
12
10
|
|
|
13
|
-
- Ember.js v3.
|
|
14
|
-
- Ember CLI v3.
|
|
15
|
-
- Node.js
|
|
11
|
+
- Ember.js v3.28 or above
|
|
12
|
+
- Ember CLI v3.28 or above
|
|
13
|
+
- Node.js v14 or above
|
|
16
14
|
|
|
17
15
|
## Installation
|
|
18
16
|
|
|
@@ -50,6 +48,17 @@ setupEmberGraphqlMocking(schema); // 3.
|
|
|
50
48
|
start();
|
|
51
49
|
```
|
|
52
50
|
|
|
51
|
+
If you want to pass along additional [start options](https://mswjs.io/docs/api/setup-worker/start#options)
|
|
52
|
+
to MSW's service worker, you can do so by defining an `mswStartOptions` object:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
setupEmberGraphqlMocking(schema, {
|
|
56
|
+
mswStartOptions: {
|
|
57
|
+
// Additional MSW start options...
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
53
62
|
### 2. Write an Acceptance Test
|
|
54
63
|
|
|
55
64
|
1. Import `mockResolvers` and `setupGraphqlTest`
|
|
@@ -60,14 +69,14 @@ start();
|
|
|
60
69
|
|
|
61
70
|
`mockResolvers` accepts an object that consists of one or more resolvers. The key must be the name of the mocked operation, the value can either be a response object _or_ a function that returns a response object.
|
|
62
71
|
|
|
63
|
-
> **NOTE:** Make sure that your operations are named in order for `@bagaar/ember-graphql-mocking` to function properly.
|
|
72
|
+
> **NOTE:** Make sure that your operations are [named](https://graphql.org/learn/queries/#operation-name) in order for `@bagaar/ember-graphql-mocking` to function properly.
|
|
64
73
|
|
|
65
74
|
```javascript
|
|
66
75
|
// tests/acceptance/my-acceptance-test.js
|
|
67
76
|
|
|
68
77
|
import { module, test } from 'qunit';
|
|
69
78
|
import { visit, currentURL } from '@ember/test-helpers';
|
|
70
|
-
import { setupApplicationTest } from '
|
|
79
|
+
import { setupApplicationTest } from 'my-app/tests/helpers';
|
|
71
80
|
import { mockResolvers, setupGraphqlTest } from '@bagaar/ember-graphql-mocking/test-support'; // 1.
|
|
72
81
|
|
|
73
82
|
module('Acceptance | ember graphql mocking', function (hooks) {
|
|
@@ -94,6 +103,8 @@ module('Acceptance | ember graphql mocking', function (hooks) {
|
|
|
94
103
|
});
|
|
95
104
|
```
|
|
96
105
|
|
|
106
|
+
> **NOTE:** Calling `mockResolvers` multiple times within a single test, will simply merge all resolvers into a single root.
|
|
107
|
+
|
|
97
108
|
💡 Working versions of these code examples can be found in [this addon's `tests` folder](./tests/).
|
|
98
109
|
|
|
99
110
|
## Contributing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagaar/ember-graphql-mocking",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Ember addon for mocking GraphQL requests using Mock Service Worker (MSW).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -34,25 +34,25 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"broccoli-funnel": "^3.0.5",
|
|
36
36
|
"broccoli-merge-trees": "^4.2.0",
|
|
37
|
-
"ember-auto-import": "^2.
|
|
37
|
+
"ember-auto-import": "^2.4.1",
|
|
38
38
|
"ember-cli-babel": "^7.26.11",
|
|
39
39
|
"graphql": "^16.3.0",
|
|
40
40
|
"lodash.merge": "^4.6.2",
|
|
41
|
-
"msw": "0.
|
|
41
|
+
"msw": "^0.42.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@commitlint/cli": "^
|
|
45
|
-
"@commitlint/config-conventional": "^
|
|
44
|
+
"@commitlint/cli": "^17.0.2",
|
|
45
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
46
46
|
"@ember/optional-features": "^2.0.0",
|
|
47
|
-
"@ember/test-helpers": "^2.
|
|
48
|
-
"@embroider/test-setup": "^1.
|
|
49
|
-
"@glimmer/component": "^1.
|
|
50
|
-
"@glimmer/tracking": "^1.
|
|
47
|
+
"@ember/test-helpers": "^2.7.0",
|
|
48
|
+
"@embroider/test-setup": "^1.6.0",
|
|
49
|
+
"@glimmer/component": "^1.1.2",
|
|
50
|
+
"@glimmer/tracking": "^1.1.2",
|
|
51
51
|
"babel-eslint": "^10.1.0",
|
|
52
52
|
"broccoli-asset-rev": "^3.0.0",
|
|
53
|
-
"ember-apollo-client": "^
|
|
54
|
-
"ember-cli": "~4.
|
|
55
|
-
"ember-cli-dependency-checker": "^3.
|
|
53
|
+
"ember-apollo-client": "^4.0.2",
|
|
54
|
+
"ember-cli": "~4.4.0",
|
|
55
|
+
"ember-cli-dependency-checker": "^3.3.1",
|
|
56
56
|
"ember-cli-htmlbars": "^6.0.1",
|
|
57
57
|
"ember-cli-inject-live-reload": "^2.1.0",
|
|
58
58
|
"ember-cli-sri": "^2.1.1",
|
|
@@ -64,28 +64,28 @@
|
|
|
64
64
|
"ember-page-title": "^7.0.0",
|
|
65
65
|
"ember-qunit": "^5.1.5",
|
|
66
66
|
"ember-resolver": "^8.0.3",
|
|
67
|
-
"ember-source": "~4.
|
|
67
|
+
"ember-source": "~4.4.0",
|
|
68
68
|
"ember-source-channel-url": "^3.0.0",
|
|
69
|
-
"ember-template-lint": "^4.
|
|
69
|
+
"ember-template-lint": "^4.8.0",
|
|
70
70
|
"ember-try": "^2.0.0",
|
|
71
71
|
"eslint": "^7.32.0",
|
|
72
|
-
"eslint-config-prettier": "^8.
|
|
73
|
-
"eslint-plugin-ember": "^10.
|
|
72
|
+
"eslint-config-prettier": "^8.5.0",
|
|
73
|
+
"eslint-plugin-ember": "^10.6.1",
|
|
74
74
|
"eslint-plugin-node": "^11.1.0",
|
|
75
75
|
"eslint-plugin-prettier": "^4.0.0",
|
|
76
76
|
"eslint-plugin-qunit": "^7.2.0",
|
|
77
|
-
"husky": "^
|
|
77
|
+
"husky": "^8.0.1",
|
|
78
78
|
"loader.js": "^4.7.0",
|
|
79
79
|
"npm-run-all": "^4.1.5",
|
|
80
|
-
"prettier": "^2.
|
|
81
|
-
"qunit": "^2.
|
|
80
|
+
"prettier": "^2.6.2",
|
|
81
|
+
"qunit": "^2.19.1",
|
|
82
82
|
"qunit-dom": "^2.0.0",
|
|
83
|
-
"release-it": "^14.
|
|
83
|
+
"release-it": "^14.14.3",
|
|
84
84
|
"release-it-lerna-changelog": "^4.0.1",
|
|
85
|
-
"webpack": "^5.
|
|
85
|
+
"webpack": "^5.72.1"
|
|
86
86
|
},
|
|
87
87
|
"engines": {
|
|
88
|
-
"node": "
|
|
88
|
+
"node": "14.* || >= 16"
|
|
89
89
|
},
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public",
|