From f0d39308b9e7caef511d680c245e8b7f668fdb95 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Sun, 5 Jan 2025 21:14:04 -0800 Subject: [PATCH] fix test --- README.md | 9 +++++++++ index.js | 2 +- test/test.js | 13 +------------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f5bb567..2ad70fa 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,11 @@ globalThis.navigator = { gpu: create([]) }; // do some webgpu const device = await(await navigator.gpu.requestAdapter()).requestDevice(); +... ``` +see [example]() + You can pass dawn options in `create` ```js @@ -93,6 +96,8 @@ I've tested with Visual Studio Community Edition 2022 Further you must have [cmake installed](https://cmake.org/download/) and either in your path or at it's standard place of `C:\Program Files\CMake` +You must have `go` installed. Get it at https://go.dev/ + And you must have `node.js` installed, at least version 18. I recommend using [nvm-windows](https://github.com/coreybutler/nvm-windows) to install it as it makes it easy to switch version @@ -105,6 +110,8 @@ XCode installed and its command line tools Further you must have [cmake installed](https://cmake.org/download/) and either in your path or at it's standard place of `/Applications/CMake.app` +You must have `go` installed. Get it at https://go.dev/ + And you must have `node.js` installed, at least version 18. I recommend using [nvm](https://github.com/nvm-sh/nvm) to install it as it makes it easy to switch versions. @@ -118,6 +125,8 @@ the following dependencies sudo apt-get install cmake libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev pkg-config nodejs npm ``` +You must have `go` installed. Get it at https://go.dev/ + And you must have `node.js` installed, at least version 18. I recommend using [nvm](https://github.com/nvm-sh/nvm) to install it as it makes it easy to switch versions. diff --git a/index.js b/index.js index 03817f2..e9a0d53 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,6 @@ import { createRequire } from 'module'; const require = createRequire(import.meta.url); const __dirname = dirname(fileURLToPath(import.meta.url)); -const dawnNodePath = join(__dirname, `${process.platform}-${process.arch}.node`); +const dawnNodePath = join(__dirname, 'dist', `${process.platform}-${process.arch}.dawn.node`); const { create, globals } = require(dawnNodePath); export { create, globals } diff --git a/test/test.js b/test/test.js index b2b3aea..bffcaff 100644 --- a/test/test.js +++ b/test/test.js @@ -1,17 +1,6 @@ import Mocha from 'mocha'; -import { createRequire } from 'module'; -const require = createRequire(import.meta.url); - -const isDev = process.argv[2] !== 'dev'; -const isWin = process.platform === 'win32'; -const dawnNodePath = isDev - ? isWin - ? `${process.cwd()}/third_party/dawn/out/cmake-release/Debug/dawn.node` - : `${process.cwd()}/third_party/dawn/out/cmake-release/dawn.node` - : `${process.cwd()}/dist/${process.platform}-${process.arch}.node`; - -const { create, globals } = require(dawnNodePath); +import { create, globals } from '../index.js'; Object.assign(globalThis, globals); globalThis.navigator = { gpu: create([]) };