static kickoffCoverage()

in x-test.js [828:855]


  static kickoffCoverage(context, stepId) {
    const step = context.state.steps[stepId];
    const coverage = context.state.coverages[step.coverageId]; // eslint-disable-line no-shadow
    if (context.state.coverageValue) {
      try {
        const analysis = XTestRoot.analyzeHrefCoverage(context.state.coverageValue.js, coverage.href, coverage.goal);
        Object.assign(coverage, { ok: analysis.ok, percent: analysis.percent, output: analysis.output });
      } catch (error) {
        Object.assign(coverage, { ok: false, percent: 0, output: '' });
        XTestRoot.bail(context, error);
      }
    } else {
      Object.assign(coverage, { ok: true, percent: 0, output: '', directive: 'SKIP' });
    }
    const ok = XTestRoot.ok(context, stepId);
    const number = XTestRoot.number(context, stepId);
    const text = XTestRoot.text(context, stepId);
    const directive = XTestRoot.directive(context, stepId);
    const level = XTestRoot.level(context, stepId);
    const tap = XTestTap.testLine(ok, number, text, directive, level);
    if (!ok) {
      const errorTap = XTestTap.diagnostic(coverage.output, level);
      XTestRoot.output(context, stepId, tap, errorTap);
    } else {
      XTestRoot.output(context, stepId, tap);
    }
    step.status = 'done';
  }