You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a test using jest, I get the following output for a failed test
Error: expect(received).toStrictEqual(expected) // deep equality
- Expected - 1
+ Received + 1
@@ -23,11 +23,11 @@
"isSelected": true,
},
],
"damper_setup": "damper_1,damper_2",
"driver": "driver1",
- "id": 0,
+ "id": 1,
"isCurrentlyUsedInProfile": true,
"isIntermediateState": true,
"isSelectedForAll": false,
"lap": "LapName1",
"lap_id": 1,
at /home/user/git/web-apps/libs/porsche/validation/pages/validation-page/src/lib/services/lap-channe-type-table/lap-channel-type-table-data-creation.service.spec.ts:185:26
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)
at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)
at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)
at Zone.Object.<anonymous>.Zone.run (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)
at Object.wrappedFunc (/home/usergit/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4330:34)
at Promise.then.completed (/home/user/git/web-apps/node_modules/jest-circus/build/utils.js:333:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/user/git/web-apps/node_modules/jest-circus/build/utils.js:259:10)
at _callCircusTest (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:277:40)
at async _runTest (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:209:3)
at async _runTestsForDescribeBlock (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:97:9)
at async _runTestsForDescribeBlock (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:91:9)
at async run (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:31:3)
at async runAndTransformResultsToJestFormat (/home/user/git/web-apps/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:135:21)
but the resulting report file looks as follows.
{
"results": {
"tool": {
"name": "jest"
},
"summary": {
"tests": 2,
"passed": 0,
"failed": 1,
"pending": 1,
"skipped": 0,
"other": 0,
"start": 1717571297433,
"stop": 1717571299185
},
"tests": [
{
"name": "LapChannelTableDataCreationService should be created",
"duration": 0,
"status": "pending",
"rawStatus": "pending",
"type": "unit",
"filePath": "/home/user/git/web-apps/libs/porsche/validation/pages/validation-page/src/lib/services/lap-channe-type-table/lap-channel-type-table-data-creation.service.spec.ts",
"retry": 0,
"flake": false,
"suite": "lap-channel-type-table-data-creation.service.spec.ts > LapChannelTableDataCreationService"
},
{
"name": "LapChannelTableDataCreationService should return table data when valid data is provided",
"duration": 50,
"status": "failed",
"message": "Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoStrictEqual\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // deep equality\u001b[22m\n\n\u001b[32m- Expected - 1\u001b[39m\n\u001b[31m+ Received + 1\u001b[39m\n\n\u001b[33m@@ -23,11 +23,11 @@\u001b[39m\n\u001b[2m \"isSelected\": true,\u001b[22m\n\u001b[2m },\u001b[22m\n\u001b[2m ],\u001b[22m\n\u001b[2m \"damper_setup\": \"damper_1,damper_2\",\u001b[22m\n\u001b[2m \"driver\": \"driver1\",\u001b[22m\n\u001b[32m- \"id\": 0,\u001b[39m\n\u001b[31m+ \"id\": 1,\u001b[39m\n\u001b[2m \"isCurrentlyUsedInProfile\": true,\u001b[22m\n\u001b[2m \"isIntermediateState\": true,\u001b[22m\n\u001b[2m \"isSelectedForAll\": false,\u001b[22m\n\u001b[2m \"lap\": \"LapName1\",\u001b[22m\n\u001b[2m \"lap_id\": 1,\u001b[22m\n at /home/user/git/web-apps/libs/porsche/validation/pages/validation-page/src/lib/services/lap-channe-type-table/lap-channel-type-table-data-creation.service.spec.ts:185:26\n at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)\n at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)\n at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)\n at Zone.Object.<anonymous>.Zone.run (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)\n at Object.wrappedFunc (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4330:34)\n at Promise.then.completed (/home/user/git/web-apps/node_modules/jest-circus/build/utils.js:333:28)\n at new Promise (<anonymous>)\n at callAsyncCircusFn (/home/user/git/web-apps/node_modules/jest-circus/build/utils.js:259:10)\n at _callCircusTest (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:277:40)\n at async _runTest (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:209:3)\n at async _runTestsForDescribeBlock (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:97:9)\n at async _runTestsForDescribeBlock (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:91:9)\n at async run (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:31:3)\n at async runAndTransformResultsToJestFormat (/home/user/git/web-apps/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:135:21)",
"trace": "Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoStrictEqual\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // deep equality\u001b[22m\n\n\u001b[32m- Expected - 1\u001b[39m\n\u001b[31m+ Received + 1\u001b[39m\n\n\u001b[33m@@ -23,11 +23,11 @@\u001b[39m\n\u001b[2m \"isSelected\": true,\u001b[22m\n\u001b[2m },\u001b[22m\n\u001b[2m ],\u001b[22m\n\u001b[2m \"damper_setup\": \"damper_1,damper_2\",\u001b[22m\n\u001b[2m \"driver\": \"driver1\",\u001b[22m\n\u001b[32m- \"id\": 0,\u001b[39m\n\u001b[31m+ \"id\": 1,\u001b[39m\n\u001b[2m \"isCurrentlyUsedInProfile\": true,\u001b[22m\n\u001b[2m \"isIntermediateState\": true,\u001b[22m\n\u001b[2m \"isSelectedForAll\": false,\u001b[22m\n\u001b[2m \"lap\": \"LapName1\",\u001b[22m\n\u001b[2m \"lap_id\": 1,\u001b[22m\n at /home/user/git/web-apps/libs/porsche/validation/pages/validation-page/src/lib/services/lap-channe-type-table/lap-channel-type-table-data-creation.service.spec.ts:185:26\n at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/juser/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:409:30)\n at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:3830:43)\n at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invoke (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:408:56)\n at Zone.Object.<anonymous>.Zone.run (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:169:47)\n at Object.wrappedFunc (/home/user/git/web-apps/node_modules/zone.js/bundles/zone-testing-bundle.umd.js:4330:34)\n at Promise.then.completed (/home/user/git/web-apps/node_modules/jest-circus/build/utils.js:333:28)\n at new Promise (<anonymous>)\n at callAsyncCircusFn (/home/user/git/web-apps/node_modules/jest-circus/build/utils.js:259:10)\n at _callCircusTest (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:277:40)\n at async _runTest (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:209:3)\n at async _runTestsForDescribeBlock (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:97:9)\n at async _runTestsForDescribeBlock (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:91:9)\n at async run (/home/user/git/web-apps/node_modules/jest-circus/build/run.js:31:3)\n at async runAndTransformResultsToJestFormat (/home/user/git/web-apps/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:135:21)",
"rawStatus": "failed",
"type": "unit",
"filePath": "/home/user/git/web-apps/libs/porsche/validation/pages/validation-page/src/lib/services/lap-channe-type-table/lap-channel-type-table-data-creation.service.spec.ts",
"retry": 0,
"flake": false,
"suite": "lap-channel-type-table-data-creation.service.spec.ts > LapChannelTableDataCreationService"
}
]
}
}
So both test.message and test.trace contain both the error message and the stack trace. Would it be better to separate both message and stack trace? According to the key names, this seems to be the expected way to go.
I want to write a parser which uses the messages but does not necessarily use the trace. This would be a no-brainer with separate values, currently some parsing logic is needed which is by experience more or less flaky.
The text was updated successfully, but these errors were encountered:
When running a test using jest, I get the following output for a failed test
but the resulting report file looks as follows.
So both test.message and test.trace contain both the error message and the stack trace. Would it be better to separate both message and stack trace? According to the key names, this seems to be the expected way to go.
I want to write a parser which uses the messages but does not necessarily use the trace. This would be a no-brainer with separate values, currently some parsing logic is needed which is by experience more or less flaky.
The text was updated successfully, but these errors were encountered: