Skip to main content
Glama
bundlers.test.js1.29 kB
'use strict' const { test } = require('tap') const { join } = require('path') const { file } = require('./helper') const ThreadStream = require('..') test('bundlers support with .js file', function (t) { t.plan(1) globalThis.__bundlerPathsOverrides = { 'thread-stream-worker': join(__dirname, 'custom-worker.js') } const dest = file() process.on('uncaughtException', error => { console.log(error) }) const stream = new ThreadStream({ filename: join(__dirname, 'to-file.js'), workerData: { dest }, sync: true }) stream.worker.removeAllListeners('message') stream.worker.once('message', message => { t.equal(message.code, 'CUSTOM-WORKER-CALLED') }) stream.end() }) test('bundlers support with .mjs file', function (t) { t.plan(1) globalThis.__bundlerPathsOverrides = { 'thread-stream-worker': join(__dirname, 'custom-worker.js') } const dest = file() process.on('uncaughtException', error => { console.log(error) }) const stream = new ThreadStream({ filename: join(__dirname, 'to-file.mjs'), workerData: { dest }, sync: true }) stream.worker.removeAllListeners('message') stream.worker.once('message', message => { t.equal(message.code, 'CUSTOM-WORKER-CALLED') }) stream.end() })

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/krtw00/search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server