Skip to content

Commit beb988e

Browse files
committed
added MessagePort polyfill and transform .mjs dep
1 parent 8893154 commit beb988e

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

jest.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export default {
88
},
99
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
1010
transform: {
11-
'^.+\\.[tj]sx?$': ['babel-jest', { configFile: './babel.config.mjs' }],
11+
'^.+\\.(mjs|[tj]sx?)$': ['babel-jest', { configFile: './babel.config.mjs' }],
1212
},
1313
transformIgnorePatterns: [
14-
'<rootDir>/node_modules/(?!(lit-html|@noble/curves|@noble/hashes|@exodus/bytes|uuid|jsdom|parse5)/)',
14+
'<rootDir>/node_modules/(?!(lit-html|@noble/curves|@noble/hashes|@exodus/bytes|uuid|jsdom|parse5|@asamuzakjp/css-color|@csstools)/)',
1515
],
1616
setupFilesAfterEnv: ['./test/helpers/setup.ts'],
1717
testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'],

test/helpers/setup.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ global.TransformStream = TransformStream
1919
global.ReadableStream = ReadableStream
2020
global.WritableStream = WritableStream
2121

22+
// Node provides MessagePort via worker_threads; jsdom/undici expects it in global scope
23+
try {
24+
// eslint-disable-next-line @typescript-eslint/no-var-requires
25+
const { MessageChannel, MessagePort } = require('worker_threads')
26+
global.MessageChannel = MessageChannel
27+
global.MessagePort = MessagePort
28+
} catch (err) {
29+
// worker_threads not available (older Node), ignore
30+
}
31+
2232
// Mock external dependencies that solid-logic expects
2333
jest.mock('$rdf', () => require('rdflib'), { virtual: true })
2434

0 commit comments

Comments
 (0)