Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ npm install tiny-jest
### Deno:

```js
import {
Test,
expect,
prettify,
} from "https://raw.githubusercontent.com/ValeriaVG/tiny-jest/v1.1.2/dist/mod.ts";
import Test from "https://raw.githubusercontent.com/ValeriaVG/tiny-jest/v1.2.1/src/Test.ts";
import expect from "https://raw.githubusercontent.com/ValeriaVG/tiny-jest/v1.2.1/src/expect.ts";
import prettify from "https://raw.githubusercontent.com/ValeriaVG/tiny-jest/v1.2.1/src/prettify.ts";

const { it, run, title } = new Test("basic");

Expand Down
8 changes: 8 additions & 0 deletions benchmark/browser.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@
}).not.toThrow(/server error/gi);
});

it("toBeGreater/Less", () => {
expect(5).toBeGreaterThan(3);
expect(3).toBeLessThan(5);
expect(4).toBeGreaterThanOrEqual(3);
expect(4).toBeGreaterThanOrEqual(4);
expect(3).not.toBeLessThan(2);
});

const start = performance.now();
const resultDiv = document.getElementById("result");

Expand Down
7 changes: 7 additions & 0 deletions benchmark/deno.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ it("toThrow", () => {
}).not.toThrow(/server error/gi);
});

it("toBeGreater/Less", () => {
expect(5).toBeGreaterThan(3);
expect(3).toBeLessThan(5);
expect(4).toBeGreaterThanOrEqual(3);
expect(4).toBeGreaterThanOrEqual(4);
expect(3).not.toBeLessThan(2);
});
const start = performance.now();
run()
.then((results) => {
Expand Down
8 changes: 8 additions & 0 deletions benchmark/node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ it("toThrow", () => {
}).not.toThrow(/server error/gi);
});

it("toBeGreater/Less", () => {
expect(5).toBeGreaterThan(3);
expect(3).toBeLessThan(5);
expect(4).toBeGreaterThanOrEqual(3);
expect(4).toBeGreaterThanOrEqual(4);
expect(3).not.toBeLessThan(2);
});

const start = performance.now();
run()
.then((results) => {
Expand Down
20 changes: 20 additions & 0 deletions bundleDeno.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const fs = require("fs/promises");
const path = require("path");
const bundle = async () => {
const files = ["Test.ts", "expect.ts", "prettify.ts"];
let mod = "";
for (const file of files) {
const content = await fs.readFile(path.resolve(__dirname, "src", file));
const lines = content.toString().split("\n");
for (const line of lines) {
if (line.startsWith("import")) continue;
if (line.startsWith("export default")) {
mod += line.replace("export default", "export") + "\n";
continue;
}
mod += line + "\n";
}
}
await fs.writeFile(path.resolve(__dirname, "dist", "mod.ts"), mod);
};
bundle();
5 changes: 4 additions & 1 deletion dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions dist/bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dist/expect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export declare type Expectations = {
toBeFalsy: Expectation<void>;
toMatchObject: Expectation<Object>;
toThrow: Expectation<RegExp | void>;
toBeGreaterThan: Expectation<number>;
toBeGreaterThanOrEqual: Expectation<number>;
toBeLessThan: Expectation<number>;
toBeLessThanOrEqual: Expectation<number>;
};
export declare type Matcher = (actual: any, expected: any) => false | string;
export default function expect(actual: any): Expectations & {
Expand Down
Loading