mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
test: Create custom jest error messages using jest-expect-message (no-changelog) (#5666)
* using jest-expect-message to add custom error message * improve error message * improvements after merge --------- Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
parent
f00b2ae3ea
commit
ee582cc3bd
|
@ -22,6 +22,7 @@ const config = {
|
|||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
},
|
||||
setupFilesAfterEnv: ['jest-expect-message'],
|
||||
collectCoverage: true,
|
||||
coverageReporters: [process.env.COVERAGE_REPORT === 'true' ? 'text' : 'text-summary'],
|
||||
collectCoverageFrom: ['src/**/*.ts'],
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
"cypress-real-events": "^1.7.6",
|
||||
"jest": "^29.5.0",
|
||||
"jest-environment-jsdom": "^29.5.0",
|
||||
"jest-expect-message": "^1.1.3",
|
||||
"jest-mock": "^29.5.0",
|
||||
"jest-mock-extended": "^3.0.4",
|
||||
"nock": "^13.2.9",
|
||||
|
|
|
@ -318,9 +318,9 @@ export const equalityTest = async (testData: WorkflowTestData, types: INodeTypes
|
|||
|
||||
// check if result node data matches expected test data
|
||||
const resultNodeData = getResultNodeData(result, testData);
|
||||
|
||||
resultNodeData.forEach(({ nodeName, resultData }) => {
|
||||
return expect(resultData).toEqual(testData.output.nodeData[nodeName]);
|
||||
const msg = `Equality failed for "${testData.description}" at node "${nodeName}"`;
|
||||
return expect(resultData, msg).toEqual(testData.output.nodeData[nodeName]);
|
||||
});
|
||||
|
||||
expect(result.finished).toEqual(true);
|
||||
|
|
|
@ -71,6 +71,9 @@ importers:
|
|||
jest-environment-jsdom:
|
||||
specifier: ^29.5.0
|
||||
version: 29.5.0
|
||||
jest-expect-message:
|
||||
specifier: ^1.1.3
|
||||
version: 1.1.3
|
||||
jest-mock:
|
||||
specifier: ^29.5.0
|
||||
version: 29.5.0
|
||||
|
@ -11646,7 +11649,6 @@ packages:
|
|||
dependencies:
|
||||
ms: 2.1.3
|
||||
supports-color: 5.5.0
|
||||
dev: true
|
||||
|
||||
/debug@3.2.7(supports-color@8.1.1):
|
||||
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
|
||||
|
@ -11658,6 +11660,7 @@ packages:
|
|||
dependencies:
|
||||
ms: 2.1.3
|
||||
supports-color: 8.1.1
|
||||
dev: true
|
||||
|
||||
/debug@4.3.2:
|
||||
resolution: {integrity: sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==}
|
||||
|
@ -12568,7 +12571,7 @@ packages:
|
|||
/eslint-import-resolver-node@0.3.7:
|
||||
resolution: {integrity: sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==}
|
||||
dependencies:
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7(supports-color@5.5.0)
|
||||
is-core-module: 2.11.0
|
||||
resolve: 1.22.1
|
||||
transitivePeerDependencies:
|
||||
|
@ -12621,7 +12624,7 @@ packages:
|
|||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.59.0(eslint@8.39.0)(typescript@5.0.3)
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7(supports-color@5.5.0)
|
||||
eslint: 8.39.0
|
||||
eslint-import-resolver-node: 0.3.7
|
||||
eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@5.59.0)(eslint-plugin-import@2.27.5)(eslint@8.39.0)
|
||||
|
@ -12652,7 +12655,7 @@ packages:
|
|||
array-includes: 3.1.6
|
||||
array.prototype.flat: 1.3.1
|
||||
array.prototype.flatmap: 1.3.1
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7(supports-color@5.5.0)
|
||||
doctrine: 2.1.0
|
||||
eslint: 8.39.0
|
||||
eslint-import-resolver-node: 0.3.7
|
||||
|
@ -13535,7 +13538,7 @@ packages:
|
|||
debug:
|
||||
optional: true
|
||||
dependencies:
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7(supports-color@5.5.0)
|
||||
dev: false
|
||||
|
||||
/follow-redirects@1.15.2(debug@4.3.2):
|
||||
|
@ -14126,7 +14129,7 @@ packages:
|
|||
array-parallel: 0.1.3
|
||||
array-series: 0.1.5
|
||||
cross-spawn: 4.0.2
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7(supports-color@5.5.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
@ -14242,7 +14245,6 @@ packages:
|
|||
/has-flag@3.0.0:
|
||||
resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/has-flag@4.0.0:
|
||||
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
||||
|
@ -15496,6 +15498,10 @@ packages:
|
|||
jest-util: 29.5.0
|
||||
dev: true
|
||||
|
||||
/jest-expect-message@1.1.3:
|
||||
resolution: {integrity: sha512-bTK77T4P+zto+XepAX3low8XVQxDgaEqh3jSTQOG8qvPpD69LsIdyJTa+RmnJh3HNSzJng62/44RPPc7OIlFxg==}
|
||||
dev: true
|
||||
|
||||
/jest-get-type@29.2.0:
|
||||
resolution: {integrity: sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
|
@ -18632,7 +18638,7 @@ packages:
|
|||
resolution: {integrity: sha512-v6ZJ/efsBpGrGGknjtq9J/oC8tZWq0KWL5vQrk2GlzLEQPUDB1ex+13Rmidl1neNN358Jn9EHZw5y07FFtaC7A==}
|
||||
engines: {node: '>=6.8.1'}
|
||||
dependencies:
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7(supports-color@5.5.0)
|
||||
node-ensure: 0.0.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
@ -20118,7 +20124,7 @@ packages:
|
|||
/rhea@1.0.24:
|
||||
resolution: {integrity: sha512-PEl62U2EhxCO5wMUZ2/bCBcXAVKN9AdMSNQOrp3+R5b77TEaOSiy16MQ0sIOmzj/iqsgIAgPs1mt3FYfu1vIXA==}
|
||||
dependencies:
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7(supports-color@5.5.0)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
@ -20738,7 +20744,7 @@ packages:
|
|||
bignumber.js: 2.4.0
|
||||
binascii: 0.0.2
|
||||
browser-request: 0.3.3
|
||||
debug: 3.2.7(supports-color@8.1.1)
|
||||
debug: 3.2.7(supports-color@5.5.0)
|
||||
expand-tilde: 2.0.2
|
||||
extend: 3.0.2
|
||||
generic-pool: 3.9.0
|
||||
|
@ -21390,7 +21396,6 @@ packages:
|
|||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
has-flag: 3.0.0
|
||||
dev: true
|
||||
|
||||
/supports-color@6.1.0:
|
||||
resolution: {integrity: sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==}
|
||||
|
|
|
@ -20,5 +20,6 @@
|
|||
"sourceMap": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"exclude": ["**/dist/**/*", "**/node_modules/**/*"]
|
||||
"exclude": ["**/dist/**/*", "**/node_modules/**/*"],
|
||||
"files": ["node_modules/jest-expect-message/types/index.d.ts"]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue