Skip to content

Commit

Permalink
Run all tests with mocha after all
Browse files Browse the repository at this point in the history
  • Loading branch information
cknitt committed Oct 4, 2024
1 parent 9178df2 commit ad93c2b
Show file tree
Hide file tree
Showing 19 changed files with 2,879 additions and 37 deletions.
16 changes: 2 additions & 14 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ if (process.argv.includes("-mocha")) {
mochaTest = true;
}

if (process.argv.includes("-node")) {
nodeTest = true;
}

if (process.argv.includes("-bsb")) {
bsbTest = true;
}
Expand Down Expand Up @@ -61,31 +57,23 @@ async function runTests() {
});
}

if (mochaTest || nodeTest) {
if (mochaTest) {
cp.execSync(rescript_exe, {
cwd: path.join(__dirname, "..", "tests/tests"),
stdio: [0, 1, 2],
});

cp.execSync(rescript_exe, {
cwd: path.join(__dirname, "..", "tests/tests_esmodule"),
stdio: [0, 1, 2],
});
}

if (mochaTest) {
cp.execSync(`npx mocha -t 10000 tests/tests/**/*_test.js`, {
cwd: path.join(__dirname, ".."),
stdio: [0, 1, 2],
});
}

if (nodeTest) {
cp.execSync(`node --test tests/tests/**/*_ntest.js`, {
cwd: path.join(__dirname, ".."),
stdio: [0, 1, 2],
});
}

if (bsbTest) {
console.log("Doing build_tests");
const buildTestDir = path.join(__dirname, "..", "tests", "build_tests");
Expand Down
46 changes: 46 additions & 0 deletions tests/tests/src/belt_float_test.js

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

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
open Node_test
open Node_test_util
open Mocha
open Test_utils

module F = Belt.Float

describe("Belt.Float", () => {
describe(__MODULE__, () => {
test("fromInt", () => {
eq(__LOC__, F.fromInt(1), 1.0)
eq(__LOC__, F.fromInt(-1), -1.0)
Expand Down
93 changes: 93 additions & 0 deletions tests/tests/src/belt_hashmap_test.js

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

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Node_test
open Node_test_util
open Mocha
open Test_utils

module N = Belt.HashMap
module S = Belt.Map.Int
Expand All @@ -13,7 +13,7 @@ let cmp = (x: int, y) => compare(x, y)
module Y = unpack(Belt.Id.hashable(~eq=intEq, ~hash=intHash))
let empty: N.t<int, int, _> = N.make(~id=module(Y), ~hintSize=30)

describe("Belt.HashMap", () => {
describe(__MODULE__, () => {
test("fromArray", () => {
let u = A.concat(I.randomRange(30, 100), I.randomRange(40, 120))
let v = A.zip(u, u)
Expand Down
90 changes: 90 additions & 0 deletions tests/tests/src/belt_hashset_int_test.js

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

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Node_test
open Node_test_util
open Mocha
open Test_utils

module N = Belt.HashSet.Int
module S = Belt.Set.Int
Expand All @@ -15,7 +15,7 @@ let sum2 = h => {
v.contents
}

describe("Belt.HashSet.Int", () => {
describe(__MODULE__, () => {
test("fromArray", () => {
let u = A.concat(I.randomRange(30, 100), I.randomRange(40, 120))
let v = N.fromArray(u)
Expand Down
45 changes: 45 additions & 0 deletions tests/tests/src/belt_int_test.js

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

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
open Node_test
open Node_test_util
open Mocha
open Test_utils

module I = Belt.Int

describe("Belt.Int", () => {
describe(__MODULE__, () => {
test("toFloat", () => {
eq(__LOC__, I.toFloat(1), 1.0)
eq(__LOC__, I.toFloat(-1), -1.0)
Expand Down
Loading

0 comments on commit ad93c2b

Please sign in to comment.