Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use deno.ts for running tests #5

Open
AmesingFlank opened this issue Apr 22, 2022 · 1 comment
Open

Use deno.ts for running tests #5

AmesingFlank opened this issue Apr 22, 2022 · 1 comment

Comments

@AmesingFlank
Copy link
Owner

taichi.js heavily depends on WebGPU, which makes running tests very difficult.

Currently, the only way to run test is via the browser. More specifically, you need to do

npm run build_dev
npm run start

and then visit 127.0.0.1:8080/tests

Very recently, deno.ts has introduced WebGPU support, so it would be great if we could use that to run tests locally via a npm run tests command.

@manzt
Copy link

manzt commented Sep 16, 2022

Stumbled on this very cool project today. Another option could be @web/test-runner. I tinkered around with it today but ran into some issues with type-only imports and ESM. Each test needs to be converted into it's own independent entry-point, e.g.,

// src/tests/TestFloat.ts
import * as ti from "../taichi"
import {assertEqual} from "./Utils"

// test is mocha global
test("testFloat", () => {
  //  test
});
// web-test-runner.config.mjs
import { esbuildPlugin } from "@web/dev-server-esbuild";
import { fromRollup } from "@web/dev-server-rollup";
import taichi from "./rollup/rollup-plugin-taichi/src/index.mjs"; // converted to ESM, with JSDoc annotations

/** @type {import('@web/test-runner').TestRunnerConfig} */
export default {
	files: "./src/tests/Test*.ts",
	nodeResolve: { browser: true },
	plugins: [
		esbuildPlugin({ ts: true, target: "auto" }),
		fromRollup(taichi),
	],
};
wtr # runs tests in browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants