Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail (only) first time. #2

Open
bitifet opened this issue Jul 3, 2024 · 0 comments
Open

Tests fail (only) first time. #2

bitifet opened this issue Jul 3, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@bitifet
Copy link
Owner

bitifet commented Jul 3, 2024

Executing npm run test for the very first time (or after long time -I guess after reboot too-) always fail with the errors shown below.

If you hit Ctrl+C and then execute npm run test again, it will work and pass all tests.

No matter how many times you repeat it, it will work every time. But after a while, it happen again.

My guess is that it is something related to puppeteer first loading. But this is done (deeply) inside an async before hook so tests are supposed to not run after its resolution.

Sample output when fails:

$ npm run test

> [email protected] pretest
> npm run build


> [email protected] build
> rollup -c --environment BUILD:production


src/main.js → dist/SmarkForm.esm.js, dist/SmarkForm.umd.js...
created dist/SmarkForm.esm.js, dist/SmarkForm.umd.js in 2.8s

src/examples/index.js → tmp/index.js...
(!) Generated an empty chunk
"index"
created tmp/index.js in 491ms

> [email protected] test
> mocha



  General Functionality Tests
    1) "before all" hook for "Document loaded"
    2) "after all" hook for "Basic introspection works"

  List Component Type Test
    3) "before all" hook for "addItem action works"
    4) "after all" hook for "Exports correctly"


  0 passing (4s)
  4 failing

  1) General Functionality Tests
       "before all" hook for "Document loaded":
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/joanmi/Nextcloud/prj/lib/SmarkForm/test/general.tests.js)
      at listOnTimeout (node:internal/timers:573:17)
      at process.processTimers (node:internal/timers:514:7)

  2) General Functionality Tests
       "after all" hook for "Basic introspection works":
     TypeError: Cannot read properties of undefined (reading 'close')
      at Context.<anonymous> (file:///home/joanmi/Nextcloud/prj/lib/SmarkForm/test/general.tests.js:198:34)
      at process.processImmediate (node:internal/timers:478:21)

  3) List Component Type Test
       "before all" hook for "addItem action works":
     Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/joanmi/Nextcloud/prj/lib/SmarkForm/test/type_list.tests.js)
      at listOnTimeout (node:internal/timers:573:17)
      at process.processTimers (node:internal/timers:514:7)

  4) List Component Type Test
       "after all" hook for "Exports correctly":
     TypeError: Cannot read properties of undefined (reading 'close')
      at Context.<anonymous> (file:///home/joanmi/Nextcloud/prj/lib/SmarkForm/test/type_list.tests.js:184:34)
      at process.processImmediate (node:internal/timers:478:21)

^C

Sample output the rest of times:

$ npm run test

> [email protected] pretest
> npm run build


> [email protected] build
> rollup -c --environment BUILD:production


src/main.js → dist/SmarkForm.esm.js, dist/SmarkForm.umd.js...
created dist/SmarkForm.esm.js, dist/SmarkForm.umd.js in 1.6s

src/examples/index.js → tmp/index.js...
(!) Generated an empty chunk
"index"
created tmp/index.js in 214ms

> [email protected] test
> mocha



  General Functionality Tests
    ✔ Document loaded
    ✔ Basic introspection works

  List Component Type Test
    ✔ addItem action works (58ms)
    ✔ removeItem action works
    ✔ min_items limit applies
    ✔ max_items limit applies
    ✔ Imports correctly
    ✔ Exports correctly


  8 passing (2s)

@bitifet bitifet added the help wanted Extra attention is needed label Jul 3, 2024
@bitifet bitifet added good first issue Good for newcomers and removed good first issue Good for newcomers labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant