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/apps/basics is non-deterministic

See original GitHub issue

Describe the bug I’ve encountered this twice now modifying unrelated files on two different branches.

Logs

CI logs
> test-basics@0.0.2 test /home/runner/work/kit/kit/test/apps/basics
> node test

dev
 dev  [snowpack] ! building dependencies...
[snowpack] ✔ dependencies ready! [1.09s]
  http://localhost:3001 • http://10.1.0.4:3001
  Server started.


• ✘ • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • •   (101 / 102)

   FAIL  dev  "announces client-side navigation [js]"
    Expected values to be deeply equal:  (equal)

        ++Navigated·to·b    (Expected)
        --                  (Actual)
          ^^^^^^^^^^^^^^
    at assert (file:///home/runner/work/kit/kit/node_modules/.pnpm/uvu@0.6.0-next.1/node_modules/uvu/assert/index.mjs:31:8)
    at Module.equal (file:///home/runner/work/kit/kit/node_modules/.pnpm/uvu@0.6.0-next.1/node_modules/uvu/assert/index.mjs:43:2)
    at file:///home/runner/work/kit/kit/test/apps/basics/src/routes/accessibility/__tests__.js:41:11
    at async Object.handler (file:///home/runner/work/kit/kit/test/runner.js:113:7)
    at async Number.runner (file:///home/runner/work/kit/kit/node_modules/.pnpm/uvu@0.6.0-next.1/node_modules/uvu/dist/index.mjs:78:5)
    at async Module.exec (file:///home/runner/work/kit/kit/node_modules/.pnpm/uvu@0.6.0-next.1/node_modules/uvu/dist/index.mjs:132:33)
    at async runner (file:///home/runner/work/kit/kit/test/runner.js:180:2)

To Reproduce Unknown. It’s some sort of race condition in the basics test.

Expected behavior Deterministic behavior.

Additional context First encountered in #402, then in #403. It’s most likely related to the fact that the test involves an await sleep(50):

https://github.com/sveltejs/kit/blob/67ddeeae1b9f1339e569ca8684e815928a755bdf/test/apps/basics/src/routes/accessibility/__tests__.js#L39-L41

Strongly related to #213.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
Conduitrycommented, Mar 17, 2021

And the tests were never flaky again, the end

0reactions
GrygrFlzrcommented, Mar 17, 2021

Farewell, angry red cross, I hope I never see you again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nondeterministic algorithm - Wikipedia
In computer programming, a nondeterministic algorithm is an algorithm that, even for the same input, can exhibit different behaviors on different runs, ...
Read more >
Before and after hooks for routing · Issue #552 · sveltejs/kit
Describe the bug onMount is not fired on page change, if the actual page component doesn't change. This is all routes which contain ......
Read more >
nondeterministic automaton in nLab
This will give the classical definition as a non-deterministic state-based system and then show how to turn that form into the coalgebraic form....
Read more >
Difference between Deterministic and Non ... - GeeksforGeeks
The non-deterministic algorithms can show different behaviors for the same input on different execution and there is a degree of randomness to ...
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