@jterrazz/test 12.0.2 → 12.1.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.
package/dist/oxlint.cjs CHANGED
@@ -340,7 +340,7 @@ const RULE_DOCS = {
340
340
  },
341
341
  "c1-domain-structure": {
342
342
  channel: "statique",
343
- convention: "La forme de l’arbre `specs/` se déclare via l’option `depth` : `facet-domain` (défaut — `*.test.ts` à la profondeur facet/domain, `*.specification.ts` au root de la facette), `mirror` (test à toute profondeur ≥ 1, nommé d’après son dossier), `off`.",
343
+ convention: "La forme de l’arbre `specs/` se déclare via l’option `depth` : `facet-domain` (défaut — `*.test.ts` à la profondeur facet/domain, `*.specification.ts` au root de la facette), `facet` (test au root de la facette OU un dossier domaine plus bas, jamais plus profond), `mirror` (test à toute profondeur ≥ 1, nommé d’après son dossier), `off`.",
344
344
  family: "C",
345
345
  id: "C1",
346
346
  rationale: "Une profondeur fixe rend la place de chaque fichier prévisible et détectable statiquement."
@@ -1471,6 +1471,16 @@ const DEFAULT_DEPTH = "facet-domain";
1471
1471
  * - a `*.specification.ts` sits at the facet root — exactly
1472
1472
  * `specs/<facet>/<file>.specification.ts`, never inside a domain.
1473
1473
  *
1474
+ * `depth: 'facet'`
1475
+ *
1476
+ * The same facet root, one degree looser: the folder follows the assets. A
1477
+ * `*.test.ts` sits EITHER at the facet root (`specs/<facet>/<aspect>.test.ts`)
1478
+ * or one domain folder down (`specs/<facet>/<domain>/<aspect>.test.ts`) — a
1479
+ * test earns a domain folder when it carries assets of its own, and sits
1480
+ * beside its siblings when it does not. Anything deeper is rejected, and so is
1481
+ * a test loose at the specs root. A `*.specification.ts` sits at the facet
1482
+ * root, exactly as in `facet-domain`.
1483
+ *
1474
1484
  * `depth: 'mirror'`
1475
1485
  *
1476
1486
  * The tree mirrors something outside itself (a command tree, a source tree), so
@@ -1495,6 +1505,24 @@ const c1DomainStructure = {
1495
1505
  if (anchor === void 0) return;
1496
1506
  const base = anchor.relative.at(-1) ?? "";
1497
1507
  const nesting = anchor.relative.length - 1;
1508
+ if (depth === "facet") {
1509
+ if (base.endsWith(TEST_SUFFIX)) {
1510
+ if (nesting < 1) context.report({
1511
+ messageId: "testOutsideFacet",
1512
+ node
1513
+ });
1514
+ else if (nesting > 2) context.report({
1515
+ messageId: "testTooDeepForFacet",
1516
+ node
1517
+ });
1518
+ return;
1519
+ }
1520
+ if (base.endsWith(SPECIFICATION_SUFFIX) && nesting !== 1) context.report({
1521
+ messageId: "specNotAtFacetRoot",
1522
+ node
1523
+ });
1524
+ return;
1525
+ }
1498
1526
  if (depth === "mirror") {
1499
1527
  if (!base.endsWith(TEST_SUFFIX)) return;
1500
1528
  if (nesting < 1) {
@@ -1539,12 +1567,15 @@ const c1DomainStructure = {
1539
1567
  testAtFacetRoot: "A `*.test.ts` must live in a domain folder: `specs/<facet>/<domain>/<aspect>.test.ts` — tests directly at the facet root are forbidden (C1 — see docs/10-linting.md).",
1540
1568
  testAtSpecsRoot: "A `*.test.ts` must live in a directory under specs/ — with `depth: \"mirror\"` the tree mirrors a structure, and the specs root mirrors nothing (C1 — see docs/10-linting.md).",
1541
1569
  testNotMirroringDirectory: "A `*.test.ts` must be named after the directory holding it — `{{directory}}/{{directory}}.test.ts` — with `depth: \"mirror\"` (C1 — see docs/10-linting.md).",
1542
- testTooDeep: "A `*.test.ts` must sit at facet/domain depth: `specs/<facet>/<domain>/<aspect>.test.ts` — no deeper nesting (C1 — see docs/10-linting.md)."
1570
+ testOutsideFacet: "A `*.test.ts` must live in a facet folder — `specs/<facet>/<aspect>.test.ts`, or one domain deeper: with `depth: \"facet\"` the specs root holds facets, not tests (C1 — see docs/10-linting.md).",
1571
+ testTooDeep: "A `*.test.ts` must sit at facet/domain depth: `specs/<facet>/<domain>/<aspect>.test.ts` — no deeper nesting (C1 — see docs/10-linting.md).",
1572
+ testTooDeepForFacet: "A `*.test.ts` must sit at the facet root or one domain folder down — `specs/<facet>/<aspect>.test.ts` or `specs/<facet>/<domain>/<aspect>.test.ts`: with `depth: \"facet\"` nothing nests deeper (C1 — see docs/10-linting.md)."
1543
1573
  },
1544
1574
  schema: [{
1545
1575
  additionalProperties: false,
1546
1576
  properties: { depth: {
1547
1577
  enum: [
1578
+ "facet",
1548
1579
  "facet-domain",
1549
1580
  "mirror",
1550
1581
  "off"
package/dist/oxlint.js CHANGED
@@ -336,7 +336,7 @@ const RULE_DOCS = {
336
336
  },
337
337
  "c1-domain-structure": {
338
338
  channel: "statique",
339
- convention: "La forme de l’arbre `specs/` se déclare via l’option `depth` : `facet-domain` (défaut — `*.test.ts` à la profondeur facet/domain, `*.specification.ts` au root de la facette), `mirror` (test à toute profondeur ≥ 1, nommé d’après son dossier), `off`.",
339
+ convention: "La forme de l’arbre `specs/` se déclare via l’option `depth` : `facet-domain` (défaut — `*.test.ts` à la profondeur facet/domain, `*.specification.ts` au root de la facette), `facet` (test au root de la facette OU un dossier domaine plus bas, jamais plus profond), `mirror` (test à toute profondeur ≥ 1, nommé d’après son dossier), `off`.",
340
340
  family: "C",
341
341
  id: "C1",
342
342
  rationale: "Une profondeur fixe rend la place de chaque fichier prévisible et détectable statiquement."
@@ -1467,6 +1467,16 @@ const DEFAULT_DEPTH = "facet-domain";
1467
1467
  * - a `*.specification.ts` sits at the facet root — exactly
1468
1468
  * `specs/<facet>/<file>.specification.ts`, never inside a domain.
1469
1469
  *
1470
+ * `depth: 'facet'`
1471
+ *
1472
+ * The same facet root, one degree looser: the folder follows the assets. A
1473
+ * `*.test.ts` sits EITHER at the facet root (`specs/<facet>/<aspect>.test.ts`)
1474
+ * or one domain folder down (`specs/<facet>/<domain>/<aspect>.test.ts`) — a
1475
+ * test earns a domain folder when it carries assets of its own, and sits
1476
+ * beside its siblings when it does not. Anything deeper is rejected, and so is
1477
+ * a test loose at the specs root. A `*.specification.ts` sits at the facet
1478
+ * root, exactly as in `facet-domain`.
1479
+ *
1470
1480
  * `depth: 'mirror'`
1471
1481
  *
1472
1482
  * The tree mirrors something outside itself (a command tree, a source tree), so
@@ -1491,6 +1501,24 @@ const c1DomainStructure = {
1491
1501
  if (anchor === void 0) return;
1492
1502
  const base = anchor.relative.at(-1) ?? "";
1493
1503
  const nesting = anchor.relative.length - 1;
1504
+ if (depth === "facet") {
1505
+ if (base.endsWith(TEST_SUFFIX)) {
1506
+ if (nesting < 1) context.report({
1507
+ messageId: "testOutsideFacet",
1508
+ node
1509
+ });
1510
+ else if (nesting > 2) context.report({
1511
+ messageId: "testTooDeepForFacet",
1512
+ node
1513
+ });
1514
+ return;
1515
+ }
1516
+ if (base.endsWith(SPECIFICATION_SUFFIX) && nesting !== 1) context.report({
1517
+ messageId: "specNotAtFacetRoot",
1518
+ node
1519
+ });
1520
+ return;
1521
+ }
1494
1522
  if (depth === "mirror") {
1495
1523
  if (!base.endsWith(TEST_SUFFIX)) return;
1496
1524
  if (nesting < 1) {
@@ -1535,12 +1563,15 @@ const c1DomainStructure = {
1535
1563
  testAtFacetRoot: "A `*.test.ts` must live in a domain folder: `specs/<facet>/<domain>/<aspect>.test.ts` — tests directly at the facet root are forbidden (C1 — see docs/10-linting.md).",
1536
1564
  testAtSpecsRoot: "A `*.test.ts` must live in a directory under specs/ — with `depth: \"mirror\"` the tree mirrors a structure, and the specs root mirrors nothing (C1 — see docs/10-linting.md).",
1537
1565
  testNotMirroringDirectory: "A `*.test.ts` must be named after the directory holding it — `{{directory}}/{{directory}}.test.ts` — with `depth: \"mirror\"` (C1 — see docs/10-linting.md).",
1538
- testTooDeep: "A `*.test.ts` must sit at facet/domain depth: `specs/<facet>/<domain>/<aspect>.test.ts` — no deeper nesting (C1 — see docs/10-linting.md)."
1566
+ testOutsideFacet: "A `*.test.ts` must live in a facet folder — `specs/<facet>/<aspect>.test.ts`, or one domain deeper: with `depth: \"facet\"` the specs root holds facets, not tests (C1 — see docs/10-linting.md).",
1567
+ testTooDeep: "A `*.test.ts` must sit at facet/domain depth: `specs/<facet>/<domain>/<aspect>.test.ts` — no deeper nesting (C1 — see docs/10-linting.md).",
1568
+ testTooDeepForFacet: "A `*.test.ts` must sit at the facet root or one domain folder down — `specs/<facet>/<aspect>.test.ts` or `specs/<facet>/<domain>/<aspect>.test.ts`: with `depth: \"facet\"` nothing nests deeper (C1 — see docs/10-linting.md)."
1539
1569
  },
1540
1570
  schema: [{
1541
1571
  additionalProperties: false,
1542
1572
  properties: { depth: {
1543
1573
  enum: [
1574
+ "facet",
1544
1575
  "facet-domain",
1545
1576
  "mirror",
1546
1577
  "off"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jterrazz/test",
3
- "version": "12.0.2",
3
+ "version": "12.1.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",