I’m currently trying to spawn a worker in my jest test like so:
Runtime.install({
logger: new DefaultLogger('WARN', (entry: LogEntry) =>
console.log(`[${entry.level}]`, entry.message)
)
});
testEnv = await TestWorkflowEnvironment.createLocal();
nativeConnection = testEnv.nativeConnection;
temporalClient = testEnv.client;
const worker = await Worker.create(
workflowCoverage.augmentWorkerOptions({
connection: nativeConnection,
taskQueue: 'test',
workflowsPath: require.resolve('../../../src/web/temporal/workflow'),
activities
})
);
The issue is that the worker crashes as is it unable to parse ./node_modules/@napi-rs/snappy-darwin-arm64/snappy.darwin-arm64.node
here is the relevant stack trace:
at DefaultLogger.worker_1.Runtime.install.logger [as logFunction] (tests/workflows/e2e/denseReconstruction.test.ts:81:17)
console.log
[ERROR]
at DefaultLogger.worker_1.Runtime.install.logger [as logFunction] (tests/workflows/e2e/denseReconstruction.test.ts:81:17)
console.log
[ERROR] ERROR in ./node_modules/@napi-rs/snappy-darwin-arm64/snappy.darwin-arm64.node 1:0
at DefaultLogger.worker_1.Runtime.install.logger [as logFunction] (tests/workflows/e2e/denseReconstruction.test.ts:81:17)
console.log
[ERROR] Module parse failed: Unexpected character '�' (1:0)
at DefaultLogger.worker_1.Runtime.install.logger [as logFunction] (tests/workflows/e2e/denseReconstruction.test.ts:81:17)
console.log
[ERROR] You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
I know that I can configure my worker to be able to parse binary files, but from what I understand this should be already configured by the Typescript SDK so I’m wondering if I’m missing anything?
Here is my yarn.lock
file: