question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test output order incorrect when using ref requests

See original GitHub issue

common.http

{{
  module.exports = require('../../tests/')
}}

### Test common
# @name common
https://httpbin.org/status/200

{{
  tests.status.is(test, response, { val: 200 })
}}

245.http

# @import ./common.http
{{
  module.exports = require('../../tests/')
}}

### Test 1
# @ref common
https://httpbin.org/status/200

{{
  tests.status.is(test, response, { val: 200 })
}}

### Test 2
POST https://httpbin.org/post
Content-Type: application/json

{{_undefinedStuff}}

{{
  tests.status.is(test, response, { val: 200 })
}}

Execution

Running:

httpyac --all ./requests/bugs/245.http --output short

We get:

---------------------

=== Test common ===

GET https://httpbin.org/status/200
=> 200 (741 ms, 184 B)
✓ Status is valid
✓ Status is valid

---------------------

=== Test 1 ===

GET https://httpbin.org/status/200
=> 200 (530 ms, 184 B)
expression _undefinedStuff throws error
ReferenceError: _undefinedStuff is not defined
    at Object.<anonymous> (/httpyac-experiments/requests/bugs/245.http:19:20)
    at yt (/.nvm/versions/node/v17.3.1/lib/node_modules/httpyac/dist/index.js:3:40858)
    at Vt (/.nvm/versions/node/v17.3.1/lib/node_modules/httpyac/dist/index.js:3:41400)
    at /.nvm/versions/node/v17.3.1/lib/node_modules/httpyac/dist/index.js:3:44177
    at ee (/.nvm/versions/node/v17.3.1/lib/node_modules/httpyac/dist/index.js:2:30407)
    at Object.li [as action] (/.nvm/versions/node/v17.3.1/lib/node_modules/httpyac/dist/index.js:3:44142)
    at qt.<anonymous> (/.nvm/versions/node/v17.3.1/lib/node_modules/httpyac/node_modules/hookpoint/dist/index.js:1:2762)
    at Generator.next (<anonymous>)
    at u (/.nvm/versions/node/v17.3.1/lib/node_modules/httpyac/node_modules/hookpoint/dist/index.js:1:1262)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

---------------------

=== Test 2 ===

POST https://httpbin.org/post
=> 200 (999 ms, 627 B)
✓ Status is valid

3 requests tested (3 succeeded, 0 failed)

There are 2 issues I can see here:

  1. test common has the result of its own test, plus the test of the request which is referencing it
  2. Test 1 does not have the result of its own test (see 1 above), but instead does have an error related to Test 2

As a side note… I wonder if execution should be abandoned on throw… 🤔

Sorry to always be the bearer of bad news… 😇

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
AnWebercommented, May 5, 2022

@gerukin I agree with you that in case of error it would be better to output the title as well. I just don’t have a nice solution yet. I’ll create my own ticket to make it more visible again.

1reaction
AnWebercommented, Apr 25, 2022

@gerukin I think your problem here is still the lack of output that Test2 is currently running. Correct?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common mistakes with React Testing Library
Hi there I created React Testing Library because I wasn't satisfied with the testing landscape at the time. It expanded to DOM Testing...
Read more >
Best practices for writing unit tests - .NET
Learn best practices for writing unit tests that drive code quality and resilience for .NET Core and .NET Standard projects.
Read more >
REST API Testing Strategy: What Exactly Should You Test?
The API layer of any application is one of the most crucial software components. Here's a technical look at how we test our...
Read more >
COMMON ERRORS IN KRONOS AND HOW TO FIX THEM
Incorrectly recording overtime hours. Non-exempt employees who have approval to work overtime should record their total hours worked each day without using ......
Read more >
Unit Tests, How to Write Testable Code, and Why It Matters
Verifying that the system under test produces correct results, or that its resulting state is correct, is called state-based unit testing, while verifying...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found