Files
pr-preview/backend/node_modules/ssh2/test/test-worker-imports.js
T
space a71f801c3f feat: initial scaffold - backend, frontend, Prisma schema, Docker
- Prisma schema: User, Session, RepoConfig, Preview, Job, WebhookToken, NoConfigComment, AdminSettings
- Backend: auth (login/logout/me/first-user setup), webhook handler with HMAC verification, EC2 service, SSH service, deploy pipeline, job queue worker, cron workers
- Frontend: Login with first-user detection, Dashboard, PreviewDetail with live log streaming, Settings, Repos config, Admin panel, SetupWizard, Privacy page
- Docker Compose and Dockerfile for self-hosted deployment
- Uses bcryptjs for Node 24 compatibility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-25 00:18:08 +02:00

26 lines
739 B
JavaScript

// Test for thread-safety issues caused by subsequent imports of the module
// in worker threads: https://github.com/mscdex/ssh2/issues/1393.
// Each subsequent worker increases probability of abnormal termination.
// The probability of a false pass due to zero response becomes negligible
// for 4 consecutive workers.
'use strict';
let Worker, isMainThread;
try {
({ Worker, isMainThread } = require('worker_threads'));
} catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') throw e;
process.exit(0);
}
require('../lib/index.js');
if (isMainThread) {
async function runWorker() {
return new Promise((r) => new Worker(__filename).on('exit', r));
}
runWorker()
.then(runWorker)
.then(runWorker)
.then(runWorker);
}