@fluidframework/test-runtime-utils 2.63.0-359461 → 2.63.0-359962
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/dist/validateAssertionError.d.ts +1 -1
- package/dist/validateAssertionError.d.ts.map +1 -1
- package/dist/validateAssertionError.js +10 -5
- package/dist/validateAssertionError.js.map +1 -1
- package/lib/validateAssertionError.d.ts +1 -1
- package/lib/validateAssertionError.d.ts.map +1 -1
- package/lib/validateAssertionError.js +10 -5
- package/lib/validateAssertionError.js.map +1 -1
- package/package.json +15 -15
- package/src/validateAssertionError.ts +11 -6
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* it either returns true or throws an error (the behavior expected by NodeJS' `assert.throws()`).
|
|
14
14
|
*
|
|
15
15
|
* @param error - The error object thrown by our `assert()` function. Its `message` property could
|
|
16
|
-
* be a short code, or the original string message coded into the `
|
|
16
|
+
* be a short code, or the original string message coded into the `assert()`.
|
|
17
17
|
* @param expectedErrorMessage - The message that the error object should match (either explicitly,
|
|
18
18
|
* or because it contains a short code which maps to that message).
|
|
19
19
|
* @returns `true` if the message in the error object that was passed in matches the expected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateAssertionError.d.ts","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"validateAssertionError.d.ts","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAC/B,OAAO,CAqBT"}
|
|
@@ -17,7 +17,7 @@ const assertionShortCodesMap_js_1 = require("./assertionShortCodesMap.js");
|
|
|
17
17
|
* it either returns true or throws an error (the behavior expected by NodeJS' `assert.throws()`).
|
|
18
18
|
*
|
|
19
19
|
* @param error - The error object thrown by our `assert()` function. Its `message` property could
|
|
20
|
-
* be a short code, or the original string message coded into the `
|
|
20
|
+
* be a short code, or the original string message coded into the `assert()`.
|
|
21
21
|
* @param expectedErrorMessage - The message that the error object should match (either explicitly,
|
|
22
22
|
* or because it contains a short code which maps to that message).
|
|
23
23
|
* @returns `true` if the message in the error object that was passed in matches the expected
|
|
@@ -25,15 +25,20 @@ const assertionShortCodesMap_js_1 = require("./assertionShortCodesMap.js");
|
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
27
|
function validateAssertionError(error, expectedErrorMsg) {
|
|
28
|
-
|
|
28
|
+
// Asserts with custom debugMessageBuilder put extra content on the second line of the message, even when tagged.
|
|
29
|
+
// Thus extract the first line, which will be the assert tag if there is one, and replace it with the message from the shortCodeMap.
|
|
30
|
+
const split = error.message.split("\n");
|
|
31
|
+
const possibleShortCode = split[0].trim();
|
|
32
|
+
if (possibleShortCode in assertionShortCodesMap_js_1.shortCodeMap) {
|
|
33
|
+
split[0] = assertionShortCodesMap_js_1.shortCodeMap[possibleShortCode];
|
|
34
|
+
}
|
|
35
|
+
const mappedMsg = split.join("\n");
|
|
29
36
|
if (typeof expectedErrorMsg === "string"
|
|
30
37
|
? mappedMsg !== expectedErrorMsg
|
|
31
38
|
: !expectedErrorMsg.test(mappedMsg)) {
|
|
32
39
|
// This throws an Error instead of an AssertionError because AssertionError would require a dependency on the
|
|
33
40
|
// node assert library, which we don't want to do for this library because it's used in the browser.
|
|
34
|
-
const message =
|
|
35
|
-
? `Unexpected assertion thrown\nActual: ${error.message}\nExpected: ${expectedErrorMsg}`
|
|
36
|
-
: `Unexpected assertion thrown\nActual: ${error.message} ('${mappedMsg}')\nExpected: ${expectedErrorMsg}`;
|
|
41
|
+
const message = `Unexpected assertion thrown\nActual: ${error.message === mappedMsg ? error.message : `${error.message} ('${mappedMsg}')}`}\nExpected: ${expectedErrorMsg}`;
|
|
37
42
|
throw new Error(message);
|
|
38
43
|
}
|
|
39
44
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateAssertionError.js","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2EAA2D;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,sBAAsB,CACrC,KAAY,EACZ,gBAAiC;IAEjC,MAAM,
|
|
1
|
+
{"version":3,"file":"validateAssertionError.js","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2EAA2D;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,sBAAsB,CACrC,KAAY,EACZ,gBAAiC;IAEjC,iHAAiH;IACjH,oIAAoI;IACpI,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1C,IAAI,iBAAiB,IAAI,wCAAY,EAAE,CAAC;QACvC,KAAK,CAAC,CAAC,CAAC,GAAG,wCAAY,CAAC,iBAAiB,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnC,IACC,OAAO,gBAAgB,KAAK,QAAQ;QACnC,CAAC,CAAC,SAAS,KAAK,gBAAgB;QAChC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,EACnC,CAAC;QACF,6GAA6G;QAC7G,oGAAoG;QACpG,MAAM,OAAO,GAAG,wCAAwC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,MAAM,SAAS,KAAK,eAAe,gBAAgB,EAAE,CAAC;QAC5K,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAxBD,wDAwBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { shortCodeMap } from \"./assertionShortCodesMap.js\";\n\n/**\n * Validates that an error thrown by our assert() function has the expected message, or a\n * short code that corresponds to that message.\n *\n * @remarks\n * The main use case for this is so tests that expect specific assert() calls to fail can\n * always do comparisons based on the original string message, and work whether they run\n * before the policy-check tool replaces those strings with short codes, or after. Note that\n * it either returns true or throws an error (the behavior expected by NodeJS' `assert.throws()`).\n *\n * @param error - The error object thrown by our `assert()` function. Its `message` property could\n * be a short code, or the original string message coded into the `assert()`.\n * @param expectedErrorMessage - The message that the error object should match (either explicitly,\n * or because it contains a short code which maps to that message).\n * @returns `true` if the message in the error object that was passed in matches the expected\n * message. Otherwise it throws an error.\n * @internal\n */\nexport function validateAssertionError(\n\terror: Error,\n\texpectedErrorMsg: string | RegExp,\n): boolean {\n\t// Asserts with custom debugMessageBuilder put extra content on the second line of the message, even when tagged.\n\t// Thus extract the first line, which will be the assert tag if there is one, and replace it with the message from the shortCodeMap.\n\tconst split = error.message.split(\"\\n\");\n\tconst possibleShortCode = split[0].trim();\n\tif (possibleShortCode in shortCodeMap) {\n\t\tsplit[0] = shortCodeMap[possibleShortCode];\n\t}\n\tconst mappedMsg = split.join(\"\\n\");\n\n\tif (\n\t\ttypeof expectedErrorMsg === \"string\"\n\t\t\t? mappedMsg !== expectedErrorMsg\n\t\t\t: !expectedErrorMsg.test(mappedMsg)\n\t) {\n\t\t// This throws an Error instead of an AssertionError because AssertionError would require a dependency on the\n\t\t// node assert library, which we don't want to do for this library because it's used in the browser.\n\t\tconst message = `Unexpected assertion thrown\\nActual: ${error.message === mappedMsg ? error.message : `${error.message} ('${mappedMsg}')}`}\\nExpected: ${expectedErrorMsg}`;\n\t\tthrow new Error(message);\n\t}\n\treturn true;\n}\n"]}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* it either returns true or throws an error (the behavior expected by NodeJS' `assert.throws()`).
|
|
14
14
|
*
|
|
15
15
|
* @param error - The error object thrown by our `assert()` function. Its `message` property could
|
|
16
|
-
* be a short code, or the original string message coded into the `
|
|
16
|
+
* be a short code, or the original string message coded into the `assert()`.
|
|
17
17
|
* @param expectedErrorMessage - The message that the error object should match (either explicitly,
|
|
18
18
|
* or because it contains a short code which maps to that message).
|
|
19
19
|
* @returns `true` if the message in the error object that was passed in matches the expected
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateAssertionError.d.ts","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"validateAssertionError.d.ts","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAC/B,OAAO,CAqBT"}
|
|
@@ -14,7 +14,7 @@ import { shortCodeMap } from "./assertionShortCodesMap.js";
|
|
|
14
14
|
* it either returns true or throws an error (the behavior expected by NodeJS' `assert.throws()`).
|
|
15
15
|
*
|
|
16
16
|
* @param error - The error object thrown by our `assert()` function. Its `message` property could
|
|
17
|
-
* be a short code, or the original string message coded into the `
|
|
17
|
+
* be a short code, or the original string message coded into the `assert()`.
|
|
18
18
|
* @param expectedErrorMessage - The message that the error object should match (either explicitly,
|
|
19
19
|
* or because it contains a short code which maps to that message).
|
|
20
20
|
* @returns `true` if the message in the error object that was passed in matches the expected
|
|
@@ -22,15 +22,20 @@ import { shortCodeMap } from "./assertionShortCodesMap.js";
|
|
|
22
22
|
* @internal
|
|
23
23
|
*/
|
|
24
24
|
export function validateAssertionError(error, expectedErrorMsg) {
|
|
25
|
-
|
|
25
|
+
// Asserts with custom debugMessageBuilder put extra content on the second line of the message, even when tagged.
|
|
26
|
+
// Thus extract the first line, which will be the assert tag if there is one, and replace it with the message from the shortCodeMap.
|
|
27
|
+
const split = error.message.split("\n");
|
|
28
|
+
const possibleShortCode = split[0].trim();
|
|
29
|
+
if (possibleShortCode in shortCodeMap) {
|
|
30
|
+
split[0] = shortCodeMap[possibleShortCode];
|
|
31
|
+
}
|
|
32
|
+
const mappedMsg = split.join("\n");
|
|
26
33
|
if (typeof expectedErrorMsg === "string"
|
|
27
34
|
? mappedMsg !== expectedErrorMsg
|
|
28
35
|
: !expectedErrorMsg.test(mappedMsg)) {
|
|
29
36
|
// This throws an Error instead of an AssertionError because AssertionError would require a dependency on the
|
|
30
37
|
// node assert library, which we don't want to do for this library because it's used in the browser.
|
|
31
|
-
const message =
|
|
32
|
-
? `Unexpected assertion thrown\nActual: ${error.message}\nExpected: ${expectedErrorMsg}`
|
|
33
|
-
: `Unexpected assertion thrown\nActual: ${error.message} ('${mappedMsg}')\nExpected: ${expectedErrorMsg}`;
|
|
38
|
+
const message = `Unexpected assertion thrown\nActual: ${error.message === mappedMsg ? error.message : `${error.message} ('${mappedMsg}')}`}\nExpected: ${expectedErrorMsg}`;
|
|
34
39
|
throw new Error(message);
|
|
35
40
|
}
|
|
36
41
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateAssertionError.js","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,sBAAsB,CACrC,KAAY,EACZ,gBAAiC;IAEjC,MAAM,
|
|
1
|
+
{"version":3,"file":"validateAssertionError.js","sourceRoot":"","sources":["../src/validateAssertionError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,sBAAsB,CACrC,KAAY,EACZ,gBAAiC;IAEjC,iHAAiH;IACjH,oIAAoI;IACpI,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1C,IAAI,iBAAiB,IAAI,YAAY,EAAE,CAAC;QACvC,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAC5C,CAAC;IACD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnC,IACC,OAAO,gBAAgB,KAAK,QAAQ;QACnC,CAAC,CAAC,SAAS,KAAK,gBAAgB;QAChC,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,EACnC,CAAC;QACF,6GAA6G;QAC7G,oGAAoG;QACpG,MAAM,OAAO,GAAG,wCAAwC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,MAAM,SAAS,KAAK,eAAe,gBAAgB,EAAE,CAAC;QAC5K,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { shortCodeMap } from \"./assertionShortCodesMap.js\";\n\n/**\n * Validates that an error thrown by our assert() function has the expected message, or a\n * short code that corresponds to that message.\n *\n * @remarks\n * The main use case for this is so tests that expect specific assert() calls to fail can\n * always do comparisons based on the original string message, and work whether they run\n * before the policy-check tool replaces those strings with short codes, or after. Note that\n * it either returns true or throws an error (the behavior expected by NodeJS' `assert.throws()`).\n *\n * @param error - The error object thrown by our `assert()` function. Its `message` property could\n * be a short code, or the original string message coded into the `assert()`.\n * @param expectedErrorMessage - The message that the error object should match (either explicitly,\n * or because it contains a short code which maps to that message).\n * @returns `true` if the message in the error object that was passed in matches the expected\n * message. Otherwise it throws an error.\n * @internal\n */\nexport function validateAssertionError(\n\terror: Error,\n\texpectedErrorMsg: string | RegExp,\n): boolean {\n\t// Asserts with custom debugMessageBuilder put extra content on the second line of the message, even when tagged.\n\t// Thus extract the first line, which will be the assert tag if there is one, and replace it with the message from the shortCodeMap.\n\tconst split = error.message.split(\"\\n\");\n\tconst possibleShortCode = split[0].trim();\n\tif (possibleShortCode in shortCodeMap) {\n\t\tsplit[0] = shortCodeMap[possibleShortCode];\n\t}\n\tconst mappedMsg = split.join(\"\\n\");\n\n\tif (\n\t\ttypeof expectedErrorMsg === \"string\"\n\t\t\t? mappedMsg !== expectedErrorMsg\n\t\t\t: !expectedErrorMsg.test(mappedMsg)\n\t) {\n\t\t// This throws an Error instead of an AssertionError because AssertionError would require a dependency on the\n\t\t// node assert library, which we don't want to do for this library because it's used in the browser.\n\t\tconst message = `Unexpected assertion thrown\\nActual: ${error.message === mappedMsg ? error.message : `${error.message} ('${mappedMsg}')}`}\\nExpected: ${expectedErrorMsg}`;\n\t\tthrow new Error(message);\n\t}\n\treturn true;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/test-runtime-utils",
|
|
3
|
-
"version": "2.63.0-
|
|
3
|
+
"version": "2.63.0-359962",
|
|
4
4
|
"description": "Fluid runtime test utilities",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,26 +69,26 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "2.63.0-
|
|
73
|
-
"@fluidframework/container-definitions": "2.63.0-
|
|
74
|
-
"@fluidframework/container-runtime-definitions": "2.63.0-
|
|
75
|
-
"@fluidframework/core-interfaces": "2.63.0-
|
|
76
|
-
"@fluidframework/core-utils": "2.63.0-
|
|
77
|
-
"@fluidframework/datastore-definitions": "2.63.0-
|
|
78
|
-
"@fluidframework/driver-definitions": "2.63.0-
|
|
79
|
-
"@fluidframework/driver-utils": "2.63.0-
|
|
80
|
-
"@fluidframework/id-compressor": "2.63.0-
|
|
81
|
-
"@fluidframework/routerlicious-driver": "2.63.0-
|
|
82
|
-
"@fluidframework/runtime-definitions": "2.63.0-
|
|
83
|
-
"@fluidframework/runtime-utils": "2.63.0-
|
|
84
|
-
"@fluidframework/telemetry-utils": "2.63.0-
|
|
72
|
+
"@fluid-internal/client-utils": "2.63.0-359962",
|
|
73
|
+
"@fluidframework/container-definitions": "2.63.0-359962",
|
|
74
|
+
"@fluidframework/container-runtime-definitions": "2.63.0-359962",
|
|
75
|
+
"@fluidframework/core-interfaces": "2.63.0-359962",
|
|
76
|
+
"@fluidframework/core-utils": "2.63.0-359962",
|
|
77
|
+
"@fluidframework/datastore-definitions": "2.63.0-359962",
|
|
78
|
+
"@fluidframework/driver-definitions": "2.63.0-359962",
|
|
79
|
+
"@fluidframework/driver-utils": "2.63.0-359962",
|
|
80
|
+
"@fluidframework/id-compressor": "2.63.0-359962",
|
|
81
|
+
"@fluidframework/routerlicious-driver": "2.63.0-359962",
|
|
82
|
+
"@fluidframework/runtime-definitions": "2.63.0-359962",
|
|
83
|
+
"@fluidframework/runtime-utils": "2.63.0-359962",
|
|
84
|
+
"@fluidframework/telemetry-utils": "2.63.0-359962",
|
|
85
85
|
"jsrsasign": "^11.0.0",
|
|
86
86
|
"uuid": "^11.1.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
90
90
|
"@biomejs/biome": "~1.9.3",
|
|
91
|
-
"@fluid-internal/mocha-test-setup": "2.63.0-
|
|
91
|
+
"@fluid-internal/mocha-test-setup": "2.63.0-359962",
|
|
92
92
|
"@fluid-tools/build-cli": "^0.58.3",
|
|
93
93
|
"@fluidframework/build-common": "^2.0.3",
|
|
94
94
|
"@fluidframework/build-tools": "^0.58.3",
|
|
@@ -16,7 +16,7 @@ import { shortCodeMap } from "./assertionShortCodesMap.js";
|
|
|
16
16
|
* it either returns true or throws an error (the behavior expected by NodeJS' `assert.throws()`).
|
|
17
17
|
*
|
|
18
18
|
* @param error - The error object thrown by our `assert()` function. Its `message` property could
|
|
19
|
-
* be a short code, or the original string message coded into the `
|
|
19
|
+
* be a short code, or the original string message coded into the `assert()`.
|
|
20
20
|
* @param expectedErrorMessage - The message that the error object should match (either explicitly,
|
|
21
21
|
* or because it contains a short code which maps to that message).
|
|
22
22
|
* @returns `true` if the message in the error object that was passed in matches the expected
|
|
@@ -27,7 +27,15 @@ export function validateAssertionError(
|
|
|
27
27
|
error: Error,
|
|
28
28
|
expectedErrorMsg: string | RegExp,
|
|
29
29
|
): boolean {
|
|
30
|
-
|
|
30
|
+
// Asserts with custom debugMessageBuilder put extra content on the second line of the message, even when tagged.
|
|
31
|
+
// Thus extract the first line, which will be the assert tag if there is one, and replace it with the message from the shortCodeMap.
|
|
32
|
+
const split = error.message.split("\n");
|
|
33
|
+
const possibleShortCode = split[0].trim();
|
|
34
|
+
if (possibleShortCode in shortCodeMap) {
|
|
35
|
+
split[0] = shortCodeMap[possibleShortCode];
|
|
36
|
+
}
|
|
37
|
+
const mappedMsg = split.join("\n");
|
|
38
|
+
|
|
31
39
|
if (
|
|
32
40
|
typeof expectedErrorMsg === "string"
|
|
33
41
|
? mappedMsg !== expectedErrorMsg
|
|
@@ -35,10 +43,7 @@ export function validateAssertionError(
|
|
|
35
43
|
) {
|
|
36
44
|
// This throws an Error instead of an AssertionError because AssertionError would require a dependency on the
|
|
37
45
|
// node assert library, which we don't want to do for this library because it's used in the browser.
|
|
38
|
-
const message =
|
|
39
|
-
shortCodeMap[error.message] === undefined
|
|
40
|
-
? `Unexpected assertion thrown\nActual: ${error.message}\nExpected: ${expectedErrorMsg}`
|
|
41
|
-
: `Unexpected assertion thrown\nActual: ${error.message} ('${mappedMsg}')\nExpected: ${expectedErrorMsg}`;
|
|
46
|
+
const message = `Unexpected assertion thrown\nActual: ${error.message === mappedMsg ? error.message : `${error.message} ('${mappedMsg}')}`}\nExpected: ${expectedErrorMsg}`;
|
|
42
47
|
throw new Error(message);
|
|
43
48
|
}
|
|
44
49
|
return true;
|