• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3if (!common.hasCrypto)
4  common.skip('missing crypto');
5
6// Issue https://github.com/nodejs/node/issues/35263
7// Description: Test that passing keyobject to worker thread does not crash.
8const { createSecretKey } = require('crypto');
9
10const { Worker, isMainThread, workerData } = require('worker_threads');
11
12if (isMainThread) {
13  const key = createSecretKey(Buffer.from('hello'));
14  new Worker(__filename, { workerData: key });
15} else {
16  console.log(workerData);
17}
18