Compare commits
No commits in common. "30fc15fb8d3637908379df35d46c327770e4e42b" and "25547cbbbb19ceed69b84a49afd0187ede21fb2f" have entirely different histories.
30fc15fb8d
...
25547cbbbb
|
@ -1,3 +1,2 @@
|
|||
.direnv/
|
||||
build/
|
||||
node_modules/
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
# Build the package.
|
||||
[tasks.build]
|
||||
clear = true
|
||||
dependencies = ["clean", "lint", "test", "build-types", "build-js"]
|
||||
|
||||
# Build the JavaScript.
|
||||
[tasks.build-js]
|
||||
clear = true
|
||||
command = "pnpm"
|
||||
args = ["tsx", "esbuild.ts"]
|
||||
|
||||
# Build the TypeScript type declarations.
|
||||
[tasks.build-types]
|
||||
clear = true
|
||||
command = "pnpm"
|
||||
args = ["tsc"]
|
||||
|
||||
# Clean the build directory.
|
||||
[tasks.clean]
|
||||
clear = true
|
||||
command = "pnpm"
|
||||
args = ["trash", "build/"]
|
||||
|
||||
# Run the full set of linting and testing.
|
||||
[tasks.lint]
|
||||
clear = true
|
||||
dependencies = ["lint-js", "test"]
|
||||
|
||||
# Lint the TypeScript using XO.
|
||||
[tasks.lint-js]
|
||||
clear = true
|
||||
command = "pnpm"
|
||||
args = ["xo"]
|
||||
|
||||
# Run the tests.
|
||||
[tasks.test]
|
||||
clear = true
|
||||
command = "pnpm"
|
||||
args = ["tsx", "tests/index.ts"]
|
||||
|
||||
# Start a live-reloading server that watches for changes.
|
||||
[tasks.watch]
|
||||
clear = true
|
||||
command = "pnpm"
|
||||
args = ["vite"]
|
|
@ -9,7 +9,7 @@ import {setup} from "@holllo/test";
|
|||
|
||||
const add = (a: number, b: number): number => a + b;
|
||||
|
||||
await setup("add", async (group) => {
|
||||
void setup("add", async (group) => {
|
||||
group.test("1 + 1", async (test) => {
|
||||
test.equals(add(1, 1), 2);
|
||||
});
|
||||
|
|
59
flake.lock
59
flake.lock
|
@ -1,59 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705309234,
|
||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1706173671,
|
||||
"narHash": "sha256-lciR7kQUK2FCAYuszyd7zyRRmTaXVeoZsCyK6QFpGdk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4fddc9be4eaf195d631333908f2a454b03628ee5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
13
flake.nix
13
flake.nix
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
devShells.default = import ./shell.nix { inherit pkgs; };
|
||||
}
|
||||
);
|
||||
}
|
27
package.json
27
package.json
|
@ -2,8 +2,12 @@
|
|||
"name": "@holllo/test",
|
||||
"description": "Tiny testing library designed to run anywhere.",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.1",
|
||||
"homepage": "https://git.bauke.xyz/Holllo/test",
|
||||
"bugs": {
|
||||
"email": "helllo@holllo.org",
|
||||
"url": "https://github.com/Holllo/test/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
@ -13,15 +17,20 @@
|
|||
"files": [
|
||||
"build/"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsx esbuild.ts && tsc",
|
||||
"dev": "vite",
|
||||
"lint": "xo",
|
||||
"test": "pnpm run build && tsx tests/index.ts && tsx tests/example.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@bauke/eslint-config": "^0.1.5",
|
||||
"@bauke/prettier-config": "^0.1.5",
|
||||
"esbuild": "^0.19.12",
|
||||
"trash-cli": "^5.0.0",
|
||||
"tsx": "^4.7.0",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.0.12",
|
||||
"xo": "^0.56.0"
|
||||
"@bauke/eslint-config": "^0.1.2",
|
||||
"@bauke/prettier-config": "^0.1.2",
|
||||
"esbuild": "^0.16.10",
|
||||
"tsx": "^3.12.1",
|
||||
"typescript": "^4.9.4",
|
||||
"vite": "^4.0.2",
|
||||
"xo": "^0.53.1"
|
||||
},
|
||||
"prettier": "@bauke/prettier-config",
|
||||
"xo": {
|
||||
|
|
4505
pnpm-lock.yaml
4505
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
mkShell rec {
|
||||
packages = [ cargo-make nodejs nodePackages.pnpm ];
|
||||
}
|
|
@ -27,10 +27,7 @@ export class Group implements GroupOptions {
|
|||
private _afterAll: (() => Promise<void>) | undefined;
|
||||
private _beforeAll: (() => Promise<void>) | undefined;
|
||||
|
||||
constructor(
|
||||
public name: string,
|
||||
options?: GroupOptions,
|
||||
) {
|
||||
constructor(public name: string, options?: GroupOptions) {
|
||||
this.parallel = options?.parallel ?? false;
|
||||
}
|
||||
|
||||
|
@ -68,6 +65,7 @@ export class Group implements GroupOptions {
|
|||
} else {
|
||||
results = [];
|
||||
for (const test of this.tests) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
results.push(await test.run(this.context));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import {setup} from "../source/index.js";
|
||||
import {setup} from "../build/index.js";
|
||||
|
||||
const add = (a: number, b: number): number => a + b;
|
||||
|
||||
await setup("Example add", async (group) => {
|
||||
void setup("add", async (group) => {
|
||||
group.test("1 + 1", async (test) => {
|
||||
test.equals(add(1, 1), 2);
|
||||
});
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
<body>
|
||||
<script src="index.ts" type="module"></script>
|
||||
<script src="example.ts" type="module"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import {setup} from "../source/index.js";
|
||||
|
||||
await import("./assertions.js");
|
||||
await import("./example.js");
|
||||
|
||||
async function add(a: number, b: number): Promise<number> {
|
||||
await new Promise<void>((resolve) => {
|
||||
|
@ -23,7 +22,7 @@ async function subtract(a: number, b: number): Promise<number> {
|
|||
return a - b;
|
||||
}
|
||||
|
||||
await setup("add", async (group) => {
|
||||
void setup("add", async (group) => {
|
||||
group.test("add(1, 1) = 2", async (test) => {
|
||||
test.equals(await add(1, 1), 2);
|
||||
});
|
||||
|
@ -37,7 +36,7 @@ await setup("add", async (group) => {
|
|||
});
|
||||
});
|
||||
|
||||
await setup(
|
||||
void setup(
|
||||
"subtract",
|
||||
async (group) => {
|
||||
group.beforeAll(async () => {
|
||||
|
|
Loading…
Reference in New Issue