Unable to test asynchronous code

Open
#142 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, node.js
Domain
testing-qa

Research direction

Start with lib/child.js at the _require function and trace how code-to-test.js is loaded before unit-tests.js runs. Evaluate the proposed promise-export approach and define the expected behavior for asynchronous dependencies. Done means the loading sequence waits correctly and the relevant asynchronous test cases pass.

Written by the indexing model from the issue text.

Description

support

Guys,

I am fully aware of the asynchronous helpers built in QUnit and I use them whenever the test is asynchronous. However, the problem I am dealing with is the code itself that is asynchronous.

For instance:

testrunner.run({
    code: 'code-to-test.js',
    tests: 'unit-tests.js'
})

In that example, code-to-test.js is actually loading asynchronous dependencies and I would like QUnit to wait before running the corresponding unit tests.

Checking node-qunit code, I would like child.js's _require function to be asynchronous.

Thinking about the way we could tell the function that it has to wait, I was thinking that if the loaded module exports a promise, we could wait for it to be resolved before continuing the load.

Any thoughts?

  • Arnaud
Dominant language
JavaScript
Stars
171
Forks
51
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from qunitjs/node-qunit

All issues in qunitjs/node-qunit

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.