@wordpress/jest-console 8.36.1-next.8fd3f8831.0 → 8.37.1-next.06ee73755.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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2025 by the contributors
3
+ Copyright 2016-2026 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
package/build/index.cjs CHANGED
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
 
25
25
  // packages/jest-console/src/index.ts
26
26
  var import_matchers = require("./matchers.cjs");
27
- var import_supported_matchers = __toESM(require("./supported-matchers.cjs"), 1);
27
+ var import_supported_matchers = __toESM(require("./supported-matchers.cjs"));
28
28
  var setConsoleMethodSpy = (args) => {
29
29
  const [methodName, matcherName] = args;
30
30
  const spy = jest.spyOn(console, methodName).mockName(`console.${methodName}`);
@@ -34,7 +34,8 @@ var setConsoleMethodSpy = (args) => {
34
34
  }
35
35
  function assertExpectedCalls() {
36
36
  if (spy.assertionsNumber === 0 && spy.mock.calls.length > 0) {
37
- expect(console).not[matcherName]();
37
+ const name = matcherName;
38
+ expect(console).not[name]();
38
39
  }
39
40
  }
40
41
  beforeAll(resetSpy);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport './matchers';\nimport supportedMatchers from './supported-matchers';\nimport type { ExtendedMock } from './types';\n\n/**\n * Sets spy on the console object's method to make it possible to fail test when method called without assertion.\n *\n * @param args\n */\nconst setConsoleMethodSpy = ( args: [ string, string ] ) => {\n\tconst [ methodName, matcherName ] = args;\n\tconst spy = jest\n\t\t.spyOn( console, methodName as 'error' | 'info' | 'log' | 'warn' )\n\t\t.mockName( `console.${ methodName }` ) as ExtendedMock;\n\n\t/**\n\t * Resets the spy to its initial state.\n\t */\n\tfunction resetSpy() {\n\t\tspy.mockReset();\n\t\tspy.assertionsNumber = 0;\n\t}\n\n\t/**\n\t * Verifies that the spy has only been called if expected.\n\t */\n\tfunction assertExpectedCalls() {\n\t\tif ( spy.assertionsNumber === 0 && spy.mock.calls.length > 0 ) {\n\t\t\texpect( console ).not[ matcherName ]();\n\t\t}\n\t}\n\n\tbeforeAll( resetSpy );\n\n\tbeforeEach( () => {\n\t\tassertExpectedCalls();\n\t\tresetSpy();\n\t} );\n\n\tafterEach( assertExpectedCalls );\n};\n\nObject.entries( supportedMatchers ).forEach( setConsoleMethodSpy );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sBAAO;AACP,gCAA8B;AAQ9B,IAAM,sBAAsB,CAAE,SAA8B;AAC3D,QAAM,CAAE,YAAY,WAAY,IAAI;AACpC,QAAM,MAAM,KACV,MAAO,SAAS,UAAgD,EAChE,SAAU,WAAY,UAAW,EAAG;AAKtC,WAAS,WAAW;AACnB,QAAI,UAAU;AACd,QAAI,mBAAmB;AAAA,EACxB;AAKA,WAAS,sBAAsB;AAC9B,QAAK,IAAI,qBAAqB,KAAK,IAAI,KAAK,MAAM,SAAS,GAAI;AAC9D,aAAQ,OAAQ,EAAE,IAAK,WAAY,EAAE;AAAA,IACtC;AAAA,EACD;AAEA,YAAW,QAAS;AAEpB,aAAY,MAAM;AACjB,wBAAoB;AACpB,aAAS;AAAA,EACV,CAAE;AAEF,YAAW,mBAAoB;AAChC;AAEA,OAAO,QAAS,0BAAAA,OAAkB,EAAE,QAAS,mBAAoB;",
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport './matchers';\nimport supportedMatchers from './supported-matchers';\nimport type { ExtendedMock } from './types';\n\n/**\n * Sets spy on the console object's method to make it possible to fail test when method called without assertion.\n *\n * @param args\n */\nconst setConsoleMethodSpy = ( args: [ string, string ] ) => {\n\tconst [ methodName, matcherName ] = args;\n\tconst spy = jest\n\t\t.spyOn( console, methodName as 'error' | 'info' | 'log' | 'warn' )\n\t\t.mockName( `console.${ methodName }` ) as ExtendedMock;\n\n\t/**\n\t * Resets the spy to its initial state.\n\t */\n\tfunction resetSpy() {\n\t\tspy.mockReset();\n\t\tspy.assertionsNumber = 0;\n\t}\n\n\t/**\n\t * Verifies that the spy has only been called if expected.\n\t */\n\tfunction assertExpectedCalls() {\n\t\tif ( spy.assertionsNumber === 0 && spy.mock.calls.length > 0 ) {\n\t\t\t// Using 'as' to satisfy TypeScript compiler about the matcher name.\n\t\t\ttype MatcherName = `toHave${\n\t\t\t\t| 'Errored'\n\t\t\t\t| 'Informed'\n\t\t\t\t| 'Logged'\n\t\t\t\t| 'Warned' }`;\n\t\t\tconst name = matcherName as MatcherName;\n\n\t\t\texpect( console ).not[ name ]();\n\t\t}\n\t}\n\n\tbeforeAll( resetSpy );\n\n\tbeforeEach( () => {\n\t\tassertExpectedCalls();\n\t\tresetSpy();\n\t} );\n\n\tafterEach( assertExpectedCalls );\n};\n\nObject.entries( supportedMatchers ).forEach( setConsoleMethodSpy );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,sBAAO;AACP,gCAA8B;AAQ9B,IAAM,sBAAsB,CAAE,SAA8B;AAC3D,QAAM,CAAE,YAAY,WAAY,IAAI;AACpC,QAAM,MAAM,KACV,MAAO,SAAS,UAAgD,EAChE,SAAU,WAAY,UAAW,EAAG;AAKtC,WAAS,WAAW;AACnB,QAAI,UAAU;AACd,QAAI,mBAAmB;AAAA,EACxB;AAKA,WAAS,sBAAsB;AAC9B,QAAK,IAAI,qBAAqB,KAAK,IAAI,KAAK,MAAM,SAAS,GAAI;AAO9D,YAAM,OAAO;AAEb,aAAQ,OAAQ,EAAE,IAAK,IAAK,EAAE;AAAA,IAC/B;AAAA,EACD;AAEA,YAAW,QAAS;AAEpB,aAAY,MAAM;AACjB,wBAAoB;AACpB,aAAS;AAAA,EACV,CAAE;AAEF,YAAW,mBAAoB;AAChC;AAEA,OAAO,QAAS,0BAAAA,OAAkB,EAAE,QAAS,mBAAoB;",
6
6
  "names": ["supportedMatchers"]
7
7
  }
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
 
25
25
  // packages/jest-console/src/matchers.ts
26
26
  var import_jest_matcher_utils = require("jest-matcher-utils");
27
- var import_supported_matchers = __toESM(require("./supported-matchers.cjs"), 1);
27
+ var import_supported_matchers = __toESM(require("./supported-matchers.cjs"));
28
28
  var createErrorMessage = (spyInfo) => {
29
29
  const { spy, pass, calls, matcherName, methodName, expected } = spyInfo;
30
30
  const hint = pass ? `.not${matcherName}` : matcherName;
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=declarations.d.mjs.map
@@ -1,6 +1,6 @@
1
1
  // packages/jest-console/src/index.ts
2
- import "./matchers.js";
3
- import supportedMatchers from "./supported-matchers.js";
2
+ import "./matchers.mjs";
3
+ import supportedMatchers from "./supported-matchers.mjs";
4
4
  var setConsoleMethodSpy = (args) => {
5
5
  const [methodName, matcherName] = args;
6
6
  const spy = jest.spyOn(console, methodName).mockName(`console.${methodName}`);
@@ -10,7 +10,8 @@ var setConsoleMethodSpy = (args) => {
10
10
  }
11
11
  function assertExpectedCalls() {
12
12
  if (spy.assertionsNumber === 0 && spy.mock.calls.length > 0) {
13
- expect(console).not[matcherName]();
13
+ const name = matcherName;
14
+ expect(console).not[name]();
14
15
  }
15
16
  }
16
17
  beforeAll(resetSpy);
@@ -21,4 +22,4 @@ var setConsoleMethodSpy = (args) => {
21
22
  afterEach(assertExpectedCalls);
22
23
  };
23
24
  Object.entries(supportedMatchers).forEach(setConsoleMethodSpy);
24
- //# sourceMappingURL=index.js.map
25
+ //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport './matchers';\nimport supportedMatchers from './supported-matchers';\nimport type { ExtendedMock } from './types';\n\n/**\n * Sets spy on the console object's method to make it possible to fail test when method called without assertion.\n *\n * @param args\n */\nconst setConsoleMethodSpy = ( args: [ string, string ] ) => {\n\tconst [ methodName, matcherName ] = args;\n\tconst spy = jest\n\t\t.spyOn( console, methodName as 'error' | 'info' | 'log' | 'warn' )\n\t\t.mockName( `console.${ methodName }` ) as ExtendedMock;\n\n\t/**\n\t * Resets the spy to its initial state.\n\t */\n\tfunction resetSpy() {\n\t\tspy.mockReset();\n\t\tspy.assertionsNumber = 0;\n\t}\n\n\t/**\n\t * Verifies that the spy has only been called if expected.\n\t */\n\tfunction assertExpectedCalls() {\n\t\tif ( spy.assertionsNumber === 0 && spy.mock.calls.length > 0 ) {\n\t\t\texpect( console ).not[ matcherName ]();\n\t\t}\n\t}\n\n\tbeforeAll( resetSpy );\n\n\tbeforeEach( () => {\n\t\tassertExpectedCalls();\n\t\tresetSpy();\n\t} );\n\n\tafterEach( assertExpectedCalls );\n};\n\nObject.entries( supportedMatchers ).forEach( setConsoleMethodSpy );\n"],
5
- "mappings": ";AAGA,OAAO;AACP,OAAO,uBAAuB;AAQ9B,IAAM,sBAAsB,CAAE,SAA8B;AAC3D,QAAM,CAAE,YAAY,WAAY,IAAI;AACpC,QAAM,MAAM,KACV,MAAO,SAAS,UAAgD,EAChE,SAAU,WAAY,UAAW,EAAG;AAKtC,WAAS,WAAW;AACnB,QAAI,UAAU;AACd,QAAI,mBAAmB;AAAA,EACxB;AAKA,WAAS,sBAAsB;AAC9B,QAAK,IAAI,qBAAqB,KAAK,IAAI,KAAK,MAAM,SAAS,GAAI;AAC9D,aAAQ,OAAQ,EAAE,IAAK,WAAY,EAAE;AAAA,IACtC;AAAA,EACD;AAEA,YAAW,QAAS;AAEpB,aAAY,MAAM;AACjB,wBAAoB;AACpB,aAAS;AAAA,EACV,CAAE;AAEF,YAAW,mBAAoB;AAChC;AAEA,OAAO,QAAS,iBAAkB,EAAE,QAAS,mBAAoB;",
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport './matchers';\nimport supportedMatchers from './supported-matchers';\nimport type { ExtendedMock } from './types';\n\n/**\n * Sets spy on the console object's method to make it possible to fail test when method called without assertion.\n *\n * @param args\n */\nconst setConsoleMethodSpy = ( args: [ string, string ] ) => {\n\tconst [ methodName, matcherName ] = args;\n\tconst spy = jest\n\t\t.spyOn( console, methodName as 'error' | 'info' | 'log' | 'warn' )\n\t\t.mockName( `console.${ methodName }` ) as ExtendedMock;\n\n\t/**\n\t * Resets the spy to its initial state.\n\t */\n\tfunction resetSpy() {\n\t\tspy.mockReset();\n\t\tspy.assertionsNumber = 0;\n\t}\n\n\t/**\n\t * Verifies that the spy has only been called if expected.\n\t */\n\tfunction assertExpectedCalls() {\n\t\tif ( spy.assertionsNumber === 0 && spy.mock.calls.length > 0 ) {\n\t\t\t// Using 'as' to satisfy TypeScript compiler about the matcher name.\n\t\t\ttype MatcherName = `toHave${\n\t\t\t\t| 'Errored'\n\t\t\t\t| 'Informed'\n\t\t\t\t| 'Logged'\n\t\t\t\t| 'Warned' }`;\n\t\t\tconst name = matcherName as MatcherName;\n\n\t\t\texpect( console ).not[ name ]();\n\t\t}\n\t}\n\n\tbeforeAll( resetSpy );\n\n\tbeforeEach( () => {\n\t\tassertExpectedCalls();\n\t\tresetSpy();\n\t} );\n\n\tafterEach( assertExpectedCalls );\n};\n\nObject.entries( supportedMatchers ).forEach( setConsoleMethodSpy );\n"],
5
+ "mappings": ";AAGA,OAAO;AACP,OAAO,uBAAuB;AAQ9B,IAAM,sBAAsB,CAAE,SAA8B;AAC3D,QAAM,CAAE,YAAY,WAAY,IAAI;AACpC,QAAM,MAAM,KACV,MAAO,SAAS,UAAgD,EAChE,SAAU,WAAY,UAAW,EAAG;AAKtC,WAAS,WAAW;AACnB,QAAI,UAAU;AACd,QAAI,mBAAmB;AAAA,EACxB;AAKA,WAAS,sBAAsB;AAC9B,QAAK,IAAI,qBAAqB,KAAK,IAAI,KAAK,MAAM,SAAS,GAAI;AAO9D,YAAM,OAAO;AAEb,aAAQ,OAAQ,EAAE,IAAK,IAAK,EAAE;AAAA,IAC/B;AAAA,EACD;AAEA,YAAW,QAAS;AAEpB,aAAY,MAAM;AACjB,wBAAoB;AACpB,aAAS;AAAA,EACV,CAAE;AAEF,YAAW,mBAAoB;AAChC;AAEA,OAAO,QAAS,iBAAkB,EAAE,QAAS,mBAAoB;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  // packages/jest-console/src/matchers.ts
2
2
  import { matcherHint, printExpected, printReceived } from "jest-matcher-utils";
3
- import supportedMatchers from "./supported-matchers.js";
3
+ import supportedMatchers from "./supported-matchers.mjs";
4
4
  var createErrorMessage = (spyInfo) => {
5
5
  const { spy, pass, calls, matcherName, methodName, expected } = spyInfo;
6
6
  const hint = pass ? `.not${matcherName}` : matcherName;
@@ -66,4 +66,4 @@ expect.extend(
66
66
  {}
67
67
  )
68
68
  );
69
- //# sourceMappingURL=matchers.js.map
69
+ //# sourceMappingURL=matchers.mjs.map
@@ -9,4 +9,4 @@ var supported_matchers_default = supportedMatchers;
9
9
  export {
10
10
  supported_matchers_default as default
11
11
  };
12
- //# sourceMappingURL=supported-matchers.js.map
12
+ //# sourceMappingURL=supported-matchers.mjs.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/jest-console",
3
- "version": "8.36.1-next.8fd3f8831.0",
3
+ "version": "8.37.1-next.06ee73755.0",
4
4
  "description": "Custom Jest matchers for the Console object.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -30,20 +30,24 @@
30
30
  "build-module",
31
31
  "build-types"
32
32
  ],
33
- "type": "module",
34
33
  "main": "build/index.cjs",
35
- "module": "build-module/index.js",
34
+ "module": "build-module/index.mjs",
36
35
  "exports": {
37
36
  ".": {
38
37
  "types": "./build-types/index.d.ts",
39
- "import": "./build-module/index.js",
38
+ "import": "./build-module/index.mjs",
40
39
  "require": "./build/index.cjs"
41
40
  },
42
41
  "./package.json": "./package.json"
43
42
  },
44
- "types": "build-types",
43
+ "types": "index.d.ts",
45
44
  "dependencies": {
46
- "jest-matcher-utils": "^29.6.2"
45
+ "jest-matcher-utils": "^29.6.2",
46
+ "jest-mock": "^29.6.2"
47
+ },
48
+ "devDependencies": {
49
+ "@testing-library/jest-dom": "^6.6.3",
50
+ "@types/jest": "^29.5.14"
47
51
  },
48
52
  "peerDependencies": {
49
53
  "jest": ">=29"
@@ -51,5 +55,5 @@
51
55
  "publishConfig": {
52
56
  "access": "public"
53
57
  },
54
- "gitHead": "e582b351bc4c4b8734bb087f63a3beec9875c3c7"
58
+ "gitHead": "fd315436f44683a993d5f053789b5279d95b2872"
55
59
  }
package/src/index.ts CHANGED
@@ -29,7 +29,15 @@ const setConsoleMethodSpy = ( args: [ string, string ] ) => {
29
29
  */
30
30
  function assertExpectedCalls() {
31
31
  if ( spy.assertionsNumber === 0 && spy.mock.calls.length > 0 ) {
32
- expect( console ).not[ matcherName ]();
32
+ // Using 'as' to satisfy TypeScript compiler about the matcher name.
33
+ type MatcherName = `toHave${
34
+ | 'Errored'
35
+ | 'Informed'
36
+ | 'Logged'
37
+ | 'Warned' }`;
38
+ const name = matcherName as MatcherName;
39
+
40
+ expect( console ).not[ name ]();
33
41
  }
34
42
  }
35
43
 
@@ -1 +0,0 @@
1
- //# sourceMappingURL=declarations.d.js.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.js.map
File without changes