Closed
Description
Version
27.4.7
Steps to reproduce
- Create project with jest with the test-environment as
node
- Create a test file with:
const a = new MessageEvent('yes')
test('test', () => {
return
})
to replicate a test.
3. run jest
Expected behavior
I expect the test to pass without error as Node now supports MessageEvent
Actual behavior
I get the following error
Additional context
I'm using typescript but the test file still acts the same way in js or ts
Here is my jest config file:
import type { InitialOptionsTsJest } from 'ts-jest'
import { pathsToModuleNameMapper } from 'ts-jest'
import { compilerOptions } from './tsconfig.json'
const config: InitialOptionsTsJest = {
preset: 'ts-jest',
testEnvironment: 'node',
collectCoverage: true,
coverageDirectory: 'coverage',
slowTestThreshold: 2,
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/src/js' }),
}
export default config
I've checked: jsdom/jsdom#3205 (comment) and #11528
But I don't think that the former applies here and the 2nd one seems like a non-fix as the node environment should fix it?
Environment
System:
OS: macOS 12.1
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Binaries:
Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
npmPackages:
jest: ^27.4.7 => 27.4.7