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.

Empty test causes writableLength undefined error

See original GitHub issue

Describe the bug

I get this even with nothing but an empty test('', () => {}) in my test file:

text|nate/dev⚡ ⇒ yarn test
$ test
$ vitest --config ../vite-plugin-internal/vite.config.ts

 DEV  v0.17.1 /Users/n8/tamagui/packages/text

 ✓ src/wrapChildrenInText.test.tsx (2)

Test Files  1 passed (1)
     Tests  2 passed (2)
      Time  803ms (in thread 1ms, 80323.73%)

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Vitest caught 1 unhandled error during the test run. This might cause false positive tests.
Please, resolve all the errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: Errors occurred while running tests. For more information, see serialized error.
 ❯ Object.runTests ../../node_modules/vitest/dist/chunk-vite-node-externalize.0fc8ed68.mjs:7046:17
 ❯ processTicksAndRejections node:internal/process/task_queues:96:5
 ❯ async file:/Users/n8/tamagui/node_modules/vitest/dist/chunk-vite-node-externalize.0fc8ed68.mjs:10428:9
 ❯ Vitest.runFiles ../../node_modules/vitest/dist/chunk-vite-node-externalize.0fc8ed68.mjs:10441:12
 ❯ Vitest.start ../../node_modules/vitest/dist/chunk-vite-node-externalize.0fc8ed68.mjs:10362:5
 ❯ startVitest ../../node_modules/vitest/dist/chunk-vite-node-externalize.0fc8ed68.mjs:11110:5
 ❯ CAC.start ../../node_modules/vitest/dist/cli.mjs:666:9

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: {
  "errors": [
    [TypeError: Cannot read properties of undefined (reading 'writableLength')],
  ],
}
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  Tests failed. Watching for file changes...
       press h to show help, press q to quit

Reproduction

git clone git@github.com:tamagui/tamagui.git
cd tamagui
./script/ci-prepare.sh
yarn
cd packages/text
yarn test

System Info

System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
    Memory: 81.06 MB / 16.00 GB
    Shell: 5.8 - /opt/homebrew/bin/zsh
  Binaries:
    Node: 16.14.0 - ~/Library/Caches/fnm_multishells/69747_1653603955297/bin/node
    Yarn: 3.2.1 - ~/Library/Caches/fnm_multishells/69747_1653603955297/bin/yarn
    npm: 8.3.1 - ~/Library/Caches/fnm_multishells/69747_1653603955297/bin/npm
    Watchman: 2022.06.27.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 103.1.40.113
    Chrome: 102.0.5005.61
    Firefox: 100.0.2
    Safari: 15.5
    Safari Technology Preview: 16.0

Used Package Manager

yarn

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
natewcommented, Jul 17, 2022

Can confirm this is something to do with the CLI output, using --reporter json doesn’t produce the error.

0reactions
sheremet-vacommented, Sep 20, 2022

Still, I am not able to reproduce the error with reproduction steps that were provided.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stream | Node.js v19.3.0 Documentation
The 'error' event is emitted if an error occurred while writing or piping data. The listener callback is passed a single Error argument...
Read more >
TypeError: Cannot read property 'create' of undefined error
Hi I am creating NodeJS service with postgreSQL. When I trying to test POST method using postman. I got following error. Can you...
Read more >
Array.prototype.length - JavaScript - MDN Web Docs
When length is set to a bigger value than the current length, the array is extended by adding empty slots, not actual undefined...
Read more >
AWS Lambda function errors in Node.js
This page describes how to view Lambda function invocation errors for the Node.js runtime using the Lambda console and the AWS CLI.
Read more >
Best Practices for Node.js Error-handling - Toptal
A good example is to try to read a property of “undefined. ... They force you to check errors all the way down...
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