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

Running tests crashes node w/ JSDOM and vue 2 vite plugin #1171

Closed
5 of 6 tasks
ScottAwesome opened this issue Apr 20, 2022 · 24 comments
Closed
5 of 6 tasks

Running tests crashes node w/ JSDOM and vue 2 vite plugin #1171

ScottAwesome opened this issue Apr 20, 2022 · 24 comments

Comments

@ScottAwesome
Copy link

ScottAwesome commented Apr 20, 2022

Describe the bug

The issue I keep running into is my tests keep crashing whenever I run vitest. I have also noticed that my tests are not properly isolated from one another, and I'm using @testing-library/vue version 5.8.2 as well as @testing-library/jest-dom for additional matchers. I end up in situations where I can see clearly from the error messages from @testing-library/vue that its re-rendering my components in a non isolated fashion.

Note that all of these tests run fine when using Jest.

My config

import { defineConfig } from 'vitest/config';
import { createVuePlugin } from 'vite-plugin-vue2';
import path from 'path';
import { fileURLToPath } from 'url';

const root = path.dirname(fileURLToPath(import.meta.url));

export default defineConfig({
    plugins: [createVuePlugin()],
    css: {
        preprocessorOptions: {
            scss: {
                additionalData: `@import "${path.resolve(root, 'style/variables/index.scss')}";`
            }
        }
    },
    resolve: {
        mainFields: ['module', 'es2015', 'browser', 'jsnext:main', 'jsnext', 'main'],
        extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.less', '.css', '.scss', '.vue'],
        alias: [
            {
                find: /^@test\/utils$/,
                replacement: path.join(root, 'test-utils', 'index.ts')
            }
        ]
    },
    test: {
        environment: 'jsdom',
        clearMocks: true,
        restoreMocks: true,
        mockReset: true,
        watch: false,
        isolate: true,
        transformMode: {
            web: [/\.([cm]?[jt]sx?|json|vue)$/]
        }
    }
});

This is the error I run into whenever I run tests. its not a ton of tests, its approximately 74 total

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x70000c1d7400
 1: 0x106042a52 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [~/.nvm/versions/node/v16.14.2/bin/node]
 2: 0x107016d43 V8_Fatal(char const*, ...) [~/.nvm/versions/node/v16.14.2/bin/node]
 3: 0x10643075e v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [~/.nvm/versions/node/v16.14.2/bin/node]
 4: 0x106166f46 v8::ArrayBuffer::GetBackingStore() [~/.nvm/versions/node/v16.14.2/bin/node]
 5: 0x105facd6b node::Buffer::Data(v8::Local<v8::Value>) [~/.nvm/versions/node/v16.14.2/bin/node]
 6: 0x105fdc77b node::fs::Read(v8::FunctionCallbackInfo<v8::Value> const&) [~/.nvm/versions/node/v16.14.2/bin/node]
 7: 0x1061bd219 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [~/.nvm/versions/node/v16.14.2/bin/node]
 8: 0x1061bcce6 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [~/.nvm/versions/node/v16.14.2/bin/node]
 9: 0x1061bc45f v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [~/.nvm/versions/node/v16.14.2/bin/node]
10: 0x106a2f959 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [~/.nvm/versions/node/v16.14.2/bin/node]
11: 0x65d8cd21e
12: 0x65d8cc9f9
13: 0x65d8ce22d
[1]    29228 illegal hardware instruction  npm run test

Reproduction

Between my companies policy of privacy around the repository in question and the fact we use a custom registry with pre-built dependencies (so the dependencies are not available on github) I'm not able to really at a reproduction.

What I can do is partner with a repo maintainer to troubleshoot the issue in a live session, though I get why this is way less than ideal. I'm going to try and see if I can get something up by reproducing it via hard extracting some packages we pre-built (this may be feasible).

System Info

System:
    OS: macOS 12.3.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 1.62 GB / 32.00 GB
    Shell: 5.8.1 - /usr/local/bin/zsh
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 1.22.18 - ~/.nvm/versions/node/v16.14.2/bin/yarn
    npm: 8.7.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
  Browsers:
    Chrome: 100.0.4896.127
    Chrome Canary: 103.0.5012.0
    Edge: 100.0.1185.44
    Firefox: 99.0.1
    Firefox Developer Edition: 100.0
    Safari: 15.4
    Safari Technology Preview: 15.4
  npmPackages:
    vite: ^2.9.5 => 2.9.5
    vitest: ^0.9.3 => 0.9.3

Used Package Manager

npm

Validations

@sheremet-va
Copy link
Member

We can’t hep you without a reproduction. Try at least to create a minimal reproduction.

@sua-dawn
Copy link

sua-dawn commented Apr 20, 2022

I'm seeing the same error in a Vue 3 project, both with jsdom & happy-dom. Tried to reproduce in a sharable project, but could not reproduce it in a simple setup (can't spend more time on it right now).

It's worth mentioning, that I'm only getting this error when running node@16... I'm not able to reproduce in either node@14, node@17 & node@18.

@ScottAwesome can you confirm this? (kind reminder to do a rm -rf node_modules/ && yarn when switching node-version 🙂).

EDIT: Seems to happen after a few runs, easiest to trigger in watch mode.

@ScottAwesome
Copy link
Author

@sheremet-va the problem is I can't give access to a direct copy of the repository due to company restrictions.

I tried to make a reproduction on stackblitz but it wants me to have a pro account due to the number of files. Open to other suggestions

@ScottAwesome
Copy link
Author

@sua-dawn still happens with node 16, 17, and 18

@ScottAwesome
Copy link
Author

I can confirm that Jest runs the test fine.

@sua-dawn
Copy link

@sua-dawn still happens with node 16, 17, and 18

Just before shutting down for the day, yesterday, I did encounter a single error using node@17... Sorry for what was most probably a wild-goose chase.

Just for comparison here's my system info:

  System:
    OS: macOS 12.3.1
    CPU: (8) arm64 Apple M1
    Memory: 245.28 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.2 - ~/n/bin/node
    Yarn: 1.22.18 - ~/.yarn/bin/yarn
    npm: 8.5.0 - ~/n/bin/npm
    Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 100.0.4896.127
    Firefox: 99.0.1
    Safari: 15.4
  npmPackages:
    @vitejs/plugin-vue: ^2.2.0 => 2.3.1
    vite: ^2.9.5 => 2.9.5
    vitest: ^0.9.3 => 0.9.3

(different architecture, and different node-version manager... so those can probably be excluded as causes)

Click to expand full error output
#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x172745ce8
 1: 0x102b789e4 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/Users/sua/n/bin/node]
 2: 0x103919d10 V8_Fatal(char const*, ...) [/Users/sua/n/bin/node]
 3: 0x102efe554 v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/Users/sua/n/bin/node]
 4: 0x102c7ac8c v8::ArrayBuffer::GetBackingStore() [/Users/sua/n/bin/node]
 5: 0x102af71f0 node::Buffer::Data(v8::Local<v8::Value>) [/Users/sua/n/bin/node]
 6: 0x102b21d20 node::fs::Read(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/sua/n/bin/node]
 7: 0x102cd4d78 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/sua/n/bin/node]
 8: 0x102cd4870 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/sua/n/bin/node]
 9: 0x102cd40fc v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/Users/sua/n/bin/node]
10: 0x103414bcc Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/sua/n/bin/node]
11: 0xa1009fba8
12: 0xa100a1070
13: 0xa100a03ec
14: 0xa100d17c0
15: 0xa100a578c
16: 0xa100a4a74
17: 0xa100985e8
18: 0xa10096d3c
19: 0x1033a8718 Builtins_InterpreterEntryTrampoline [/Users/sua/n/bin/node]
20: 0xa1001fbd0
21: 0xa100d233c
22: 0xa100a578c
23: 0xa100a4a74
24: 0xa100985e8
25: 0xa10096d3c
26: 0x1033a8718 Builtins_InterpreterEntryTrampoline [/Users/sua/n/bin/node]
27: 0xa1001fbd0
28: 0xa100d233c
29: 0xa100a578c
30: 0xa100a4a74
31: 0xa100985e8
32: 0xa10096d3c
33: 0x1033a8718 Builtins_InterpreterEntryTrampoline [/Users/sua/n/bin/node]
34: 0xa1001fbd0
35: 0xa100d233c
36: 0xa100a578c
37: 0xa100a4a74
38: 0xa100985e8
39: 0xa10096d3c
40: 0x1033a8718 Builtins_InterpreterEntryTrampoline [/Users/sua/n/bin/node]
41: 0xa1001fbd0
42: 0xa100d233c
43: 0xa100a578c
44: 0xa100a4a74
45: 0xa100985e8
46: 0xa10096d3c
47: 0x1033a8718 Builtins_InterpreterEntryTrampoline [/Users/sua/n/bin/node]
48: 0xa1001fbd0
49: 0xa100d233c
50: 0xa100a578c
51: 0xa100a4a74
52: 0xa100985e8
53: 0xa10096d3c
54: 0x1033a8718 Builtins_InterpreterEntryTrampoline [/Users/sua/n/bin/node]
55: 0xa1001fbd0
56: 0xa100d233c
57: 0xa100a578c
58: 0xa100a4a74
59: 0xa100985e8
60: 0xa10096d3c
61: 0x1033a8718 Builtins_InterpreterEntryTrampoline [/Users/sua/n/bin/node]
62: 0xa1001fbd0
63: 0xa100d233c
64: 0xa100a578c
65: 0xa100a4a74
66: 0x1033a8718 Builtins_InterpreterEntryTrampoline [/Users/sua/n/bin/node]
67: 0x1033a650c Builtins_JSEntryTrampoline [/Users/sua/n/bin/node]
68: 0x1033a61a4 Builtins_JSEntry [/Users/sua/n/bin/node]
69: 0x102d77d64 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/sua/n/bin/node]
70: 0x102d773f8 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/Users/sua/n/bin/node]
71: 0x102c84888 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Users/sua/n/bin/node]
72: 0x102ae3908 node::loader::ModuleWrap::SyntheticModuleEvaluationStepsCallback(v8::Local<v8::Context>, v8::Local<v8::Module>) [/Users/sua/n/bin/node]
73: 0x10303e000 v8::internal::SyntheticModule::Evaluate(v8::internal::Isolate*, v8::internal::Handle<v8::internal::SyntheticModule>) [/Users/sua/n/bin/node]
74: 0x102c719f0 v8::Module::Evaluate(v8::Local<v8::Context>) [/Users/sua/n/bin/node]
75: 0x102ae4edc node::loader::ModuleWrap::Evaluate(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/sua/n/bin/node]
76: 0x102cd4d78 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/sua/n/bin/node]
77: 0x102cd4870 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/sua/n/bin/node]
78: 0x102cd40fc v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/Users/sua/n/bin/node]
79: 0x103414bcc Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/sua/n/bin/node]
80: 0x1033a8718 Builtins_InterpreterEntryTrampoline [/Users/sua/n/bin/node]
81: 0x1033d7d14 Builtins_AsyncFunctionAwaitResolveClosure [/Users/sua/n/bin/node]
82: 0x10345cbb8 Builtins_PromiseFulfillReactionJob [/Users/sua/n/bin/node]
83: 0x1033ca0f4 Builtins_RunMicrotasks [/Users/sua/n/bin/node]
84: 0x1033a63e4 Builtins_JSRunMicrotasksEntry [/Users/sua/n/bin/node]
85: 0x102d77d2c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/sua/n/bin/node]
86: 0x102d78160 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/sua/n/bin/node]
87: 0x102d7824c v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*) [/Users/sua/n/bin/node]
88: 0x102d9ae88 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/Users/sua/n/bin/node]
89: 0x102d9b71c v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/Users/sua/n/bin/node]
90: 0x102a65db4 node::InternalCallbackScope::Close() [/Users/sua/n/bin/node]
91: 0x102a657c4 node::InternalCallbackScope::~InternalCallbackScope() [/Users/sua/n/bin/node]
92: 0x102b1c1d0 node::fs::FileHandle::CloseReq::Resolve() [/Users/sua/n/bin/node]
93: 0x102b2ef00 node::fs::FileHandle::ClosePromise()::$_0::__invoke(uv_fs_s*) [/Users/sua/n/bin/node]
94: 0x103386aa4 uv__work_done [/Users/sua/n/bin/node]
95: 0x10338a240 uv__async_io [/Users/sua/n/bin/node]
96: 0x10339bfb8 uv__io_poll [/Users/sua/n/bin/node]
97: 0x10338a6d0 uv_run [/Users/sua/n/bin/node]
98: 0x102a66ccc node::SpinEventLoop(node::Environment*) [/Users/sua/n/bin/node]
99: 0x102bab768 node::worker::Worker::Run() [/Users/sua/n/bin/node]
100: 0x102bae990 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/Users/sua/n/bin/node]
101: 0x1a7fb226c _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
102: 0x1a7fad08c thread_start [/usr/lib/system/libsystem_pthread.dylib]

Today I've gone through all test skipping all but one, the error occurred eventually on all individual tests - if that helps anything.

@ScottAwesome
Copy link
Author

ScottAwesome commented Apr 21, 2022

I wonder if its the worker pool situation based on the following:

98: 0x102a66ccc node::SpinEventLoop(node::Environment*) [/Users/sua/n/bin/node]
99: 0x102bab768 node::worker::Worker::Run() [/Users/sua/n/bin/node]
100: 0x102bae990 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/Users/sua/n/bin/node]
101: 0x1a7fb226c _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
102: 0x1a7fad08c thread_start [/usr/lib/system/libsystem_pthread.dylib]

I'm not sure how to introspect the run in such a way I can log dump on that though

@sua-dawn
Copy link

sua-dawn commented Apr 22, 2022

@ScottAwesome I think you're right.
Setting max- and minThreads (FYI setting only maxThreads throws an error..) in vitest.config.ts to 1, "avoids" the problem - set them to 2 and the issue is back.

EDIT: Oh.. threads: false does the same as min/maxThreads (pretty new to Vitest 🤷‍♂️).

@sua-dawn
Copy link

Hmm, couldn't it be this:

close: async() => {}, // TODO: not sure why this will cause Node crash: pool.destroy(),
(the comment indicates it...)

It's not awaited here:
https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/node/core.ts#L58-L59

Sorry if this is unrelated, just browsing around atm.

@kswope
Copy link

kswope commented Apr 23, 2022

@sua-dawn
Copy link

sua-dawn commented Apr 23, 2022

@kswope appreciate the effort, but the linked repo errors out because the async supertest request isn't handled (returned or awaited).
The mentioned bug happens at random. Sometimes the tests goes through, but randomly crashes with an error looking similar to the one in your repo.

https://github.com/kswope/vitetest_thread_crash
The broken test is fixable in the following ways:

test("crashes with then or catch", async () => {
  try {
    const res = await request(app()).get("/user")
    console.log(res.body)
  } catch (err) {
    // ...
  }
})
test("crashes with then or catch", () => {
  return request(app())
    .get("/user")
    .then((res) => console.log(res.body)) // comment to prevent crashing
    .catch() // comment to prevent crashing
})

EDIT: Callback example removed, deprecated from [email protected]

@kswope
Copy link

kswope commented Apr 23, 2022

@sua-dawn

Ok the errors to me looked similar but I guess they aren't the same. I was looking at only what @ScottAwesome posted.

I guess with vitest not returning a pending supertest promise ends up with a horrible crash but in jest it doesn't - live and learn. At least with vitest you don't have to babel everything :)

@sua-dawn
Copy link

FYI: This is still an issue in [email protected].

@sheremet-va
Copy link
Member

We made a change in the latest version that should help with that, can you verify please?

@sua-dawn
Copy link

@sheremet-va just tried out [email protected] - the error still occurs.. at random (for me at least).

@dartess
Copy link

dartess commented May 11, 2022

Hey guys. Join this sad club. The same problem - this error appears from time to time.

Differences: macOS 12.3.1, M1 Pro processor, [email protected].

The stack is always different.

Examples
#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x173d6b0f8
 1: 0x103003be8 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 2: 0x103da5c70 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 3: 0x10338a244 v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/usr/local/bin/node]
 4: 0x10310697c v8::ArrayBuffer::GetBackingStore() [/usr/local/bin/node]
 5: 0x102f835b0 node::Buffer::Data(v8::Local<v8::Value>) [/usr/local/bin/node]
 6: 0x102facda4 node::fs::Read(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 7: 0x103160a68 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 8: 0x103160560 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 9: 0x10315fdec v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
10: 0x1038a08cc Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
11: 0xf380e0220
12: 0xf380e1310
13: 0xf380e1a2c
14: 0xf381127c0
15: 0xf380e3f0c
16: 0xf380e5c14
17: 0xf380d86a8
18: 0xf380d765c
19: 0x103834418 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
20: 0xf380ed9f0
21: 0xf3811333c
22: 0xf380e3f0c
23: 0xf380e5c14
24: 0xf380d86a8
25: 0xf380d765c
26: 0x103834418 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
27: 0xf380ed9f0
28: 0xf3811333c
29: 0xf380e3f0c
30: 0xf380e5c14
31: 0xf380d86a8
32: 0xf380d765c
33: 0x103834418 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
34: 0xf380ed9f0
35: 0xf3811333c
36: 0xf380e3f0c
37: 0xf380e5c14
38: 0x103834418 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
39: 0x10383220c Builtins_JSEntryTrampoline [/usr/local/bin/node]
40: 0x103831ea4 Builtins_JSEntry [/usr/local/bin/node]
41: 0x103203a54 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
42: 0x1032030e8 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) [/usr/local/bin/node]
43: 0x103110578 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/usr/local/bin/node]
44: 0x102f6fa28 node::loader::ModuleWrap::SyntheticModuleEvaluationStepsCallback(v8::Local<v8::Context>, v8::Local<v8::Module>) [/usr/local/bin/node]
45: 0x1034c9cf0 v8::internal::SyntheticModule::Evaluate(v8::internal::Isolate*, v8::internal::Handle<v8::internal::SyntheticModule>) [/usr/local/bin/node]
46: 0x1030fd6e0 v8::Module::Evaluate(v8::Local<v8::Context>) [/usr/local/bin/node]
47: 0x102f70ffc node::loader::ModuleWrap::Evaluate(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
48: 0x103160a68 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
49: 0x103160560 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
50: 0x10315fdec v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
51: 0x1038a08cc Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
52: 0x103834418 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
53: 0x103863a14 Builtins_AsyncFunctionAwaitResolveClosure [/usr/local/bin/node]
54: 0x1038e88b8 Builtins_PromiseFulfillReactionJob [/usr/local/bin/node]
55: 0x103855df4 Builtins_RunMicrotasks [/usr/local/bin/node]
56: 0x1038320e4 Builtins_JSRunMicrotasksEntry [/usr/local/bin/node]
57: 0x103203a1c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
58: 0x103203e50 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
59: 0x103203f3c v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*) [/usr/local/bin/node]
60: 0x103226b78 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/usr/local/bin/node]
61: 0x10322740c v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/usr/local/bin/node]
62: 0x102ef1db4 node::InternalCallbackScope::Close() [/usr/local/bin/node]
63: 0x102ef17c4 node::InternalCallbackScope::~InternalCallbackScope() [/usr/local/bin/node]
64: 0x102fa7254 node::fs::FileHandle::CloseReq::Resolve() [/usr/local/bin/node]
65: 0x102fb9f84 node::fs::FileHandle::ClosePromise()::$_0::__invoke(uv_fs_s*) [/usr/local/bin/node]
66: 0x103812794 uv__work_done [/usr/local/bin/node]
67: 0x103815f30 uv__async_io [/usr/local/bin/node]
68: 0x103827ca8 uv__io_poll [/usr/local/bin/node]
69: 0x1038163c0 uv_run [/usr/local/bin/node]
70: 0x102ef2ccc node::SpinEventLoop(node::Environment*) [/usr/local/bin/node]
71: 0x1030369e8 node::worker::Worker::Run() [/usr/local/bin/node]
72: 0x103039c10 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/usr/local/bin/node]
73: 0x1aabc9240 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
74: 0x1aabc4024 thread_start [/usr/lib/system/libsystem_pthread.dylib]




#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x17ca7d368
 1: 0x100d9fbe8 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 2: 0x101b41c70 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 3: 0x101126244 v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/usr/local/bin/node]
 4: 0x100ea297c v8::ArrayBuffer::GetBackingStore() [/usr/local/bin/node]
 5: 0x100d08980 node::ArrayBufferViewContents<unsigned char, 64ul>::Read(v8::Local<v8::ArrayBufferView>) [/usr/local/bin/node]
 6: 0x100d24604 void node::Buffer::(anonymous namespace)::StringSlice<(node::encoding)3>(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 7: 0x100efca68 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 8: 0x100efc560 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 9: 0x100efbdec v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
10: 0x10163c8cc Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
11: 0x78007b014
12: 0x780097ed4
13: 0x78004bb0c
14: 0x78008834c
15: 0x78008855c
16: 0x780067f2c
17: 0x1015ffa14 Builtins_AsyncFunctionAwaitResolveClosure [/usr/local/bin/node]
18: 0x1016848b8 Builtins_PromiseFulfillReactionJob [/usr/local/bin/node]
19: 0x1015f1df4 Builtins_RunMicrotasks [/usr/local/bin/node]
20: 0x1015ce0e4 Builtins_JSRunMicrotasksEntry [/usr/local/bin/node]
21: 0x100f9fa1c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
22: 0x100f9fe50 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
23: 0x100f9ff3c v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*) [/usr/local/bin/node]
24: 0x100fc2b78 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/usr/local/bin/node]
25: 0x100fc340c v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/usr/local/bin/node]
26: 0x100c8ddb4 node::InternalCallbackScope::Close() [/usr/local/bin/node]
27: 0x100c8d7c4 node::InternalCallbackScope::~InternalCallbackScope() [/usr/local/bin/node]
28: 0x100d43254 node::fs::FileHandle::CloseReq::Resolve() [/usr/local/bin/node]
29: 0x100d55f84 node::fs::FileHandle::ClosePromise()::$_0::__invoke(uv_fs_s*) [/usr/local/bin/node]
30: 0x1015ae794 uv__work_done [/usr/local/bin/node]
31: 0x1015b1f30 uv__async_io [/usr/local/bin/node]
32: 0x1015c3ca8 uv__io_poll [/usr/local/bin/node]
33: 0x1015b23c0 uv_run [/usr/local/bin/node]
34: 0x100c8eccc node::SpinEventLoop(node::Environment*) [/usr/local/bin/node]
35: 0x100dd29e8 node::worker::Worker::Run() [/usr/local/bin/node]
36: 0x100dd5c10 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/usr/local/bin/node]
37: 0x1aabc9240 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
38: 0x1aabc4024 thread_start [/usr/lib/system/libsystem_pthread.dylib]





#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x16d545168
 1: 0x1029c3be8 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 2: 0x103765c70 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 3: 0x102d4a244 v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/usr/local/bin/node]
 4: 0x102ac697c v8::ArrayBuffer::GetBackingStore() [/usr/local/bin/node]
 5: 0x1029435b0 node::Buffer::Data(v8::Local<v8::Value>) [/usr/local/bin/node]
 6: 0x102a0b280 node::StreamBase::WriteBuffer(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 7: 0x102a0cac4 void node::StreamBase::JSMethod<&(node::StreamBase::WriteBuffer(v8::FunctionCallbackInfo<v8::Value> const&))>(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 8: 0x102b20a68 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 9: 0x102b20560 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
10: 0x102b1fdec v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
11: 0x1032608cc Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
12: 0x1077ce688
13: 0x1075a849c
14: 0x107762060
15: 0x1075a8634
16: 0x10774d31c
17: 0x10777b0a4
18: 0x1075a873c
19: 0x1076db2f0
20: 0x107768220
21: 0x1077b9254
22: 0x10776ab0c
23: 0x1077685fc
24: 0x1032a6e00 Builtins_PromiseConstructor [/usr/local/bin/node]
25: 0x1031f1650 Builtins_JSBuiltinsConstructStub [/usr/local/bin/node]
26: 0x107768814
27: 0x107768944
28: 0x107769a20
29: 0x103223a14 Builtins_AsyncFunctionAwaitResolveClosure [/usr/local/bin/node]
30: 0x1032a88b8 Builtins_PromiseFulfillReactionJob [/usr/local/bin/node]
31: 0x103215df4 Builtins_RunMicrotasks [/usr/local/bin/node]
32: 0x1031f20e4 Builtins_JSRunMicrotasksEntry [/usr/local/bin/node]
33: 0x102bc3a1c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
34: 0x102bc3e50 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
35: 0x102bc3f3c v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*) [/usr/local/bin/node]
36: 0x102be6b78 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/usr/local/bin/node]
37: 0x102be740c v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/usr/local/bin/node]
38: 0x1028b1db4 node::InternalCallbackScope::Close() [/usr/local/bin/node]
39: 0x1028b17c4 node::InternalCallbackScope::~InternalCallbackScope() [/usr/local/bin/node]
40: 0x102967254 node::fs::FileHandle::CloseReq::Resolve() [/usr/local/bin/node]
41: 0x102979f84 node::fs::FileHandle::ClosePromise()::$_0::__invoke(uv_fs_s*) [/usr/local/bin/node]
42: 0x1031d2794 uv__work_done [/usr/local/bin/node]
43: 0x1031d5f30 uv__async_io [/usr/local/bin/node]
44: 0x1031e7ca8 uv__io_poll [/usr/local/bin/node]
45: 0x1031d63c0 uv_run [/usr/local/bin/node]
46: 0x1028b2ccc node::SpinEventLoop(node::Environment*) [/usr/local/bin/node]
47: 0x10299d6e0 node::NodeMainInstance::Run(int*, node::Environment*) [/usr/local/bin/node]
48: 0x10299d3ac node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/usr/local/bin/node]
49: 0x1029372e0 node::Start(int, char**) [/usr/local/bin/node]
50: 0x1072890f4



#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x1706ed368
 1: 0x104623be8 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 2: 0x1053c5c70 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 3: 0x1049aa244 v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/usr/local/bin/node]
 4: 0x10472697c v8::ArrayBuffer::GetBackingStore() [/usr/local/bin/node]
 5: 0x10458c980 node::ArrayBufferViewContents<unsigned char, 64ul>::Read(v8::Local<v8::ArrayBufferView>) [/usr/local/bin/node]
 6: 0x1045a8604 void node::Buffer::(anonymous namespace)::StringSlice<(node::encoding)3>(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 7: 0x104780a68 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 8: 0x104780560 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 9: 0x10477fdec v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
10: 0x104ec08cc Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
11: 0xa4807aad4
12: 0xa48097bf4
13: 0xa4804bb0c
14: 0xa4808a8cc
15: 0xa4808aadc
16: 0xa48067f2c
17: 0x104e83a14 Builtins_AsyncFunctionAwaitResolveClosure [/usr/local/bin/node]
18: 0x104f088b8 Builtins_PromiseFulfillReactionJob [/usr/local/bin/node]
19: 0x104e75df4 Builtins_RunMicrotasks [/usr/local/bin/node]
20: 0x104e520e4 Builtins_JSRunMicrotasksEntry [/usr/local/bin/node]
21: 0x104823a1c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
22: 0x104823e50 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
23: 0x104823f3c v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*) [/usr/local/bin/node]
24: 0x104846b78 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/usr/local/bin/node]
25: 0x10484740c v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/usr/local/bin/node]
26: 0x104511db4 node::InternalCallbackScope::Close() [/usr/local/bin/node]
27: 0x1045117c4 node::InternalCallbackScope::~InternalCallbackScope() [/usr/local/bin/node]
28: 0x1045c7254 node::fs::FileHandle::CloseReq::Resolve() [/usr/local/bin/node]
29: 0x1045d9f84 node::fs::FileHandle::ClosePromise()::$_0::__invoke(uv_fs_s*) [/usr/local/bin/node]
30: 0x104e32794 uv__work_done [/usr/local/bin/node]
31: 0x104e35f30 uv__async_io [/usr/local/bin/node]
32: 0x104e47ca8 uv__io_poll [/usr/local/bin/node]
33: 0x104e363c0 uv_run [/usr/local/bin/node]
34: 0x104512ccc node::SpinEventLoop(node::Environment*) [/usr/local/bin/node]
35: 0x1046569e8 node::worker::Worker::Run() [/usr/local/bin/node]
36: 0x104659c10 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/usr/local/bin/node]
37: 0x1a90dd240 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
38: 0x1a90d8024 thread_start [/usr/lib/system/libsystem_pthread.dylib]
[1]    16590 trace trap  npm run test


#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 0x1734393a8
 1: 0x102d13be8 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
 2: 0x103ab5c70 V8_Fatal(char const*, ...) [/usr/local/bin/node]
 3: 0x10309a244 v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/usr/local/bin/node]
 4: 0x102e1697c v8::ArrayBuffer::GetBackingStore() [/usr/local/bin/node]
 5: 0x102c935b0 node::Buffer::Data(v8::Local<v8::Value>) [/usr/local/bin/node]
 6: 0x102cbcda4 node::fs::Read(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 7: 0x102e70a68 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 8: 0x102e70560 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 9: 0x102e6fdec v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
10: 0x1035b08cc Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
11: 0x7b80e0988
12: 0x103573a14 Builtins_AsyncFunctionAwaitResolveClosure [/usr/local/bin/node]
13: 0x1035f88b8 Builtins_PromiseFulfillReactionJob [/usr/local/bin/node]
14: 0x103565df4 Builtins_RunMicrotasks [/usr/local/bin/node]
15: 0x1035420e4 Builtins_JSRunMicrotasksEntry [/usr/local/bin/node]
16: 0x102f13a1c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
17: 0x102f13e50 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/usr/local/bin/node]
18: 0x102f13f3c v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*) [/usr/local/bin/node]
19: 0x102f36b78 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/usr/local/bin/node]
20: 0x102f3740c v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/usr/local/bin/node]
21: 0x102c01db4 node::InternalCallbackScope::Close() [/usr/local/bin/node]
22: 0x102c017c4 node::InternalCallbackScope::~InternalCallbackScope() [/usr/local/bin/node]
23: 0x102cb0574 node::fs::FSReqPromise<node::AliasedBufferBase<double, v8::Float64Array, void> >::Resolve(v8::Local<v8::Value>) [/usr/local/bin/node]
24: 0x102cb8d88 node::fs::AfterStat(uv_fs_s*) [/usr/local/bin/node]
25: 0x103522794 uv__work_done [/usr/local/bin/node]
26: 0x103525f30 uv__async_io [/usr/local/bin/node]
27: 0x103537ca8 uv__io_poll [/usr/local/bin/node]
28: 0x1035263c0 uv_run [/usr/local/bin/node]
29: 0x102c02ccc node::SpinEventLoop(node::Environment*) [/usr/local/bin/node]
30: 0x102d469e8 node::worker::Worker::Run() [/usr/local/bin/node]
31: 0x102d49c10 node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/usr/local/bin/node]
32: 0x1a90dd240 _pthread_start [/usr/lib/system/libsystem_pthread.dylib]
33: 0x1a90d8024 thread_start [/usr/lib/system/libsystem_pthread.dylib]




I would be happy to provide any additional information.

chaii3 pushed a commit to chaii3/vitest that referenced this issue May 13, 2022
@szilarddoro
Copy link

For me, this error only occurs when I try to create a coverage report, but it only happens occasionally (sometimes on every run, sometimes on every second or third run).

Version:
[email protected]

Configuration:

defineConfig({
 // ...,
  test: {
    globals: true,
    environment: 'jsdom',
    reporters: 'verbose',
    testTimeout: 2000,
    include: [`${PWD}/src/**/*.{spec,test}.{ts,tsx}`, `${PWD}/tests/**/*.{spec,test}.{ts,tsx}`]
  },
  // ...,
})

@ScottAwesome
Copy link
Author

ScottAwesome commented May 20, 2022

I'm hitting the same overall issue. We've reverted back to Jest now that @vue/vue2-jest is updated to be Jest 28 compatible.

@frankandrobot
Copy link

frankandrobot commented May 25, 2022

Hitting a similar issue w/ React and jsdom. When I turn on coverage, I get random test timeouts. If you look at the logs below, the error should not be happening---the test itself has a timeout of 35s. The interaction that failed has a timeout of 15s... but the test is timing out after 5s! Note that this only happens when I turn coverage on: ["json", "lcov", "text-summary", "text", "teamcity"]. Let me know if ya'll need a minimal repo example for this.

Update: looks like I mispoke... upon closer inspection what's happening is that the UI change has already happened by the time the assertion runs. It appears that w/ coverage turned on, the UI is updating at the same rate but test assertions are running slower? (That sort of makes sense.... but unfortunately, it keeps us from being able to use coverage.)

{
  "numTotalTestSuites": 3,
  "numPassedTestSuites": 3,
  "numFailedTestSuites": 0,
  "numPendingTestSuites": 0,
  "numTotalTests": 3,
  "numPassedTests": 2,
  "numFailedTests": 1,
  "numPendingTests": 0,
  "numTodoTests": 0,
  "startTime": 1653506025296,
  "success": false,
  "testResults": [
    {
      "assertionResults": [
        {
          "ancestorTitles": [
            "",
            "EnhancedStagedUpgrades",
            "SUG page"
          ],
          "fullName": " EnhancedStagedUpgrades SUG page should render cards in the grid",
          "status": "passed",
          "title": "should render cards in the grid",
          "duration": 396,
          "failureMessages": []
        },
        {
          "ancestorTitles": [
            "",
            "EnhancedStagedUpgrades",
            "SUG page"
          ],
          "fullName": " EnhancedStagedUpgrades SUG page user can create a group",
          "status": "failed",
          "title": "user can create a group",
          "duration": 4930,
          "failureMessages": [
            "The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal."
          ]
        },
        {
          "ancestorTitles": [
            "",
            "EnhancedStagedUpgrades",
            "SUG page"
          ],
          "fullName": " EnhancedStagedUpgrades SUG page user can update a group",
          "status": "skipped",
          "title": "user can update a group",
          "failureMessages": []
        }
      ],
      "startTime": 1653506035055,
      "endTime": 1653506040381,
      "status": "failed",
      "message": "",
      "name": "/Users/uriel.avalos/Documents/manage/private/react/components/EnhancedStagedUpgrades/__tests__/EnhancedStagedUpgrades-test.tsx"
    }
  ]
}

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  components/EnhancedStagedUpgrades/__tests__/EnhancedStagedUpgrades-test.tsx > EnhancedStagedUpgrades > SUG page > user can create a group
Error: The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.
 ❯ initialCheck ../../node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/wait-for-element-to-be-removed.js:16:11
 ❯ Proxy.waitForElementToBeRemoved ../../node_modules/@testing-library/react/node_modules/@testing-library/dom/dist/wait-for-element-to-be-removed.js:39:3
 ❯ components/EnhancedStagedUpgrades/__tests__/EnhancedStagedUpgrades-test.tsx:210:12
    208|
    209|       // create page goes away
    210|       await waitForElementToBeRemoved(() => screen.queryByRole("heading", { name:…
       |            ^
    211|         timeout: 15_000,
    212|       });

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

Test Files  1 failed (1)
     Tests  1 failed | 1 passed | 1 skipped (3)
      Time  15.47s (in thread 5.33s, 290.44%)

@thoughtspile
Copy link

thoughtspile commented Jun 6, 2022

Running into this, too:

What's actually curious is that uninstalling vi-fetch stops crashes (but the tests fail). Using vitest-fetch-mock signinficantly reduces crashes. Maybe this has something to do with promise handling.

Here's the stack trace, just in case
 1: 0x102f3f7a0 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
 2: 0x10371c7a8 V8_Fatal(char const*, ...) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
 3: 0x10322c11c v8::internal::GlobalBackingStoreRegistry::Register(std::__1::shared_ptr<v8::internal::BackingStore>) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
 4: 0x1030285c8 v8::ArrayBuffer::GetBackingStore() [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
 5: 0x102ec8b3c node::Buffer::Data(v8::Local<v8::Value>) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
 6: 0x102eef82c node::fs::Read(v8::FunctionCallbackInfo<v8::Value> const&) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
 7: 0x1035d14d4 Builtins_CallApiCallback [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
 8: 0x10a65e104
 9: 0x1035fe3f4 Builtins_AsyncFunctionAwaitResolveClosure [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
10: 0x103683298 Builtins_PromiseFulfillReactionJob [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
11: 0x1035f07d4 Builtins_RunMicrotasks [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
12: 0x1035ccac4 Builtins_JSRunMicrotasksEntry [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
13: 0x1030f8a18 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
14: 0x1030f8d50 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
15: 0x1030f8e3c v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
16: 0x103115414 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
17: 0x103115298 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
18: 0x102e3bac4 node::InternalCallbackScope::Close() [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
19: 0x102e3b5a4 node::InternalCallbackScope::~InternalCallbackScope() [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
20: 0x102ee3bb4 node::fs::FSReqPromise<node::AliasedBufferBase<double, v8::Float64Array, void> >::Resolve(v8::Local<v8::Value>) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
21: 0x102eeba10 node::fs::AfterStat(uv_fs_s*) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
22: 0x10533b134 uv__work_done [/opt/homebrew/Cellar/libuv/1.44.1_1/lib/libuv.1.dylib]
23: 0x10533e484 uv__async_io [/opt/homebrew/Cellar/libuv/1.44.1_1/lib/libuv.1.dylib]
24: 0x10534e1dc uv__io_poll [/opt/homebrew/Cellar/libuv/1.44.1_1/lib/libuv.1.dylib]
25: 0x10533e8d8 uv_run [/opt/homebrew/Cellar/libuv/1.44.1_1/lib/libuv.1.dylib]
26: 0x102e3ca24 node::SpinEventLoop(node::Environment*) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
27: 0x102f1ca90 node::NodeMainInstance::Run(int*, node::Environment*) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
28: 0x102f1c760 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
29: 0x102ebe514 node::Start(int, char**) [/opt/homebrew/Cellar/node@16/16.15.0/bin/node]
30: 0x105489088

@thoughtspile
Copy link

I know this sounds like some "aliens stole my nostril" scenario, BUT adding import 'node-fetch/src/headers.js'; makes the test crash sometimes, removing the import makes it run fairly stable

@ScottAwesome
Copy link
Author

I'm dropping this issue, it seems to be working okay now, we are anticipating that support here will be better with vue 2.7 and the official vite plugin.

@revmischa
Copy link

I'm getting this issue with node 16 and vitest, node environment

@edwardstumpf
Copy link

I had been experiencing this issue, but it was resolved after upgrading to Node 16.17.0 (due to this fix: nodejs/node#42874)

@github-actions github-actions bot locked and limited conversation to collaborators Jun 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants