Skip to content

Commit f7c89cd

Browse files
refactor(docs): update README, show how to run individual suite
1 parent 5c0a479 commit f7c89cd

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Establishing this initial prototype as a singular flexible engine foundation tha
5252
### Weval AOT Compilation
5353

5454

55-
5655
## Platform APIs
5756

5857
The following APIs are available:
@@ -330,21 +329,20 @@ imports. Direct component analysis should be used to correctly infer the real im
330329

331330
## Contributing
332331

333-
### Pre-requisites
332+
To contribute, you'll need to set up the following:
334333

335334
* `git submodule update --init --recursive` to update the submodules.
336335
* Stable Rust with the `wasm32-unknown-unknown` and `wasm32-wasi` targets
337336
installed.
338337
* `wasi-sdk-20.0` installed at `/opt/wasi-sdk/`
339338

340-
### Building and testing
339+
## Building
341340

342341
Building and testing the project can be performed via NPM scripts (see [`package.json`](./package.json)):
343342

344343
```console
345344
npm install
346345
npm run build
347-
npm run test
348346
```
349347

350348
Before being able to use `componetize-js` (ex. via `npm link`, from `jco`), you'll need to run:
@@ -361,12 +359,30 @@ To clean up a local installation (i.e. remove the installation of StarlingMonkey
361359
npm run clean
362360
```
363361

362+
## Testing
363+
364+
To run all tests:
365+
366+
```console
367+
npm run test
368+
```
369+
370+
### Running a specific test
371+
372+
To run a specific test suite, you can pass an argument to [`vitest`][vitest]:
373+
374+
```console
375+
npm run test -- test/wasi.js
376+
```
377+
378+
[vitest]: https://vitest.dev
379+
364380
# License
365381

366382
This project is licensed under the Apache 2.0 license with the LLVM exception.
367383
See [LICENSE](LICENSE) for more details.
368384

369-
### Contribution
385+
## Contribution
370386

371387
Unless you explicitly state otherwise, any contribution intentionally submitted
372388
for inclusion in this project by you, as defined in the Apache-2.0 license,

test/bindings.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ suite('Bindings', async () => {
129129
);
130130
}
131131

132-
var instance = await import(`./output/${name}/${name}.js`);
132+
const outputPath = fileURLToPath(
133+
new URL(`./output/${name}/${name}.js`, import.meta.url),
134+
);
135+
var instance = await import(outputPath);
133136
} catch (e) {
134137
if (test.err) {
135138
test.err(e);

test/wasi.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ suite('WASI', () => {
5959
}
6060

6161
var instance = await import(`./output/wasi/component.js`);
62+
6263
instance.run.run();
64+
6365
const result = instance.getResult();
66+
6467
assert.strictEqual(
6568
result.slice(0, 10),
6669
`NOW: ${String(Date.now()).slice(0, 5)}`,
@@ -98,8 +101,11 @@ suite('WASI', () => {
98101
}
99102

100103
var instance = await import(`./output/wasi/component.js`);
104+
101105
instance.run.run();
106+
102107
const result = instance.getResult();
108+
103109
assert.strictEqual(
104110
result.slice(0, 10),
105111
`NOW: ${String(Date.now()).slice(0, 5)}`,

0 commit comments

Comments
 (0)