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.

Zora + pta doesn't work with top level dynamic imports

See original GitHub issue

Right now PTA reporter depends on all tests to be registered before the register function executes. It causes a race condition. We are using a framework which ends up importing tests like this:

import("test.mjs").catch(e => {
  if (e.code !== "ERR_MODULE_NOT_FOUND") {
    return Promise.reject(e);
  }
});

In that case, pta only works if synchronous module resolution for other tests (which are not using that framework) takes long enough for the promise above to be resolved. It’s a horrible race condition to have. In my opinion, the reporting step should only be concluded on beforeExit. If that was the case, dynamic imports would work as intended in this case.

https://nodejs.org/api/process.html#event-beforeexit

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
wokalskicommented, Jun 15, 2022

I created a mock PR

0reactions
lorenzofox3commented, Jun 15, 2022

Thanks, I have left a comment (I am not convinced this would solve the problem). It would be great if you could share an example of a test suite which reproduces the problem so I can eventually provide a solution

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · lorenzofox3/zora
Issues list ; Example of cleaner ts-node setup with pta + TypeScript documentation. #157 opened ; Zora + pta doesn't work with top...
Read more >
how to handle dynamic import for a const value using top ...
When I use await method in toplevel to export a const value i am getting error as "cannot use keyword await outside of...
Read more >
1540913 - Dynamic module import doesn't work in a worker
Attempting to import an ES6 module inside a worker fails with "SyntaxError: dynamic module import is not implemented". javascript.options.
Read more >
wjG - River Thames Conditions - Environment Agency - GOV.UK
Top ten air force world 2011, Metallica lead singer burned, Caregiver safety ... Salmanaim, Selbstsichernder knoten, Rayen stadium project, Problem solvers ...
Read more >
ejW - EVOLVE - eduFOCUS
Bruce's price is right intro, Hgfhfhfh? Men's floor final 2014, ... Wellington college fees 2013, Msn news live tile not working, Gyliano van...
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