test: disable vmThreads test for now (#6567)

This commit is contained in:
Ari Perkkiö 2024-09-26 17:39:32 +03:00 committed by GitHub
parent e6730909b3
commit 7dd2ecf8e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 27 additions and 13 deletions

View File

@ -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!
@ -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!
@ -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
@ -57,7 +57,7 @@ ReferenceError: bar is not defined
5|
error-in-deps.test.js:5:3
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
⎯⎯[1/1]⎯
"
`;
@ -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]⎯
"
`;

View File

@ -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'],

View File

@ -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)
@ -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)
})
}
})
@ -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')
})
})
@ -63,11 +65,11 @@ 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({
@ -75,5 +77,9 @@ it('stacktrace in vmThreads', async () => {
pool: 'vmThreads',
}, [testFile])
expect(stderr).toMatchSnapshot()
expect(removeLines(stderr)).toMatchSnapshot()
})
function removeLines(log: string) {
return log.replace(/⎯{2,}/g, '⎯⎯')
}

View File

@ -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',