How to use the tape.getHarness function in tape

To help you get started, we’ve selected a few tape examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github itchio / itch / src / unit-tests / run-unit-tests.ts View on Github external
console.log(
              `    expected:\n${chalk.blue(
                indentLines(8, JSON.stringify(data.expected, null, 2))
              )}`
            );
            console.log(
              `    actual  :\n${chalk.blue(
                indentLines(8, JSON.stringify(data.actual, null, 2))
              )}`
            );
          }
          console.log("");
        }
      }
    });
    const harness = tape.getHarness({
      exit: false,
      stream: parser,
      objectMode: true,
    });
    let testFiles = specifiedFiles;
    if (testFiles.length === 0) {
      if (chatty) {
        console.log(chalk.blue(`looking for tests in ${srcDir}`));
      }
      testFiles = glob("**/*[.-]spec.ts", { cwd: srcDir });
      if (!thorough) {
        // exclude files containing slow.spec if not during a thorough run
        testFiles = testFiles.filter(f => !/slow\.spec/.test(f));
      }
    }
github tgvashworth / fetch-engine / src / test-server / collector-client.ts View on Github external
}
  $target.appendChild($line);
  window.scrollTo(0, document.body.clientHeight);
}

['log', 'error', 'info'].forEach(k => {
  var original = console[k];
  console[k] = function (...args) {
    addLine(k, [...args].join(' '));
    original.call(console, ...args);
  };
});

// Wait for tape to finish

const tapeResults = require("tape").getHarness()._results;
tapeResults.on("done", function (): void {
  const payload = {
    total: tapeResults.count,
    passed: tapeResults.pass,
    failed: tapeResults.fail,
  };

  const xhr = new XMLHttpRequest();
  xhr.open("POST", `http://localhost:5001?id=${id}`, true);
  xhr.setRequestHeader("Content-Type", "application/json");
  xhr.setRequestHeader("Origin", location.origin);
  xhr.send(JSON.stringify(payload));
  xhr.onerror = function () {
    console.error(`collector ${id} failed:`, xhr.status, xhr.responseText);
    console.error(xhr.getAllResponseHeaders());
  };
github parro-it / libui-napi / tests / ui.js View on Github external
.then(() => {
			test.getHarness()._results.count += total - start;
			test.getHarness()._results.pass += passed;
			test.getHarness()._results.fail += failed;
			t.end();
		})
		.catch(err => console.error(err));
github godaddy / ekke / plugins / tape.native.js View on Github external
modify('before', async function before({ config }) {
    output = tape.createStream();
    harness = tape.getHarness();

    output.on('data', line => console.log(line.trimRight()));
  });
github rvagg / polendina / resources / tape-run.js View on Github external
.then(callback)
      })
    },

    flush (callback) {
      executionQueue(() => {
        global.polendinaEnd(failures)
          .catch(callback)
          .then(callback)
      })
    }
  })

  tape.getHarness({ stream })

  tape.getHarness().onFailure((...args) => {
    failures = 1
  })

  for (const mod of registry.tests) {
    mod.load()
  }
}
github rvagg / polendina / resources / tape-run.js View on Github external
global.polendinaWrite(chunk.toString())
          .catch(callback)
          .then(callback)
      })
    },

    flush (callback) {
      executionQueue(() => {
        global.polendinaEnd(failures)
          .catch(callback)
          .then(callback)
      })
    }
  })

  tape.getHarness({ stream })

  tape.getHarness().onFailure((...args) => {
    failures = 1
  })

  for (const mod of registry.tests) {
    mod.load()
  }
}