vona-core 5.1.44 → 5.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3278,7 +3278,7 @@ function validateTestClaim(value, claimPath) {
3278
3278
  if (!path.isAbsolute(m.projectPath) || path.resolve(m.projectPath) !== m.projectPath) throw new Error('Invalid test claim checkout');
3279
3279
  const p = getTestClaimPaths(m.projectPath, m.runId);
3280
3280
  if (claimPath && path.resolve(claimPath) !== p.claimPath) throw new Error('Test claim filename or checkout mismatch');
3281
- oneOf(m.kind, ['unit', 'cov', 'e2e']);
3281
+ oneOf(m.kind, ['unit', 'cov', 'e2e', 'contract']);
3282
3282
  keys(m.owner, ['pid', 'startTime', 'host']);
3283
3283
  integer(m.owner.pid, 1);
3284
3284
  text(m.owner.startTime);
@@ -4258,7 +4258,9 @@ function prepareAppInfo(env) {
4258
4258
  }
4259
4259
 
4260
4260
  let __closing$1 = false;
4261
+ let __failed = false;
4261
4262
  let __timeout;
4263
+ const __reloading = new WeakSet();
4262
4264
  async function _closeInner$1() {
4263
4265
  __timeout = setTimeout(() => {
4264
4266
  // eslint-disable-next-line no-console
@@ -4274,32 +4276,37 @@ function handleProcessMaster(workers) {
4274
4276
  await _closeInner$1();
4275
4277
  });
4276
4278
  });
4277
- for (let i = 0; i < workers; i++) {
4278
- cluster.fork();
4279
- }
4280
4279
  cluster.on('message', (worker, message) => {
4281
4280
  if (message === 'reload-worker') {
4282
4281
  if (!__closing$1) {
4283
4282
  cluster.fork();
4284
4283
  }
4284
+ __reloading.add(worker);
4285
4285
  worker.process.kill('SIGTERM');
4286
4286
  }
4287
4287
  });
4288
4288
  cluster.on('exit', (_worker, _code, _signal) => {
4289
- // console.log(`----------------- worker ${_worker.process.pid} died`, _code, _signal);
4289
+ const expectedSignal = __closing$1 && ['SIGINT', 'SIGUSR2', 'SIGTERM'].includes(_signal) || __reloading.has(_worker) && _signal === 'SIGTERM';
4290
+ __reloading.delete(_worker);
4291
+ if ((_code !== 0 || _signal) && !expectedSignal) {
4292
+ __failed = true;
4293
+ }
4290
4294
  if (cluster.workers && Object.keys(cluster.workers).length === 0) {
4291
4295
  clearTimeout(__timeout);
4292
4296
  // log
4293
4297
  const app = useApp();
4294
4298
  if (app.meta.env.LOGGER_DUMMY !== 'true') {
4295
- const message = `Master shutdown gracefully: ${process.pid}`;
4299
+ const message = `Master shutdown ${__failed ? 'with worker failure' : 'gracefully'}: ${process.pid}`;
4296
4300
  // eslint-disable-next-line
4297
4301
  console.log(chalk.cyan(message));
4298
4302
  }
4299
4303
  // exit
4300
- process.exit(0);
4304
+ process.exit(__failed ? 1 : 0);
4301
4305
  }
4302
4306
  });
4307
+ for (let i = 0; i < workers; i++) {
4308
+ cluster.fork();
4309
+ }
4303
4310
  }
4304
4311
 
4305
4312
  let __closing = false;
@@ -4350,8 +4357,8 @@ function handleProcessWork() {
4350
4357
 
4351
4358
  async function startCluster(workers, bootstrapOptions) {
4352
4359
  if (cluster.isPrimary) {
4360
+ await createAppMaster(bootstrapOptions);
4353
4361
  handleProcessMaster(workers);
4354
- createAppMaster(bootstrapOptions);
4355
4362
  } else {
4356
4363
  await startWorker(bootstrapOptions);
4357
4364
  }