diff --git a/.github/workflows/checks_js.yml b/.github/workflows/checks_js.yml index c519fc9a..470b209c 100644 --- a/.github/workflows/checks_js.yml +++ b/.github/workflows/checks_js.yml @@ -29,7 +29,9 @@ jobs: node-version: '24' - name: Installing biome.js working-directory: rustuna_js - run: npm i -g biome + run: npm i -g @biomejs/biome@2.6.8 + - name: Install TypeScript + run: npm i -g typescript@7.0.2 - name: Lint working-directory: rustuna_js run: biome ci examples/*.ts test/*.mjs @@ -44,10 +46,10 @@ jobs: run: | WASM_BINDGEN_VERSION=$(cargo metadata --format-version 1 --locked | jq -r '.packages[] | select(.name == "wasm-bindgen") | .version') if ! command -v wasm-bindgen &> /dev/null || [ "$(wasm-bindgen --version | awk '{print $2}')" != "$WASM_BINDGEN_VERSION" ]; then - cargo install wasm-bindgen-cli --version "$WASM_BINDGEN_VERSION" --force + cargo install wasm-bindgen-cli --version "$WASM_BINDGEN_VERSION" --locked --force fi if ! command -v wasm-opt &> /dev/null; then - cargo install wasm-opt + cargo install wasm-opt --version 0.116.1 --locked fi - name: Build JS binding working-directory: rustuna_js diff --git a/rustuna_js/test/distribution.mjs b/rustuna_js/test/distribution.mjs index b476d337..b0d4b4f2 100644 --- a/rustuna_js/test/distribution.mjs +++ b/rustuna_js/test/distribution.mjs @@ -1,5 +1,5 @@ -import test from "node:test"; import assert from "node:assert"; +import test from "node:test"; import * as rustuna from "../pkg/node/rustuna.js"; @@ -8,24 +8,24 @@ test("optimize simple quadratic function", () => { study.optimize((trial) => { const x = trial.suggest_float("x", -10.0, 10.0); const y = trial.suggest_int("y", -10, 10); - const z = trial.suggest_categorical("z", ["foo", "bar"]); + trial.suggest_categorical("z", ["foo", "bar"]); const value = (x - 5) ** 2 + (y + 2) ** 2; return value; }, 30); const best_trial = study.best_trial; assert.equal(best_trial.params.length, 3); - let x_param = best_trial.params.find((param) => param.name === "x"); + const x_param = best_trial.params.find((param) => param.name === "x"); assert.equal(x_param.name, "x"); assert.equal( x_param.internal_value >= -10 && x_param.internal_value <= 10, true, ); - let z_param = best_trial.params.find((param) => param.name === "z"); + const z_param = best_trial.params.find((param) => param.name === "z"); assert.equal(z_param.name, "z"); assert.equal( - z_param.external_value == "foo" || z_param.external_value == "bar", + z_param.external_value === "foo" || z_param.external_value === "bar", true, ); }); diff --git a/rustuna_js/test/study_optimize.mjs b/rustuna_js/test/study_optimize.mjs index 218aedf2..a2103638 100644 --- a/rustuna_js/test/study_optimize.mjs +++ b/rustuna_js/test/study_optimize.mjs @@ -1,15 +1,14 @@ -import test from "node:test"; import assert from "node:assert"; +import test from "node:test"; import * as rustuna from "../pkg/node/rustuna.js"; -import { type } from "node:os"; test("optimize simple quadratic function", () => { const study = rustuna.create_study("test"); study.optimize((trial) => { const x = trial.suggest_float("x", -10.0, 10.0); const y = trial.suggest_int("y", -10, 10); - const z = trial.suggest_categorical("z", ["foo", "bar"]); + trial.suggest_categorical("z", ["foo", "bar"]); const value = (x - 5) ** 2 + (y + 2) ** 2; return value; }, 30); @@ -20,7 +19,7 @@ test("optimize simple quadratic function", () => { test("sample categorical values", () => { const study = rustuna.create_study("test"); study.optimize((trial) => { - const z = trial.suggest_categorical("z", ["foo", 1, true, false, null]); + trial.suggest_categorical("z", ["foo", 1, true, false, null]); // console.log(z); // console.log(typeof z); return 1.0; diff --git a/rustuna_js/test/user_attr.mjs b/rustuna_js/test/user_attr.mjs index 8181c604..f4cb9184 100644 --- a/rustuna_js/test/user_attr.mjs +++ b/rustuna_js/test/user_attr.mjs @@ -1,5 +1,5 @@ -import test from "node:test"; import assert from "node:assert"; +import test from "node:test"; import * as rustuna from "../pkg/node/rustuna.js";