usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
25.26k stars 1.15k forks source link

GUI Test Runner does not detect test cases with import #2895

Open ant0x64 opened 3 weeks ago

ant0x64 commented 3 weeks ago

I have checked the following:

Describe the bug

If the test contains import of any library, Test Runner does not show the result of failed test, although if it executed individually - everything works correctly. This problem was not observed in the previous version.

.bru file to reproduce the bug

No response

Screenshots/Live demo link

Test case individually: image

With test runner: image image

ant0x64 commented 3 weeks ago

With Bruno CLI it works fine:

tests/admin/authorized/auth (201 Created) - 1070 ms
   ✓ assert: res.status: eq 201
   ✓ assert: res.body.accessToken: isDefined
   ✓ Response 201 and it has a token
tests/admin/authorized/providers (200 OK) - 352 ms
[Function: AssertionError]
AssertionError: expected 200 to equal 201
    at VM2 Wrapper.apply (/usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/vm2/lib/bridge.js:485:11)
    at /usr/src/app/vm.js:5:25
    at VM2 Wrapper.apply (/usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/vm2/lib/bridge.js:485:11)
    at /usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/js/src/test.js:3:11
    at VM2 Wrapper.apply (/usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/vm2/lib/bridge.js:485:11)
    at module.exports (/usr/src/app/vm.js:4:1)
    at VM2 Wrapper.apply (/usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/vm2/lib/bridge.js:485:11)
    at TestRuntime.runTests (/usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/js/src/runtime/test-runtime.js:155:11)
    at runSingleRequest (/usr/local/lib/node_modules/@usebruno/cli/src/runner/run-single-request.js:355:40)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler (/usr/local/lib/node_modules/@usebruno/cli/src/commands/run.js:560:24) {
  showDiff: true,
  actual: 200,
  expected: 201,
  operator: 'strictEqual'
}
   ✕ Reponse status should be 201
tests/admin/not-authorized/auth (201 Created) - 342 ms
   ✓ assert: res.status: eq 201
   ✓ assert: res.body.accessToken: isDefined
   ✓ Response 201 and it has a token
tests/admin/not-authorized/providers (401 Unauthorized) - 232 ms
[Function: AssertionError]
AssertionError: expected 401 to equal 200
    at VM2 Wrapper.apply (/usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/vm2/lib/bridge.js:485:11)
    at /usr/src/app/vm.js:4:25
    at VM2 Wrapper.apply (/usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/vm2/lib/bridge.js:485:11)
    at /usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/js/src/test.js:3:11
    at VM2 Wrapper.apply (/usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/vm2/lib/bridge.js:485:11)
    at module.exports (/usr/src/app/vm.js:3:1)
    at VM2 Wrapper.apply (/usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/vm2/lib/bridge.js:485:11)
    at TestRuntime.runTests (/usr/local/lib/node_modules/@usebruno/cli/node_modules/@usebruno/js/src/runtime/test-runtime.js:155:11)
    at runSingleRequest (/usr/local/lib/node_modules/@usebruno/cli/src/runner/run-single-request.js:355:40)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler (/usr/local/lib/node_modules/@usebruno/cli/src/commands/run.js:560:24) {
  showDiff: true,
  actual: 401,
  expected: 200,
  operator: 'strictEqual'
}
   ✕ Reponse status should be 200

Requests:    4 passed, 4 total
Tests:       2 passed, 2 failed, 4 total
Assertions:  4 passed, 4 total
Ran all requests - 1996 ms

Requests:    4 passed, 4 total
Tests:       2 passed, 2 failed, 4 total
Assertions:  4 passed, 4 total
Waiting for the debugger to disconnect...
ant0x64 commented 3 weeks ago

Rolling back to the previous version 1.25.0 resolved this issue (and many others GUI related issues)