0.4.1 • Published 5 months ago

@yumii.saiko/testy v0.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago
  • Allows you to write your test with Typescript decorator while using your favorite testing framework
  • ... is a candy for the Java JUnit folks
  • a framework, which does nothing for you but convert your functionally rich file into a more modular format
  • Modular test
  • Decorators
    • Test Class: @TestClass(desc?)
    • Hooks: @BeforeAll, @BeforeEach, @AfterEach, @AfterAll
    • Test Suites: @Test(desc?, skip?, order?)
      • Base decorator
      • skip
      • Order (not really useful)
  • Testing Platform impl
    • Custom platform
    • jest
    • vitest
    • Mocha
    • playwright
    • cypress
    • Jasmine

src/sum.ts

import {TestClass, Test} from "@yumii.saiko/testy";

export function sum(...numbers: number[]) {
  return numbers.reduce((acc, n) => acc + n, 0);
}

@TestClass({
  desc: "fn Sum()",
})
export class SumTest {
  @Test()
  should_compute_numbers_sum() {
    expect(sum(10, 10)).toEqual(20);
  }

  @Test({
    skip: true,
    desc: "Explicitly skip this for now",
  })
  not_implemented_yet() {}
}

Using the filename pattern that your testing framework might identify, example src/test/*/**/*.spec.ts, create a single file in which all of the Test class registrations should go.

src/test/bootstrap_test.spec.ts

import {defineTests} from "@yumii.saiko/testy";
// There we provided our own impl for jest platform
// Testy will come with a set of platform so you don't need to impl them yourself
import {PlatformJestImpl} from "../lib/testy_platform_jest";
import {SumTest} from "../sum";

defineTests([SumTest], PlatformJestImpl);

Run

npm test

screenshot (jest)

jest_testy

0.3.0

5 months ago

0.4.1

5 months ago

0.3.2

5 months ago

0.4.0

5 months ago

0.3.1

5 months ago

0.3.4

5 months ago

0.3.3

5 months ago

0.2.4

5 months ago

0.2.3

5 months ago

0.1.2

5 months ago

0.2.2

5 months ago

0.2.1

5 months ago

0.2.0

5 months ago

0.1.1

5 months ago

0.1.0

5 months ago