Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commitlint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const config = {
],
],
"scope-enum": [1, "always", ["jco", "bindgen", "p2-shim"]],
"scope-case": [2, "always", "kebab-case"],
"scope-case": [2, "always", "lower-case"],
},
};

Expand Down
24 changes: 20 additions & 4 deletions docs/src/contributing.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Contributing to the Codebase

Development is based on a standard `npm install && npm run build && npm run test` workflow.
Development is based on a standard NodeJS workflow, i.e.:

Tests can be run without bundling via `npm run build:dev && npm run test:dev`.

Specific tests can be run adding the mocha `--grep` / `-g` flag, for example: `npm run test:dev -- --grep exports_only`.
```console
npm install
npm run build
npm run test
```

## Prerequisites

Expand Down Expand Up @@ -49,7 +51,21 @@ npm run build
## Testing

There are three test suites in jco:

* `npm run test`: Project-level transpilation, CLI & API tests.
* `npm run test --workspace packages/preview2-shim`: `preview2-shim` unit tests.
* `test/browser.html`: Bare-minimum browser validation test.
* `cargo test`: Wasmtime preview2 conformance tests (not currently passing).

### Running tests without bundling

Tests can be run without bundling via `npm run build:dev && npm run test:dev`.

### Running specific tests

JS tests are powered by [`vitest`][vitest], and a specific test suite can be run by passing
the filename to `npm run test`:

```console
npm run test runtime.js
```
5 changes: 1 addition & 4 deletions packages/preview2-shim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@
}
},
"scripts": {
"test": "node --expose-gc ../../node_modules/mocha/bin/mocha.js -u tdd test/test.js --timeout 30000"
"test": "vitest run -c test/vitest.ts"
},
"files": [
"types",
"lib"
],
"devDependencies": {
"mocha": "^10.2.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bytecodealliance/jco.git"
Expand Down
4 changes: 4 additions & 0 deletions packages/preview2-shim/test/meta-resolve-stub.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// see: https://github.com/vitest-dev/vitest/issues/6953#issuecomment-2505310022
import { vi } from 'vitest';
import { createRequire } from 'node:module';
vi.stubGlobal('globalCreateRequire', createRequire);
Loading
Loading