Skip to content

Commit

Permalink
test: use node test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnsgn committed May 12, 2023
1 parent e44d324 commit 14d8ace
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 982 deletions.
970 changes: 7 additions & 963 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@
"build": "npx snowdev build",
"dev": "npx snowdev dev",
"release": "npx snowdev release",
"test": "c8 mocha",
"test:watch": "mocha --watch --parallel"
"test": "c8 node --test",
"test:watch": "node --test --watch test"
},
"devDependencies": {
"c8": "^7.12.0",
"c8": "^7.13.0",
"gl-matrix": "^3.4.3",
"mocha": "^10.0.0",
"nanobench": "^2.1.1"
},
"engines": {
Expand Down
1 change: 1 addition & 0 deletions test/euler.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "node:test";
import { deepEqual } from "node:assert";
import { euler, quat, utils } from "../index.js";
import { X_QUAT, Y_QUAT, Z_QUAT } from "./common.js";
Expand Down
7 changes: 2 additions & 5 deletions test/mat2x3.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { describe, it } from "node:test";
import { deepEqual, notStrictEqual, ok } from "node:assert";
import { mat2x3 } from "../index.js";
import {
ONE_TWO_VEC2,
IDENTITY_MAT2X3,
deepAlmostEqual,
} from "./common.js";
import { ONE_TWO_VEC2, IDENTITY_MAT2X3, deepAlmostEqual } from "./common.js";

const ONE_MAT2X3 = Object.freeze(Array(6).fill(1));
const ONE_TO_SIX_MAT2X3 = Object.freeze([1, 2, 3, 4, 5, 6]);
Expand Down
1 change: 1 addition & 0 deletions test/mat3.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "node:test";
import { deepEqual, notStrictEqual, ok } from "node:assert";
import { mat3 } from "../index.js";
import {
Expand Down
19 changes: 11 additions & 8 deletions test/mat4.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "node:test";
import { deepEqual, notStrictEqual, ok } from "node:assert";
import { mat4 } from "../index.js";
import {
Expand Down Expand Up @@ -244,18 +245,20 @@ describe("mat4", () => {
]
);
});
it("targetTo() should set a matrix from a vector to another", () => {
deepEqual(
mat4.targetTo(mat4.create(), Y_UP, ORIGIN, Y_UP),
// prettier-ignore
[
describe("targetTo()", () => {
it("should set a matrix from a vector to another", () => {
deepEqual(
mat4.targetTo(mat4.create(), Y_UP, ORIGIN, Y_UP),
// prettier-ignore
[
0, 0, 0, 0,
0, 0, 0, 0,
0, 1, 0, 0,
0, 1, 0, 1
]
);
describe("direction independent from distance", () => {
);
});
it("direction independent from distance", () => {
deepEqual(
mat4.targetTo(mat4.create(), Y_UP, [0, -100, 0], Y_UP),
// prettier-ignore
Expand All @@ -267,7 +270,7 @@ describe("mat4", () => {
]
);
});
describe("up", () => {
it("up", () => {
deepEqual(
mat4.targetTo(mat4.create(), Y_UP, ORIGIN, Y_DOWN),
// prettier-ignore
Expand Down
1 change: 1 addition & 0 deletions test/quat.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "node:test";
import { deepEqual, notStrictEqual, ok } from "node:assert";
import { quat, utils, vec3 } from "../index.js";
import {
Expand Down
3 changes: 2 additions & 1 deletion test/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual, notStrictEqual, ok } from "node:assert";
import { describe, it } from "node:test";
import { deepEqual, ok } from "node:assert";
import { utils } from "../index.js";

describe("utils", () => {
Expand Down
1 change: 1 addition & 0 deletions test/vec2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "node:test";
import { deepEqual, notStrictEqual, ok } from "node:assert";
import { vec2 } from "../index.js";
import { ONE_TWO_VEC2 } from "./common.js";
Expand Down
1 change: 1 addition & 0 deletions test/vec3.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "node:test";
import { deepEqual, notStrictEqual, ok } from "node:assert";
import { vec3 } from "../index.js";
import {
Expand Down
6 changes: 5 additions & 1 deletion test/vec4.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from "node:test";
import { deepEqual, notStrictEqual, ok } from "node:assert";
import { vec4 } from "../index.js";
import { IDENTITY_MAT4, ONE_TWO_THREE_MAT4 } from "./common.js";
Expand Down Expand Up @@ -54,7 +55,10 @@ describe("vec4", () => {
vec4.lerp(vec4.copy(DEFAULT_VEC4), ONE_VEC4, 0.5),
[0.5, 0.5, 0.5, 1]
);
deepEqual(vec4.lerp([-1, -1, -1, -1], DEFAULT_VEC4, 0.5), [-0.5, -0.5, -0.5, 0]);
deepEqual(
vec4.lerp([-1, -1, -1, -1], DEFAULT_VEC4, 0.5),
[-0.5, -0.5, -0.5, 0]
);
});
it("toString() should print a vector to a string", () => {
deepEqual(vec4.toString(DEFAULT_VEC4), "[0, 0, 0, 1]");
Expand Down

0 comments on commit 14d8ace

Please sign in to comment.