@osmoscraft/typescript-testing-library
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

TypeScript Testing Library

Get started

npm i -D @osmoscraft/typescript-testing-library

Create run-test.ts in your project root with the following content:

import { getTests, runTests } from "@osmoscraft/typescript-testing-library";

async function run() {
  const tests = await getTests("src", /\.test\.ts$/);
  runTests(tests);
}

run();

Update package.json with the following scripts to run tests

  "scripts": {
    "test": "ts-node-dev --quiet --transpile-only run-test.ts",
    "test:watch": "ts-node-dev --respawn --watch --transpile-only run-test.ts",
  },

Write your first test in src/hello-world.test.ts

import { describe, expect, it } from "@osmoscraft/typescript-testing-library";

describe("hello world", () => {
  it("should pass", async () => {
    await expect("hello").toEqual("hello");
  });
});

Please make sure to use await in frontend of each expect or the error reporting may not be able to surface all failed tests

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.5
    0
    • latest

Version History

Package Sidebar

Install

npm i @osmoscraft/typescript-testing-library

Weekly Downloads

0

Version

0.0.5

License

MIT

Unpacked Size

43.1 kB

Total Files

41

Last publish

Collaborators

  • chuanqisun