@bagaar/ember-graphql-mocking 0.3.0 → 0.4.1
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 +34 -1
- package/README.md +1 -1
- package/addon-test-support/index.js +17 -21
- package/package.json +5 -3
- package/.husky/commit-msg +0 -4
- package/RELEASE.md +0 -60
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## v0.4.1 (2022-02-09)
|
|
5
|
+
|
|
6
|
+
#### :bug: Bug Fix
|
|
7
|
+
* [#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))
|
|
8
|
+
|
|
9
|
+
#### :memo: Documentation
|
|
10
|
+
* [#19](https://github.com/Bagaar/ember-graphql-mocking/pull/19) Fix install command in docs ([@bertdeblock](https://github.com/bertdeblock))
|
|
11
|
+
|
|
12
|
+
#### :house: Internal
|
|
13
|
+
* [#22](https://github.com/Bagaar/ember-graphql-mocking/pull/22) Don't publish `.husky` folder and `RELEASE.md` file ([@bertdeblock](https://github.com/bertdeblock))
|
|
14
|
+
|
|
15
|
+
#### Committers: 1
|
|
16
|
+
- Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
|
|
17
|
+
|
|
18
|
+
## v0.4.0 (2022-02-03)
|
|
19
|
+
|
|
20
|
+
#### :rocket: Enhancement
|
|
21
|
+
* [#18](https://github.com/Bagaar/ember-graphql-mocking/pull/18) Make `msw` start options configurable ([@bertdeblock](https://github.com/bertdeblock))
|
|
22
|
+
|
|
23
|
+
#### Committers: 1
|
|
24
|
+
- Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
|
|
25
|
+
|
|
26
|
+
## v0.3.2 (2022-02-02)
|
|
27
|
+
|
|
28
|
+
#### :house: Internal
|
|
29
|
+
* [#17](https://github.com/Bagaar/ember-graphql-mocking/pull/17) Fix release commit message ([@bertdeblock](https://github.com/bertdeblock))
|
|
30
|
+
|
|
31
|
+
#### Committers: 1
|
|
32
|
+
- Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## v0.3.1 (2022-02-02)
|
|
3
36
|
|
|
4
37
|
#### :house: Internal
|
|
5
38
|
* [#16](https://github.com/Bagaar/ember-graphql-mocking/pull/16) Update publish config ([@bertdeblock](https://github.com/bertdeblock))
|
package/README.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { assert } from '@ember/debug';
|
|
2
2
|
import { buildASTSchema, graphql } from 'graphql';
|
|
3
|
+
import merge from 'lodash.merge';
|
|
3
4
|
import { graphql as mswGraphql, setupWorker } from 'msw';
|
|
4
|
-
import { done as qunitDone } from 'qunit';
|
|
5
5
|
|
|
6
6
|
const IS_TESTEM = Boolean(window.Testem);
|
|
7
7
|
const DEFAULT_OPTIONS = {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
mswStartOptions: {
|
|
9
|
+
quiet: IS_TESTEM,
|
|
10
|
+
serviceWorker: {
|
|
11
|
+
options: {
|
|
12
|
+
scope: IS_TESTEM ? window.location.pathname : '/tests',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
10
16
|
};
|
|
11
17
|
|
|
12
18
|
let isSetupGraphqlTestCalled = false;
|
|
@@ -14,14 +20,10 @@ let root = null;
|
|
|
14
20
|
let worker = null;
|
|
15
21
|
|
|
16
22
|
export function setupEmberGraphqlMocking(schemaDocument, providedOptions) {
|
|
17
|
-
const options = {
|
|
18
|
-
...DEFAULT_OPTIONS,
|
|
19
|
-
...providedOptions,
|
|
20
|
-
};
|
|
23
|
+
const options = merge({}, DEFAULT_OPTIONS, providedOptions);
|
|
21
24
|
|
|
22
25
|
createWorker(options);
|
|
23
26
|
createGraphqlOperationHandler(schemaDocument);
|
|
24
|
-
qunitDone(destroyWorker);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export function setupGraphqlTest(hooks) {
|
|
@@ -43,22 +45,16 @@ export function getWorker() {
|
|
|
43
45
|
return worker;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
function
|
|
47
|
-
worker
|
|
48
|
+
export function destroyWorker() {
|
|
49
|
+
worker.stop();
|
|
48
50
|
|
|
49
|
-
worker
|
|
50
|
-
quiet: options.quiet,
|
|
51
|
-
serviceWorker: {
|
|
52
|
-
options: {
|
|
53
|
-
scope: options.scope,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
});
|
|
51
|
+
worker = null;
|
|
57
52
|
}
|
|
58
53
|
|
|
59
|
-
function
|
|
60
|
-
worker
|
|
61
|
-
|
|
54
|
+
function createWorker(options) {
|
|
55
|
+
worker = setupWorker();
|
|
56
|
+
|
|
57
|
+
worker.start(options.mswStartOptions);
|
|
62
58
|
}
|
|
63
59
|
|
|
64
60
|
function createGraphqlOperationHandler(schemaDocument) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagaar/ember-graphql-mocking",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Ember addon for mocking GraphQL requests using Mock Service Worker (MSW).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"ember-auto-import": "^2.2.4",
|
|
38
38
|
"ember-cli-babel": "^7.26.11",
|
|
39
39
|
"graphql": "^16.3.0",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"lodash.merge": "^4.6.2",
|
|
41
|
+
"msw": "0.36.7"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@commitlint/cli": "^16.1.0",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"loader.js": "^4.7.0",
|
|
79
79
|
"npm-run-all": "^4.1.5",
|
|
80
80
|
"prettier": "^2.5.1",
|
|
81
|
+
"qunit": "^2.17.2",
|
|
81
82
|
"qunit-dom": "^2.0.0",
|
|
82
83
|
"release-it": "^14.2.1",
|
|
83
84
|
"release-it-lerna-changelog": "^4.0.1",
|
|
@@ -107,6 +108,7 @@
|
|
|
107
108
|
}
|
|
108
109
|
},
|
|
109
110
|
"git": {
|
|
111
|
+
"commitMessage": "chore(release): ${version}",
|
|
110
112
|
"tagName": "v${version}"
|
|
111
113
|
},
|
|
112
114
|
"github": {
|
package/.husky/commit-msg
DELETED
package/RELEASE.md
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Release Process
|
|
2
|
-
|
|
3
|
-
Releases are mostly automated using
|
|
4
|
-
[release-it](https://github.com/release-it/release-it/) and
|
|
5
|
-
[lerna-changelog](https://github.com/lerna/lerna-changelog/).
|
|
6
|
-
|
|
7
|
-
## Preparation
|
|
8
|
-
|
|
9
|
-
Since the majority of the actual release process is automated, the primary
|
|
10
|
-
remaining task prior to releasing is confirming that all pull requests that
|
|
11
|
-
have been merged since the last release have been labeled with the appropriate
|
|
12
|
-
`lerna-changelog` labels and the titles have been updated to ensure they
|
|
13
|
-
represent something that would make sense to our users. Some great information
|
|
14
|
-
on why this is important can be found at
|
|
15
|
-
[keepachangelog.com](https://keepachangelog.com/en/1.0.0/), but the overall
|
|
16
|
-
guiding principle here is that changelogs are for humans, not machines.
|
|
17
|
-
|
|
18
|
-
When reviewing merged PR's the labels to be used are:
|
|
19
|
-
|
|
20
|
-
* breaking - Used when the PR is considered a breaking change.
|
|
21
|
-
* enhancement - Used when the PR adds a new feature or enhancement.
|
|
22
|
-
* bug - Used when the PR fixes a bug included in a previous release.
|
|
23
|
-
* documentation - Used when the PR adds or updates documentation.
|
|
24
|
-
* internal - Used for internal changes that still require a mention in the
|
|
25
|
-
changelog/release notes.
|
|
26
|
-
|
|
27
|
-
## Release
|
|
28
|
-
|
|
29
|
-
Once the prep work is completed, the actual release is straight forward:
|
|
30
|
-
|
|
31
|
-
* First, ensure that you have installed your projects dependencies:
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
yarn install
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
* Second, ensure that you have obtained a
|
|
38
|
-
[GitHub personal access token][generate-token] with the `repo` scope (no
|
|
39
|
-
other permissions are needed). Make sure the token is available as the
|
|
40
|
-
`GITHUB_AUTH` environment variable.
|
|
41
|
-
|
|
42
|
-
For instance:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
export GITHUB_AUTH=abc123def456
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
[generate-token]: https://github.com/settings/tokens/new?scopes=repo&description=GITHUB_AUTH+env+variable
|
|
49
|
-
|
|
50
|
-
* And last (but not least 😁) do your release.
|
|
51
|
-
|
|
52
|
-
```sh
|
|
53
|
-
npx release-it
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
[release-it](https://github.com/release-it/release-it/) manages the actual
|
|
57
|
-
release process. It will prompt you to to choose the version number after which
|
|
58
|
-
you will have the chance to hand tweak the changelog to be used (for the
|
|
59
|
-
`CHANGELOG.md` and GitHub release), then `release-it` continues on to tagging,
|
|
60
|
-
pushing the tag and commits, etc.
|