Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jan 6, 2025
1 parent c0b66b8 commit f0d3930
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
13 changes: 1 addition & 12 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -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([]) };
Expand Down

0 comments on commit f0d3930

Please sign in to comment.