Skip to content

Commit 7580f73

Browse files
chore(p2-shim): remove mocha (#671)
* chore(p2-shim): remove mocha Signed-off-by: Victor Adossi <[email protected]> * fix(ci): change commitlint scope setting to lower-case Signed-off-by: Victor Adossi <[email protected]> --------- Signed-off-by: Victor Adossi <[email protected]>
1 parent c425550 commit 7580f73

File tree

6 files changed

+124
-82
lines changed

6 files changed

+124
-82
lines changed

commitlint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const config = {
2222
],
2323
],
2424
"scope-enum": [1, "always", ["jco", "bindgen", "p2-shim"]],
25-
"scope-case": [2, "always", "kebab-case"],
25+
"scope-case": [2, "always", "lower-case"],
2626
},
2727
};
2828

docs/src/contributing.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Contributing to the Codebase
22

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

5-
Tests can be run without bundling via `npm run build:dev && npm run test:dev`.
6-
7-
Specific tests can be run adding the mocha `--grep` / `-g` flag, for example: `npm run test:dev -- --grep exports_only`.
5+
```console
6+
npm install
7+
npm run build
8+
npm run test
9+
```
810

911
## Prerequisites
1012

@@ -49,7 +51,21 @@ npm run build
4951
## Testing
5052

5153
There are three test suites in jco:
54+
5255
* `npm run test`: Project-level transpilation, CLI & API tests.
5356
* `npm run test --workspace packages/preview2-shim`: `preview2-shim` unit tests.
5457
* `test/browser.html`: Bare-minimum browser validation test.
5558
* `cargo test`: Wasmtime preview2 conformance tests (not currently passing).
59+
60+
### Running tests without bundling
61+
62+
Tests can be run without bundling via `npm run build:dev && npm run test:dev`.
63+
64+
### Running specific tests
65+
66+
JS tests are powered by [`vitest`][vitest], and a specific test suite can be run by passing
67+
the filename to `npm run test`:
68+
69+
```console
70+
npm run test runtime.js
71+
```

packages/preview2-shim/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,12 @@
2323
}
2424
},
2525
"scripts": {
26-
"test": "node --expose-gc ../../node_modules/mocha/bin/mocha.js -u tdd test/test.js --timeout 30000"
26+
"test": "vitest run -c test/vitest.ts"
2727
},
2828
"files": [
2929
"types",
3030
"lib"
3131
],
32-
"devDependencies": {
33-
"mocha": "^10.2.0"
34-
},
3532
"repository": {
3633
"type": "git",
3734
"url": "git+https://github.com/bytecodealliance/jco.git"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// see: https://github.com/vitest-dev/vitest/issues/6953#issuecomment-2505310022
2+
import { vi } from 'vitest';
3+
import { createRequire } from 'node:module';
4+
vi.stubGlobal('globalCreateRequire', createRequire);

0 commit comments

Comments
 (0)