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

test: disable vmThreads test for now #6567

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions test/cli/test/__snapshots__/stacktraces.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`stacktrace filtering > filters stacktraces > stacktrace-filtering 1`] = `
"⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
"⎯⎯ Failed Tests 1 ⎯⎯

FAIL error-with-stack.test.js > error in deps
Error: Something truly horrible has happened!
Expand All @@ -16,13 +16,13 @@ Error: Something truly horrible has happened!
❯ a error-with-stack.test.js:8:3
❯ error-with-stack.test.js:4:3

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

"
`;

exports[`stacktrace in vmThreads 1`] = `
"⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
"⎯⎯ Failed Tests 1 ⎯⎯

FAIL error-with-stack.test.js > error in deps
Error: Something truly horrible has happened!
Expand All @@ -38,13 +38,13 @@ Error: Something truly horrible has happened!
❯ a error-with-stack.test.js:8:3
❯ error-with-stack.test.js:4:3

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

"
`;

exports[`stacktrace should print error frame source file correctly > error-in-deps > error-in-deps 1`] = `
"⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
"⎯⎯ Failed Tests 1 ⎯⎯

FAIL error-in-deps.test.js > error in deps
ReferenceError: bar is not defined
Expand All @@ -57,7 +57,7 @@ ReferenceError: bar is not defined
5|
❯ error-in-deps.test.js:5:3

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

"
`;
Expand Down Expand Up @@ -109,7 +109,7 @@ exports[`stacktraces should respect sourcemaps > add-in-js.test.js > add-in-js.t
exports[`stacktraces should respect sourcemaps > error-in-deps.test.js > error-in-deps.test.js 1`] = `
" ❯ error-in-deps.test.js:5:3

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

"
`;
Expand Down
6 changes: 6 additions & 0 deletions test/cli/test/setup-files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { promises as fs } from 'node:fs'
import { describe, expect, it, test } from 'vitest'
import { editFile, runVitest } from '../../test-utils'

const [major] = process.version.slice(1).split('.').map(num => Number(num))

test.each(['threads', 'vmThreads'])('%s: print stdout and stderr correctly when called in the setup file', async (pool) => {
if (major >= 22 && pool === 'vmThreads') {
return
}

const { stdout, stderr } = await runVitest({
root: 'fixtures/setup-files',
include: ['empty.test.ts'],
Expand Down
16 changes: 11 additions & 5 deletions test/cli/test/stacktraces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { describe, expect, it } from 'vitest'

import { runVitest } from '../../test-utils'

const [major] = process.version.slice(1).split('.').map(num => Number(num))

// To prevent the warnining coming up in snapshots
process.setMaxListeners(20)

Expand All @@ -19,7 +21,7 @@ describe('stacktraces should respect sourcemaps', async () => {
const lines = String(stderr).split(/\n/g)
const index = lines.findIndex(val => val.includes(`${file}:`))
const msg = lines.slice(index, index + 8).join('\n')
expect(msg).toMatchSnapshot(file)
expect(removeLines(msg)).toMatchSnapshot(file)
})
}
})
Expand Down Expand Up @@ -49,7 +51,7 @@ describe('stacktrace should print error frame source file correctly', async () =
const { stderr } = await runVitest({ root }, [testFile])

// expect to print framestack of foo.js
expect(stderr).toMatchSnapshot('error-in-deps')
expect(removeLines(stderr)).toMatchSnapshot('error-in-deps')
})
})

Expand All @@ -63,17 +65,21 @@ describe('stacktrace filtering', async () => {
onStackTrace: (_error, { method }) => method !== 'b',
}, [testFile])

expect(stderr).toMatchSnapshot('stacktrace-filtering')
expect(removeLines(stderr)).toMatchSnapshot('stacktrace-filtering')
})
})

it('stacktrace in vmThreads', async () => {
it.runIf(major < 22)('stacktrace in vmThreads', async () => {
const root = resolve(__dirname, '../fixtures/stacktraces')
const testFile = resolve(root, './error-with-stack.test.js')
const { stderr } = await runVitest({
root,
pool: 'vmThreads',
}, [testFile])

expect(stderr).toMatchSnapshot()
expect(removeLines(stderr)).toMatchSnapshot()
})

function removeLines(log: string) {
return log.replace(/⎯{2,}/g, '⎯⎯')
}
4 changes: 3 additions & 1 deletion test/cli/test/vm-threads.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { expect, test } from 'vitest'

import { createFile, resolvePath, runVitest } from '../../test-utils'

test('importing files in restricted fs works correctly', async () => {
const [major] = process.version.slice(1).split('.').map(num => Number(num))

test.runIf(major < 22)('importing files in restricted fs works correctly', async () => {
createFile(
resolvePath(import.meta.url, '../fixtures/vm-threads/src/external/package-null/package-null.json'),
'null',
Expand Down
Loading