mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
`node --test` runs showed no test tree, and single tests ran with Jest's `-t`. - Detection: a `package.json` script whose Node options include `--test` (also `tsx --test`) is a test configuration with `testRunner: "node-test"`; a script that picks its own `--test-reporter` runs as written. - Test tree: test runs add the IDE's reporter (`nodeTestReporter.js`, passed as a `data:` URL) next to `spec` through `NODE_OPTIONS`, which works through `npm run`, Node's per-file child processes and remote run targets. It prints a record per test (file, describe chain, status, duration, declaration line, error); the records become the tree and are hidden from the console, which keeps `spec`'s output. - Gutter, Rerun Failed Tests, run selected tests: select by full name with `--test-name-pattern` in `NODE_OPTIONS`, plus the files. New fixture `fixtures/node-test-app`, run by `smoke/run.test.ts` in the TypeScript job. Closes #5152 Co-authored-by: wildcatDownstairs <26499420+wildcatDownstairs@users.noreply.github.com>
28 lines
900 B
JavaScript
28 lines
900 B
JavaScript
import assert from "node:assert/strict";
|
|
import { describe, it } from "node:test";
|
|
import { Inventory } from "../src/inventory.js";
|
|
|
|
describe("inventory", () => {
|
|
it("counts received stock", () => {
|
|
assert.equal(new Inventory().receive("mug", 3).receive("mug", 2).count("mug"), 5);
|
|
});
|
|
|
|
describe("shipping", () => {
|
|
it("takes items out of stock", () => {
|
|
assert.equal(new Inventory().receive("mug", 3).ship("mug", 2).count("mug"), 1);
|
|
});
|
|
|
|
it("refuses more than is in stock", () => {
|
|
assert.throws(() => new Inventory().ship("mug", 1), /not enough mug/);
|
|
});
|
|
});
|
|
|
|
it("intentionally fails (set OPENIDEA_FAIL=1)", { skip: !process.env.OPENIDEA_FAIL }, () => {
|
|
assert.equal(new Inventory().receive("mug", 1).count("mug"), 2);
|
|
});
|
|
});
|
|
|
|
it("rejects non-positive quantities", () => {
|
|
assert.throws(() => new Inventory().receive("mug", 0), RangeError);
|
|
});
|