@khanacademy/wonder-blocks-testing-core 2.0.1 → 2.1.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 CHANGED
@@ -1,38 +1,53 @@
1
1
  # @khanacademy/wonder-blocks-testing-core
2
2
 
3
+ ## 2.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - ee8d95a: Rollback rollup version from v4 to v2 to prevent an issue with CJS builds in unit tests
8
+
9
+ ## 2.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - f03298f: Tooling:
14
+
15
+ - Switching to `pnpm`.
16
+ - Upgrading `rollup` to v4 and `@babel/runtime` to match the current webapp version.
17
+
3
18
  ## 2.0.1
4
19
 
5
20
  ### Patch Changes
6
21
 
7
- - 11a0f5c6: No functional changes. Adding prepublishOnly script.
22
+ - 11a0f5c6: No functional changes. Adding prepublishOnly script.
8
23
 
9
24
  ## 2.0.0
10
25
 
11
26
  ### Major Changes
12
27
 
13
- - e6abdd17: Upgrade to React 18
28
+ - e6abdd17: Upgrade to React 18
14
29
 
15
30
  ## 1.1.0
16
31
 
17
32
  ### Minor Changes
18
33
 
19
- - 16565a85: Add support for hard fails to the request mocking features
34
+ - 16565a85: Add support for hard fails to the request mocking features
20
35
 
21
36
  ## 1.0.2
22
37
 
23
38
  ### Patch Changes
24
39
 
25
- - 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
40
+ - 02a1b298: Make sure we don't package tsconfig and tsbuildinfo files
26
41
 
27
42
  ## 1.0.1
28
43
 
29
44
  ### Patch Changes
30
45
 
31
- - c954464a: Fix how react-dom/server is imported in Wonder Blocks Testing Core
32
- - 559e82d5: Update to build tooling, generating smaller output
46
+ - c954464a: Fix how react-dom/server is imported in Wonder Blocks Testing Core
47
+ - 559e82d5: Update to build tooling, generating smaller output
33
48
 
34
49
  ## 1.0.0
35
50
 
36
51
  ### Major Changes
37
52
 
38
- - 2a6c85df: New package containing core Testing functionality without dependencies on other WB packages
53
+ - 2a6c85df: New package containing core Testing functionality without dependencies on other WB packages
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Khan Academy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/es/index.js CHANGED
@@ -193,7 +193,7 @@ class SettleSignal extends EventTarget {
193
193
  constructor(setSettleFn = null) {
194
194
  super();
195
195
  this._settled = false;
196
- setSettleFn == null ? void 0 : setSettleFn(() => {
196
+ setSettleFn == null || setSettleFn(() => {
197
197
  if (this._settled) {
198
198
  throw new Error("SettleSignal already settled");
199
199
  }
@@ -222,7 +222,7 @@ class SettleController {
222
222
  }
223
223
  settle() {
224
224
  var _this$_settleFn;
225
- (_this$_settleFn = this._settleFn) == null ? void 0 : _this$_settleFn.call(this);
225
+ (_this$_settleFn = this._settleFn) == null || _this$_settleFn.call(this);
226
226
  }
227
227
  }
228
228
 
@@ -8,6 +8,6 @@ export declare const F2: unknown;
8
8
  export declare const F3: unknown;
9
9
  declare const _default: {
10
10
  title: string;
11
- component: (props: Props) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
11
+ component: (props: Props) => React.ReactElement;
12
12
  };
13
13
  export default _default;
@@ -4,6 +4,6 @@ export declare const F1: unknown;
4
4
  export declare const F2: unknown;
5
5
  declare const _default: {
6
6
  title: string;
7
- component: (props: Props) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
7
+ component: (props: Props) => React.ReactElement;
8
8
  };
9
9
  export default _default;
@@ -1,5 +1,3 @@
1
- /// <reference path="../../../types/aphrodite.d.ts" />
2
- /// <reference types="react" />
3
1
  import type { TestHarnessConfigs } from "../types";
4
2
  /**
5
3
  * NOTE: We do not type `DefaultAdapters` with `Adapters` here because we want
@@ -12,12 +10,9 @@ import type { TestHarnessConfigs } from "../types";
12
10
  export declare const DefaultAdapters: {
13
11
  readonly boundary: import("../types").TestHarnessAdapter<(error: Error | null | undefined, errorInfo: {
14
12
  componentStack: string;
15
- }) => import("react").ReactNode>;
13
+ }) => React.ReactNode>;
16
14
  readonly css: import("../types").TestHarnessAdapter<string | string[] | import("aphrodite").CSSProperties | {
17
- /**
18
- * The default adapters provided by Wonder Blocks.
19
- */
20
- classes: string[];
15
+ classes: Array<string>;
21
16
  style: import("aphrodite").CSSProperties;
22
17
  }>;
23
18
  readonly portal: import("../types").TestHarnessAdapter<string>;
@@ -25,14 +20,14 @@ export declare const DefaultAdapters: {
25
20
  initialEntries: import("history").LocationDescriptor<unknown>[] | undefined;
26
21
  initialIndex?: number | undefined;
27
22
  getUserConfirmation?: ((message: string, callback: (ok: boolean) => void) => void) | undefined;
28
- path?: string | undefined;
23
+ path?: string;
29
24
  } | {
30
- location: import("history").LocationDescriptor<unknown>;
25
+ location: import("history").LocationDescriptor;
31
26
  forceStatic: true;
32
- path?: string | undefined;
27
+ path?: string;
33
28
  } | {
34
- location: import("history").LocationDescriptor<unknown>;
35
- path?: string | undefined;
29
+ location: import("history").LocationDescriptor;
30
+ path?: string;
36
31
  }>>;
37
32
  };
38
33
  /**
@@ -14,4 +14,4 @@ import type { TestHarnessAdapters, TestHarnessConfigs } from "./types";
14
14
  * configs?: $Shape<TestHarnessConfigs<TAdapters>>,
15
15
  * ) => React.AbstractComponent<any, any>} A test harness.
16
16
  */
17
- export declare const makeHookHarness: <TAdapters extends TestHarnessAdapters>(adapters: TAdapters, defaultConfigs: TestHarnessConfigs<TAdapters>) => (configs?: Partial<TestHarnessConfigs<TAdapters>> | undefined) => React.ForwardRefExoticComponent<any>;
17
+ export declare const makeHookHarness: <TAdapters extends TestHarnessAdapters>(adapters: TAdapters, defaultConfigs: TestHarnessConfigs<TAdapters>) => ((configs?: Partial<TestHarnessConfigs<TAdapters>>) => React.ForwardRefExoticComponent<any>);
@@ -12,4 +12,4 @@ import type { TestHarnessAdapters, TestHarnessConfigs } from "./types";
12
12
  * the adapters.
13
13
  * @returns A test harness.
14
14
  */
15
- export declare const makeTestHarness: <TAdapters extends TestHarnessAdapters>(adapters: TAdapters, defaultConfigs: TestHarnessConfigs<TAdapters>) => <TProps extends object>(Component: React.ComponentType<TProps>, configs?: Partial<TestHarnessConfigs<TAdapters>> | undefined) => React.ForwardRefExoticComponent<React.PropsWithoutRef<TProps> & React.RefAttributes<unknown>>;
15
+ export declare const makeTestHarness: <TAdapters extends TestHarnessAdapters>(adapters: TAdapters, defaultConfigs: TestHarnessConfigs<TAdapters>) => (<TProps extends object>(Component: React.ComponentType<TProps>, configs?: Partial<TestHarnessConfigs<TAdapters>>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<TProps> & React.RefAttributes<unknown>>);
@@ -1,5 +1,3 @@
1
- /// <reference path="../../types/aphrodite.d.ts" />
2
- /// <reference types="react" />
3
1
  /**
4
2
  * Wrap a component with a test harness using Wonder Blocks default adapters.
5
3
  *
@@ -12,9 +10,9 @@
12
10
  export declare const testHarness: <TProps extends object>(Component: import("react").ComponentType<TProps>, configs?: Partial<import("./types").TestHarnessConfigs<{
13
11
  readonly boundary: import("./types").TestHarnessAdapter<(error: Error | null | undefined, errorInfo: {
14
12
  componentStack: string;
15
- }) => import("react").ReactNode>;
13
+ }) => React.ReactNode>;
16
14
  readonly css: import("./types").TestHarnessAdapter<string | string[] | import("aphrodite").CSSProperties | {
17
- classes: string[];
15
+ classes: Array<string>;
18
16
  style: import("aphrodite").CSSProperties;
19
17
  }>;
20
18
  readonly portal: import("./types").TestHarnessAdapter<string>;
@@ -22,13 +20,13 @@ export declare const testHarness: <TProps extends object>(Component: import("rea
22
20
  initialEntries: import("history").LocationDescriptor<unknown>[] | undefined;
23
21
  initialIndex?: number | undefined;
24
22
  getUserConfirmation?: ((message: string, callback: (ok: boolean) => void) => void) | undefined;
25
- path?: string | undefined;
23
+ path?: string;
26
24
  } | {
27
- location: import("history").LocationDescriptor<unknown>;
25
+ location: import("history").LocationDescriptor;
28
26
  forceStatic: true;
29
- path?: string | undefined;
27
+ path?: string;
30
28
  } | {
31
- location: import("history").LocationDescriptor<unknown>;
32
- path?: string | undefined;
29
+ location: import("history").LocationDescriptor;
30
+ path?: string;
33
31
  }>>;
34
32
  }>> | undefined) => import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<TProps> & import("react").RefAttributes<unknown>>;
package/dist/index.js CHANGED
@@ -221,7 +221,7 @@ class SettleSignal extends EventTarget {
221
221
  constructor(setSettleFn = null) {
222
222
  super();
223
223
  this._settled = false;
224
- setSettleFn == null ? void 0 : setSettleFn(() => {
224
+ setSettleFn == null || setSettleFn(() => {
225
225
  if (this._settled) {
226
226
  throw new Error("SettleSignal already settled");
227
227
  }
@@ -250,7 +250,7 @@ class SettleController {
250
250
  }
251
251
  settle() {
252
252
  var _this$_settleFn;
253
- (_this$_settleFn = this._settleFn) == null ? void 0 : _this$_settleFn.call(this);
253
+ (_this$_settleFn = this._settleFn) == null || _this$_settleFn.call(this);
254
254
  }
255
255
  }
256
256
 
@@ -29,5 +29,5 @@ type RenderHookStaticResult<Result> = {
29
29
  * any effects are run, mimicking a server-side rendered result or initial
30
30
  * client-side render.
31
31
  */
32
- export declare const renderHookStatic: <Result, Props>(render: (initialProps?: Props | undefined) => Result, { wrapper, initialProps }?: Options<Props>) => RenderHookStaticResult<Result>;
32
+ export declare const renderHookStatic: <Result, Props>(render: (initialProps?: Props) => Result, { wrapper, initialProps }?: Options<Props>) => RenderHookStaticResult<Result>;
33
33
  export {};
@@ -45,7 +45,7 @@ export declare const RespondWith: Readonly<{
45
45
  /**
46
46
  * Response with GraphQL data JSON body and status code 200.
47
47
  */
48
- graphQLData: <TData_1 extends Record<any, any>>(data: TData_1, signal?: SettleSignal | null) => MockResponse<GraphQLJson<TData_1>>;
48
+ graphQLData: <TData extends Record<any, any>>(data: TData, signal?: SettleSignal | null) => MockResponse<GraphQLJson<TData>>;
49
49
  /**
50
50
  * Response with body that will not parse as JSON and status code 200.
51
51
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-testing-core",
3
- "version": "2.0.1",
3
+ "version": "2.1.1",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -9,16 +9,12 @@
9
9
  "main": "dist/index.js",
10
10
  "module": "dist/es/index.js",
11
11
  "types": "dist/index.d.ts",
12
- "scripts": {
13
- "test": "echo \"Error: no test specified\" && exit 1",
14
- "prepublishOnly": "../../utils/publish/package-pre-publish-check.sh"
15
- },
16
12
  "dependencies": {
17
- "@babel/runtime": "^7.18.6"
13
+ "@babel/runtime": "^7.24.5"
18
14
  },
19
15
  "peerDependencies": {
20
- "@khanacademy/wonder-stuff-core": "^1.2.2",
21
- "@storybook/addon-actions": "^8.2.1",
16
+ "@khanacademy/wonder-stuff-core": "^1.5.4",
17
+ "@storybook/addon-actions": "^8.5.2",
22
18
  "aphrodite": "^1.2.5",
23
19
  "node-fetch": "^2.6.7",
24
20
  "react": "18.2.0",
@@ -26,9 +22,12 @@
26
22
  "react-router-dom": "5.3.4"
27
23
  },
28
24
  "devDependencies": {
29
- "@khanacademy/wb-dev-build-settings": "^2.0.0",
30
- "@khanacademy/wonder-stuff-testing": "^3.0.1"
25
+ "@khanacademy/wonder-stuff-testing": "^3.0.1",
26
+ "@khanacademy/wb-dev-build-settings": "2.1.1"
31
27
  },
32
28
  "author": "",
33
- "license": "MIT"
29
+ "license": "MIT",
30
+ "scripts": {
31
+ "test": "echo \"Error: no test specified\" && exit 1"
32
+ }
34
33
  }