mediv0 / jest-clone

very simple testing framework inspired by jest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tehst - jest clone

very simple testing framework inspired by jest

⚠️ this is not production ready, This is just for learning if you are interested

this is simple testing framework that uses node js worker threads to isolate your tests and run them in a safe environment

Usage

create your test files with .spec.js extension

API

group

Groups your tests

test

Run the test

simple usage

// inside test.spec.js
const sum = (a, b) => {
    return a + b;
}

group("test group", () => {
    const r1 = sum(1, 2);
    test("1 + 2 should be 3", r1).toBe(3); 
});

check for return type

// inside test.spec.js
const sum = (a, b) => {
    return a + b;
}

group("test group", () => {
    const r1 = sum(1, 2);
    test("return type should be integer", typeof r1).toBe("number"); 
});

Testing APIs

toBe

check if given values are equal

Dev

run code with node cli.js command

TODO

  • mock fucntion
  • more api options

About

very simple testing framework inspired by jest


Languages

Language:JavaScript 100.0%