@ornikar/jest-config-react 7.3.1-beta.2 → 8.1.0-beta.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
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.0.1](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react@8.0.0...@ornikar/jest-config-react@8.0.1) (2021-12-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * downgrade node minimum required version [no issue] ([#595](https://github.com/ornikar/shared-configs/issues/595)) ([9464687](https://github.com/ornikar/shared-configs/commit/9464687f55aed4a2e683f5d3b992300d000a2b30))
12
+
13
+
14
+
15
+
16
+
17
+ # [8.0.0](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react@7.3.0...@ornikar/jest-config-react@8.0.0) (2021-12-07)
18
+
19
+
20
+ ### Features
21
+
22
+ * drop node 12 [no issue] ([#584](https://github.com/ornikar/shared-configs/issues/584)) ([e9c00ab](https://github.com/ornikar/shared-configs/commit/e9c00abb5ed3a9c60993b6c652566dd7e71a97e1))
23
+
24
+
25
+ ### BREAKING CHANGES
26
+
27
+ * requires node 14.17 or higher
28
+
29
+
30
+
31
+
32
+
6
33
  # [7.3.0](https://github.com/ornikar/shared-configs/compare/@ornikar/jest-config-react@7.2.0...@ornikar/jest-config-react@7.3.0) (2021-11-29)
7
34
 
8
35
 
@@ -4,8 +4,6 @@
4
4
 
5
5
  const { act, render, waitFor } = require('@testing-library/react');
6
6
 
7
- const wait = (amount = 0) => new Promise((resolve) => setTimeout(resolve, amount));
8
-
9
7
  const decorateStory = (storyFn, decorators) =>
10
8
  decorators.reduce(
11
9
  (decorated, decorator) =>
@@ -29,12 +27,18 @@ const decorateStory = (storyFn, decorators) =>
29
27
  );
30
28
 
31
29
  const globalDecorators = [];
30
+ const globalParameters = {};
32
31
 
33
32
  // Mocked version of `import { addDecorator } from '@storybook/react'`.
34
33
  exports.addDecorator = (decorator) => {
35
34
  globalDecorators.push(decorator);
36
35
  };
37
36
 
37
+ // Mocked version of `import { addParameters } from '@storybook/react'`.
38
+ exports.addParameters = (parameters) => {
39
+ Object.assign(globalParameters, parameters);
40
+ };
41
+
38
42
  // Mocked version of `import { action } from '@storybook/react'`.
39
43
  exports.action = (actionName) => jest.fn();
40
44
 
@@ -46,7 +50,7 @@ exports.storiesOf = (groupName) => {
46
50
  // Mocked API to generate tests from & snapshot stories.
47
51
  const api = {
48
52
  add(storyName, story, storyParameters = {}) {
49
- const parameters = { ...localParameters, ...storyParameters };
53
+ const parameters = { ...globalParameters, ...localParameters, ...storyParameters };
50
54
  const context = { name: storyName, parameters };
51
55
  const { jest } = parameters;
52
56
  const { ignore, ignoreDecorators, createBeforeAfterEachCallbacks, waitFor: waitForExpectation } = jest || {};
@@ -71,10 +75,9 @@ exports.storiesOf = (groupName) => {
71
75
  await act(async () => {
72
76
  const rtlApi = render(story(context), { wrapper: wrappingComponent });
73
77
  const { unmount, asFragment } = rtlApi;
74
- // https://www.apollographql.com/docs/react/development-testing/testing/#testing-final-state
75
- // delays until the next "tick" of the event loop, and allows time
76
- // for that Promise returned from MockedProvider to be fulfilled
77
- await (waitForExpectation ? waitFor(() => waitForExpectation(rtlApi, expect)) : wait(0));
78
+ if (waitForExpectation) {
79
+ await waitFor(() => waitForExpectation(rtlApi, expect, { parameters }));
80
+ }
78
81
  expect(asFragment()).toMatchSnapshot();
79
82
  unmount();
80
83
  });
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ornikar/jest-config-react",
3
- "version": "7.3.1-beta.2",
3
+ "version": "8.1.0-beta.0",
4
4
  "description": "jest config",
5
5
  "repository": "ornikar/shared-configs",
6
6
  "main": "jest-preset.js",
7
7
  "license": "ISC",
8
8
  "engines": {
9
- "node": ">=12.13.0"
9
+ "node": ">=14.17.5"
10
10
  },
11
11
  "publishConfig": {
12
12
  "access": "public"
@@ -18,7 +18,7 @@
18
18
  "react-dom": "^16.6.3 || ^17.0.0"
19
19
  },
20
20
  "dependencies": {
21
- "@ornikar/jest-config": "^6.0.1-beta.1",
21
+ "@ornikar/jest-config": "^7.0.1",
22
22
  "identity-obj-proxy": "^3.0.0"
23
23
  },
24
24
  "devDependencies": {