Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: use the default mocha reporter for better display for errors (#…
…1375) ## Context When running `yarn test:` commands (like `yarn test:server`), the displayed errors are difficult to read. Especially when comparing two objects deeply (using `assert.deepEqual`): I heavily use `yarn test:server` or `yarn test:gen-server` instead of `yarn test` in order to avoid launching a browser for the tests. An example of the display: ``` (2) Scim when enabled using GRIST_ENABLE_SCIM=1 DELETE /Users/{id} should return 403 for system users AssertionError: expected { schemas: [ 'urn:ietf:params:scim:api:messages:2.0:Error' ], status: '403', detail: 'System user deletion not permitted.' } to deeply equal { schemas: [ 'urn:ietf:params:scim:api:messages:2.0:Error' ], detail: 'System user deletion not permitted.' } at Proxy.assertEql (node_modules/chai/lib/chai/core/assertions.js:1084:10) at Proxy.methodWrapper (node_modules/chai/lib/chai/utils/addMethod.js:57:25) at doAsserterAsyncAndAddThen (node_modules/chai-as-promised/lib/chai-as-promised.js:289:22) at Proxy.<anonymous> (node_modules/chai-as-promised/lib/chai-as-promised.js:255:20) at Proxy.overwritingMethodWrapper (node_modules/chai/lib/chai/utils/overwriteMethod.js:78:33) at Function.assert.deepEqual.assert.deepStrictEqual (node_modules/chai/lib/chai/interface/assert.js:232:56) at checkOperationOnTechUserDisallowed (test/server/lib/Scim.ts:146:16) at processTicksAndRejections (node:internal/process/task_queues:105:5) at Context.<anonymous> (test/server/lib/Scim.ts:613:9) ``` ## Proposed solution We remove the `test/xunit-file` reporter and use the mocha default reporter. The above error is displayed like below, which is handier: ``` 2) Scim when enabled using GRIST_ENABLE_SCIM=1 DELETE /Users/{id} should return 403 for system users: AssertionError: expected { schemas: [ 'urn:ietf:params:scim:api:messages:2.0:Error' ], status: '403', detail: 'System user deletion not permitted.' } to deeply equal { schemas: [ 'urn:ietf:params:scim:api:messages:2.0:Error' ], detail: 'System user deletion not permitted.' } + expected - actual "detail": "System user deletion not permitted." "schemas": [ "urn:ietf:params:scim:api:messages:2.0:Error" ] - "status": "403" } at Proxy.assertEql (node_modules/chai/lib/chai/core/assertions.js:1084:10) at Proxy.methodWrapper (node_modules/chai/lib/chai/utils/addMethod.js:57:25) at doAsserterAsyncAndAddThen (node_modules/chai-as-promised/lib/chai-as-promised.js:289:22) at Proxy.<anonymous> (node_modules/chai-as-promised/lib/chai-as-promised.js:255:20) at Proxy.overwritingMethodWrapper (node_modules/chai/lib/chai/utils/overwriteMethod.js:78:33) at Function.assert.deepEqual.assert.deepStrictEqual (node_modules/chai/lib/chai/interface/assert.js:232:56) at checkOperationOnTechUserDisallowed (test/server/lib/Scim.ts:146:16) at processTicksAndRejections (node:internal/process/task_queues:105:5) at Context.<anonymous> (test/server/lib/Scim.ts:613:9) ``` Alternatively, we may only use the `test/xunit-file` reporter when running the tests in Jenkins ## Has this been tested? <!-- Put an `x` in the box that applies: --> - [ ] 👍 yes, I added tests to the test suite - [ ] 💭 no, because this PR is a draft and still needs work - [x] 🙅 no, because this is not relevant here - [ ] 🙋 no, because I need help <!-- Detail how we can help you -->
- Loading branch information