@jterrazz/test 14.2.0 → 14.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/artifacts.js +19 -7
  2. package/package.json +1 -1
package/dist/artifacts.js CHANGED
@@ -1671,11 +1671,19 @@ function updates(outcomes, scope) {
1671
1671
  }));
1672
1672
  }
1673
1673
  /**
1674
- * Start every server the document names, in declaration order, before the first
1675
- * run. They all stay live for the whole file and are stopped together — one
1676
- * document is one scenario, and its servers are part of its ground.
1674
+ * Start every server the document names, in declaration order, after `fixture:`
1675
+ * has been copied and before the first run. They all stay live for the whole
1676
+ * file and are stopped together — one document is one scenario, and its servers
1677
+ * are part of its ground.
1678
+ *
1679
+ * Every child is seeded with `TEST_WORKDIR`, the resolved working directory the
1680
+ * `{{workdir}}` token holds and `$WORKDIR` expands to. The fixtures are already
1681
+ * on disk when the child starts, so a served stub reads the world the document
1682
+ * laid down exactly as a stub binary reads its own fixture tree: a scenario is
1683
+ * a layer of files, never a flag threaded through the server. A document's
1684
+ * mapping-form env wins over it, key by key.
1677
1685
  */
1678
- async function startServers(document, config, displayPath) {
1686
+ async function startServers(document, config, displayPath, workdir) {
1679
1687
  const registry = config.serveRegistry ?? {};
1680
1688
  const started = [];
1681
1689
  const env = {};
@@ -1692,7 +1700,10 @@ async function startServers(document, config, displayPath) {
1692
1700
  const adapter = new ServeAdapter({
1693
1701
  command: registration.command,
1694
1702
  ready: registration.ready
1695
- }, config.root ?? process.cwd(), "cli", entry.env);
1703
+ }, config.root ?? process.cwd(), "cli", {
1704
+ TEST_WORKDIR: workdir,
1705
+ ...entry.env
1706
+ });
1696
1707
  started.push(adapter);
1697
1708
  try {
1698
1709
  await adapter.start();
@@ -1749,8 +1760,9 @@ async function runSpecDocument(options) {
1749
1760
  const { dest, src } = copyPlan(fixture.path, fileDir, workDir);
1750
1761
  cpSync(src, dest, { recursive: true });
1751
1762
  }
1752
- const servers = await startServers(document, config, displayPath);
1753
- const scope = new CaptureScope(safeRealpath(workDir));
1763
+ const workdir = safeRealpath(workDir);
1764
+ const servers = await startServers(document, config, displayPath, workdir);
1765
+ const scope = new CaptureScope(workdir);
1754
1766
  const env = expandWorkdir({
1755
1767
  ...options.baseEnv,
1756
1768
  ...servers.env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jterrazz/test",
3
- "version": "14.2.0",
3
+ "version": "14.3.0",
4
4
  "description": "Declarative testing framework for HTTP APIs, CLIs, and background jobs — one entry point, real infrastructure, golden-file assertions, plus an oxlint convention plugin.",
5
5
  "keywords": [
6
6
  "api-testing",