Skip to content
Logo

Changelog

for @ghostry/extern-extension-fabricator-v0

Every release of @ghostry/extern-extension-fabricator-v0, newest first. Its guide is Extern, in fabricator's docs.

v0.0.7

· Release on GitHub

Fixes

  • Types resolve for consumers on moduleResolution: node16 or nodenext. The published declarations imported their sibling files without an extension, which those modes reject for an ESM package. Under skipLibCheck: true there was no error: every export was silently typed as any. Every relative import in dist/types now names its file.

Compatibility

  • Peer dependencies raised to @ghostry/extern >=0.0.17 <0.1.0 and @ghostry/fabricator >=0.0.15 <0.1.0, the first versions whose own types resolve under node16 and nodenext. Since @ghostry/extern 0.0.16, initialize() returns the instance directly, and the README example no longer awaits it.

Internal

  • The build type-checks the emitted declarations, so a broken dist/types fails the build instead of shipping.

v0.0.6

· Release on GitHub

Breaking changes

  • A built Fabricator is no longer a block identity. Pass the schema it was built from. Given a Fabricator, a block could either keep drawing from it or build a new one from its schema in the testing block's scope, and nothing at the call site would say which.
    extern.typed.by(built).will(() => fetchUser()); // before
    extern.typed.by(built.schema).will(() => fetchUser()); // now
    
  • Built is no longer exported.

Compatibility

  • Peer dependency on @ghostry/fabricator raised to >=0.0.13 <0.1.0. isSchema, which rejects a built Fabricator (and accepts a schema), is exported from @ghostry/fabricator/internal in that version.

Docs: https://docs.ghostry.dev/fabricator/guides/extern

v0.0.5

· Release on GitHub

Internal

  • The package's repository, homepage, and issue links point at github.com/ghostry-dev/extern.
  • Source is formatted with bun fmt. Dependencies were updated.

v0.0.4

· Release on GitHub

Fixes

  • extern.typed.by(schema) keeps undefined in a fabricator schema's value type. T.undefinable(row) inferred as Row, and a block that returned undefined was rejected. [Produces] is optional, and without exactOptionalPropertyTypes an optional property reads as X | undefined, which swallowed the schema's own undefined. The identity now matches fabricator's Produced<$T> box, so the inferred type is the same with that flag on or off.

Compatibility

  • Peer dependency on @ghostry/fabricator raised to >=0.0.11 <0.1.0. Produced is exported from @ghostry/fabricator/internal in that version.

Docs: https://docs.ghostry.dev/fabricator/guides/extern

v0.0.3

· Release on GitHub

Compatibility

  • Peer dependency on @ghostry/extern raised to >=0.0.14 <0.1.0. The extension opens its fabricator scope from a frame() generator, which replaces scope() in that version.

Behavior change

  • A synchronous extern.testing body runs, including on the synchronous carrier a browser bundle selects. An async body still needs node:async_hooks. Fabricator's wrap refuses an async block on that carrier.
  • With @ghostry/extern/harnessing, the order of the two integrations is the order the salt layers nest. Either order keeps every layer, from @ghostry/fabricator 0.0.6 on, and gives each test its own data. Flipping the order moves every fabricated value. The extension's instance has to be the integrated instance or an ancestor of it. A per-test wrap never governs a fork of the integrated instance, and handing the extension that fork fabricates the same values in every test, with no error. root catches two initialize() calls. It does not catch the fork, which shares a root.

Docs: https://docs.ghostry.dev/fabricator/guides/extern

v0.0.2

· Release on GitHub

Behavior change

  • A fabricated value no longer depends on the file that opened extern.testing or the file that wrote by(). Every testing block layers one constant, "@ghostry/extern", onto the instance's salt and starts its construction counter over. The same schema draws the same value from any file. A tail-call-elided wrapper can no longer move a value.
  • An unnamed block's value still follows construction order inside that testing block. A named block's does not: the name is applied with ordinal: null, so the value is a function of the identity and the name, and fabricating something else ahead of it does not move it. A salt on its own would still take the next ordinal. Fabricator treats a salt as a pin, not a fork.
  • new Fabricator(schema) inside the block shares the block's source and is a separate draw. One written outside the block draws from the enclosing scope. The constant layer keeps the nth fabrication inside the block from equaling the nth outside it.
  • The scope wraps context.scope(), the frame in effect, rather than the instance passed to fabricatorExtension. A wrap on that instance would restate from it and drop an enclosing frame, including the per-test salt from @ghostry/fabricator/harnessing. The extension and that integration have to be instances from one initialize(). A fork() stays in the lineage. A second initialize() does not, even given the same stack, and nothing is thrown: every test fabricates the same values, so a test that writes an id into shared state passes alone and fails as a suite.

Compatibility

  • Peer dependency on @ghostry/fabricator raised to >=0.0.4 <0.1.0, where seed is renamed to salt:
    initializeFabricator({ seed: "my-suite" }); // before
    initializeFabricator({ salt: "my-suite" }); // now
    

Docs: https://docs.ghostry.dev/fabricator/guides/extern

v0.0.1

· Release on GitHub

Initial release.

A typed extern block built from a @ghostry/fabricator schema fabricates a value when it has no mock, instead of throwing NotMockedError. An extern instance without the extension still rejects fabricator schemas.

import { initialize as initializeExtern } from "@ghostry/extern";
import { initialize as initializeFabricator } from "@ghostry/fabricator";
import { fabricatorExtension } from "@ghostry/extern-extension-fabricator-v0";

const fabricator = initializeFabricator({ seed: "my-suite" });

export const extern = await initializeExtern({
  extensions: [fabricatorExtension({ instance: fabricator })],
});

mock(schema).with(value) replaces the value outright. mock(schema).produce(({ via }) => via.fabricate({ name: "Ada" })) shapes it through fabricator's own fabricate. via is the built Fabricator, so an object's overrides are fabricator's, including nested objects and Omitted. unmocked: "error" makes an unmocked block throw NotMockedError again. produce() still fabricates on demand.

Two files feed each value. The testing block's file, with :line:col stripped, layers the salt, so the layer is per file. The file that wrote by() is the attribution. The same block therefore fabricates the same value across testing() calls, and moving either file changes the value. A name passed to named distinguishes two blocks over one schema. Attribution reads the stack, so a one-line wrapper around by() can be tail-call-elided and the attribution falls through to that wrapper's caller.

Needs a runtime with node:async_hooks — Bun, Node, or Deno. The extension runs the testing block inside fabricator's wrap, which refuses an async block on the synchronous carrier a browser bundle selects.

npm install @ghostry/extern-extension-fabricator-v0 @ghostry/extern @ghostry/fabricator

Compatibility

  • Peers are @ghostry/extern >=0.0.13 <0.1.0 and @ghostry/fabricator >=0.0.2 <0.1.0.

Docs: https://docs.ghostry.dev/fabricator/guides/extern