A TypeScript/JavaScript library to generate markdown documentation from test codes in BDD style.
Warning
Alpha version. Not tested extensively yet. APIs may change frequently.
deno add jsr:@chiezo/bddoc
Note
This section is generated with bddoc
itself from transform_test.ts
and
parse_test.ts
.
import { parse, transform } from "@chiezo/bddoc";
Transform tests to documentation:
assertEquals(
transform(
await Deno.readTextFile("./fixtures/input.ts"),
),
await Deno.readTextFile("./fixtures/output.md"),
);
Parse describe
and it
from tests:
const describes = parse(
await Deno.readTextFile("./fixtures/input.ts"),
);
assertObjectMatch(describes[0], {
target: "foo",
its: [
{
behavior: "should do something",
code: 'assertEquals("foo", "foo");',
},
],
});
assertObjectMatch(describes[1], {
target: "bar",
its: [
{
behavior: "should do something else",
code: `assertEquals("bar", "bar");`,
},
{
behavior: "should not do something more",
code: `assertNotEquals("bar", "baz");`,
},
],
});
- Runtimes
- Browsers
- Bun
- Deno
- Node.js
- Test Interfaces
-
Deno.test
-
describe
it
-
- Assertion Interfaces
-
@std/assert
-
expect
-
- Backend
- Built-in (rule-based)
- LLM (?)