@organon-methodology/testing 0.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 (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -0
  3. package/dist/adapters/vitest.d.ts +49 -0
  4. package/dist/adapters/vitest.d.ts.map +1 -0
  5. package/dist/adapters/vitest.js +60 -0
  6. package/dist/adapters/vitest.js.map +1 -0
  7. package/dist/core/assert-custom.d.ts +43 -0
  8. package/dist/core/assert-custom.d.ts.map +1 -0
  9. package/dist/core/assert-custom.js +48 -0
  10. package/dist/core/assert-custom.js.map +1 -0
  11. package/dist/core/assert-exports-present.d.ts +52 -0
  12. package/dist/core/assert-exports-present.d.ts.map +1 -0
  13. package/dist/core/assert-exports-present.js +125 -0
  14. package/dist/core/assert-exports-present.js.map +1 -0
  15. package/dist/core/assert-file-exists.d.ts +41 -0
  16. package/dist/core/assert-file-exists.d.ts.map +1 -0
  17. package/dist/core/assert-file-exists.js +52 -0
  18. package/dist/core/assert-file-exists.js.map +1 -0
  19. package/dist/core/assert-max-value.d.ts +79 -0
  20. package/dist/core/assert-max-value.d.ts.map +1 -0
  21. package/dist/core/assert-max-value.js +90 -0
  22. package/dist/core/assert-max-value.js.map +1 -0
  23. package/dist/core/assert-naming-convention.d.ts +61 -0
  24. package/dist/core/assert-naming-convention.d.ts.map +1 -0
  25. package/dist/core/assert-naming-convention.js +92 -0
  26. package/dist/core/assert-naming-convention.js.map +1 -0
  27. package/dist/core/assert-no-side-effects.d.ts +55 -0
  28. package/dist/core/assert-no-side-effects.d.ts.map +1 -0
  29. package/dist/core/assert-no-side-effects.js +72 -0
  30. package/dist/core/assert-no-side-effects.js.map +1 -0
  31. package/dist/core/assertions/exports-present.d.ts +38 -0
  32. package/dist/core/assertions/exports-present.d.ts.map +1 -0
  33. package/dist/core/assertions/exports-present.js +47 -0
  34. package/dist/core/assertions/exports-present.js.map +1 -0
  35. package/dist/core/assertions/file-exists.d.ts +45 -0
  36. package/dist/core/assertions/file-exists.d.ts.map +1 -0
  37. package/dist/core/assertions/file-exists.js +46 -0
  38. package/dist/core/assertions/file-exists.js.map +1 -0
  39. package/dist/core/assertions/max-value.d.ts +77 -0
  40. package/dist/core/assertions/max-value.d.ts.map +1 -0
  41. package/dist/core/assertions/max-value.js +60 -0
  42. package/dist/core/assertions/max-value.js.map +1 -0
  43. package/dist/core/assertions/naming-convention.d.ts +51 -0
  44. package/dist/core/assertions/naming-convention.d.ts.map +1 -0
  45. package/dist/core/assertions/naming-convention.js +73 -0
  46. package/dist/core/assertions/naming-convention.js.map +1 -0
  47. package/dist/core/assertions/no-side-effects.d.ts +47 -0
  48. package/dist/core/assertions/no-side-effects.d.ts.map +1 -0
  49. package/dist/core/assertions/no-side-effects.js +70 -0
  50. package/dist/core/assertions/no-side-effects.js.map +1 -0
  51. package/dist/core/invariant-test.d.ts +128 -0
  52. package/dist/core/invariant-test.d.ts.map +1 -0
  53. package/dist/core/invariant-test.js +174 -0
  54. package/dist/core/invariant-test.js.map +1 -0
  55. package/dist/core/resolvers/file-resolver.d.ts +92 -0
  56. package/dist/core/resolvers/file-resolver.d.ts.map +1 -0
  57. package/dist/core/resolvers/file-resolver.js +103 -0
  58. package/dist/core/resolvers/file-resolver.js.map +1 -0
  59. package/dist/core/resolvers/import-resolver.d.ts +55 -0
  60. package/dist/core/resolvers/import-resolver.d.ts.map +1 -0
  61. package/dist/core/resolvers/import-resolver.js +99 -0
  62. package/dist/core/resolvers/import-resolver.js.map +1 -0
  63. package/dist/core/resolvers/node-fs.d.ts +13 -0
  64. package/dist/core/resolvers/node-fs.d.ts.map +1 -0
  65. package/dist/core/resolvers/node-fs.js +32 -0
  66. package/dist/core/resolvers/node-fs.js.map +1 -0
  67. package/dist/core/resolvers/parallel-reader.d.ts +35 -0
  68. package/dist/core/resolvers/parallel-reader.d.ts.map +1 -0
  69. package/dist/core/resolvers/parallel-reader.js +56 -0
  70. package/dist/core/resolvers/parallel-reader.js.map +1 -0
  71. package/dist/core/resolvers/string-resolver.d.ts +66 -0
  72. package/dist/core/resolvers/string-resolver.d.ts.map +1 -0
  73. package/dist/core/resolvers/string-resolver.js +127 -0
  74. package/dist/core/resolvers/string-resolver.js.map +1 -0
  75. package/dist/core/resolvers/types.d.ts +16 -0
  76. package/dist/core/resolvers/types.d.ts.map +1 -0
  77. package/dist/core/resolvers/types.js +10 -0
  78. package/dist/core/resolvers/types.js.map +1 -0
  79. package/dist/index.d.ts +40 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +50 -0
  82. package/dist/index.js.map +1 -0
  83. package/package.json +67 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Parallel reader — batched file reading with concurrency control.
3
+ *
4
+ * Provides a shared utility for reading multiple files in parallel
5
+ * using Promise.allSettled with a configurable concurrency limit
6
+ * to avoid file descriptor exhaustion.
7
+ *
8
+ * Used by file-resolver.ts and other resolvers for efficient I/O.
9
+ */
10
+ /**
11
+ * Default concurrency limit to avoid file descriptor exhaustion.
12
+ */
13
+ const DEFAULT_CONCURRENCY = 50;
14
+ /**
15
+ * Read multiple files in parallel with concurrency control.
16
+ *
17
+ * Uses Promise.allSettled to ensure all reads complete (or fail)
18
+ * without aborting on the first error. Files are processed in
19
+ * batches to avoid exhausting file descriptors.
20
+ *
21
+ * @param paths - File paths to read
22
+ * @param fs - FileSystem implementation
23
+ * @param concurrency - Maximum number of concurrent reads (default: 50)
24
+ * @returns Results for each file (success or error)
25
+ */
26
+ export async function readFilesParallel(paths, fs, concurrency = DEFAULT_CONCURRENCY) {
27
+ const results = [];
28
+ // Process in batches
29
+ for (let i = 0; i < paths.length; i += concurrency) {
30
+ const batch = paths.slice(i, i + concurrency);
31
+ const batchResults = await Promise.allSettled(batch.map(async (path) => {
32
+ const content = await fs.readFile(path);
33
+ return { path, content };
34
+ }));
35
+ for (let j = 0; j < batchResults.length; j++) {
36
+ const result = batchResults[j];
37
+ const path = batch[j];
38
+ if (result.status === 'fulfilled') {
39
+ results.push({
40
+ path,
41
+ content: result.value.content,
42
+ });
43
+ }
44
+ else {
45
+ results.push({
46
+ path,
47
+ error: result.reason instanceof Error
48
+ ? result.reason.message
49
+ : String(result.reason),
50
+ });
51
+ }
52
+ }
53
+ }
54
+ return results;
55
+ }
56
+ //# sourceMappingURL=parallel-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallel-reader.js","sourceRoot":"","sources":["../../../src/core/resolvers/parallel-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;GAEG;AACH,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAc/B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAe,EACf,EAAc,EACd,cAAsB,mBAAmB;IAEzC,MAAM,OAAO,GAAqB,EAAE,CAAC;IAErC,qBAAqB;IACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC;QACnD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC;QAC9C,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,UAAU,CAC3C,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACvB,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACxC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC3B,CAAC,CAAC,CACH,CAAC;QAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7C,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YAC/B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAEtB,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;gBAClC,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI;oBACJ,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;iBAC9B,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI;oBACJ,KAAK,EAAE,MAAM,CAAC,MAAM,YAAY,KAAK;wBACnC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO;wBACvB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;iBAC1B,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * String resolver — generic string pattern extractor.
3
+ *
4
+ * Provides reusable utilities for extracting strings from files
5
+ * using regex patterns. Used by assertNamingConvention and
6
+ * potentially other assertions that need to extract identifiers.
7
+ *
8
+ * Design:
9
+ * - Pure extraction functions (no validation)
10
+ * - Depends on FileSystem interface for file reading
11
+ */
12
+ import type { FileSystem } from './types.js';
13
+ /**
14
+ * A string extracted from a file.
15
+ */
16
+ export interface ExtractedString {
17
+ /** Path of the file */
18
+ file: string;
19
+ /** The extracted string */
20
+ value: string;
21
+ /** The line number (1-based) where it was found, or 0 for file-level extractions */
22
+ line: number;
23
+ }
24
+ /**
25
+ * Extract file stems (filename without extension) from a list of file paths.
26
+ *
27
+ * Pure function — no I/O.
28
+ */
29
+ export declare function extractFileStems(files: string[]): ExtractedString[];
30
+ /**
31
+ * Extract strings matching a regex pattern from file contents.
32
+ *
33
+ * Pure function — takes content string, returns matches.
34
+ * The pattern must have at least one capturing group; the first
35
+ * capturing group is used as the extracted string.
36
+ */
37
+ export declare function extractByPattern(file: string, content: string, pattern: RegExp): ExtractedString[];
38
+ /**
39
+ * Result of resolving strings from files.
40
+ */
41
+ export interface ResolvedStrings {
42
+ strings: ExtractedString[];
43
+ filesRead: string[];
44
+ errors: Array<{
45
+ file: string;
46
+ message: string;
47
+ }>;
48
+ }
49
+ /**
50
+ * Resolve file stems from files matching glob patterns.
51
+ */
52
+ export declare function resolveFileStems(options: {
53
+ files: string[];
54
+ cwd?: string;
55
+ fs: FileSystem;
56
+ }): Promise<ResolvedStrings>;
57
+ /**
58
+ * Resolve strings from file contents using a regex pattern.
59
+ */
60
+ export declare function resolveStringsByPattern(options: {
61
+ files: string[];
62
+ pattern: RegExp;
63
+ cwd?: string;
64
+ fs: FileSystem;
65
+ }): Promise<ResolvedStrings>;
66
+ //# sourceMappingURL=string-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-resolver.d.ts","sourceRoot":"","sources":["../../../src/core/resolvers/string-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,eAAe,EAAE,CAOnE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,eAAe,EAAE,CAmBnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,UAAU,CAAC;CAChB,GAAG,OAAO,CAAC,eAAe,CAAC,CA2B3B;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACrD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,UAAU,CAAC;CAChB,GAAG,OAAO,CAAC,eAAe,CAAC,CA0C3B"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * String resolver — generic string pattern extractor.
3
+ *
4
+ * Provides reusable utilities for extracting strings from files
5
+ * using regex patterns. Used by assertNamingConvention and
6
+ * potentially other assertions that need to extract identifiers.
7
+ *
8
+ * Design:
9
+ * - Pure extraction functions (no validation)
10
+ * - Depends on FileSystem interface for file reading
11
+ */
12
+ import { join, basename } from 'node:path';
13
+ /**
14
+ * Extract file stems (filename without extension) from a list of file paths.
15
+ *
16
+ * Pure function — no I/O.
17
+ */
18
+ export function extractFileStems(files) {
19
+ return files.map((file) => {
20
+ const base = basename(file);
21
+ const dotIndex = base.indexOf('.');
22
+ const stem = dotIndex > 0 ? base.slice(0, dotIndex) : base;
23
+ return { file, value: stem, line: 0 };
24
+ });
25
+ }
26
+ /**
27
+ * Extract strings matching a regex pattern from file contents.
28
+ *
29
+ * Pure function — takes content string, returns matches.
30
+ * The pattern must have at least one capturing group; the first
31
+ * capturing group is used as the extracted string.
32
+ */
33
+ export function extractByPattern(file, content, pattern) {
34
+ const results = [];
35
+ const lines = content.split('\n');
36
+ for (let i = 0; i < lines.length; i++) {
37
+ const lineText = lines[i];
38
+ const localPattern = new RegExp(pattern.source, pattern.flags.replace('g', ''));
39
+ const match = localPattern.exec(lineText);
40
+ if (match && match[1] !== undefined) {
41
+ results.push({
42
+ file,
43
+ value: match[1],
44
+ line: i + 1,
45
+ });
46
+ }
47
+ }
48
+ return results;
49
+ }
50
+ /**
51
+ * Resolve file stems from files matching glob patterns.
52
+ */
53
+ export async function resolveFileStems(options) {
54
+ const { files, cwd, fs } = options;
55
+ const errors = [];
56
+ // Expand globs
57
+ const expandedPaths = [];
58
+ for (const file of files) {
59
+ if (file.includes('*') || file.includes('?')) {
60
+ try {
61
+ const expanded = await fs.glob(file, cwd ? { cwd } : undefined);
62
+ expandedPaths.push(...expanded);
63
+ }
64
+ catch (err) {
65
+ errors.push({
66
+ file,
67
+ message: `Failed to expand glob: ${err instanceof Error ? err.message : String(err)}`,
68
+ });
69
+ }
70
+ }
71
+ else {
72
+ expandedPaths.push(file);
73
+ }
74
+ }
75
+ return {
76
+ strings: extractFileStems(expandedPaths),
77
+ filesRead: expandedPaths,
78
+ errors,
79
+ };
80
+ }
81
+ /**
82
+ * Resolve strings from file contents using a regex pattern.
83
+ */
84
+ export async function resolveStringsByPattern(options) {
85
+ const { files, pattern, cwd, fs } = options;
86
+ const strings = [];
87
+ const filesRead = [];
88
+ const errors = [];
89
+ // Expand globs
90
+ const expandedPaths = [];
91
+ for (const file of files) {
92
+ if (file.includes('*') || file.includes('?')) {
93
+ try {
94
+ const expanded = await fs.glob(file, cwd ? { cwd } : undefined);
95
+ expandedPaths.push(...expanded);
96
+ }
97
+ catch (err) {
98
+ errors.push({
99
+ file,
100
+ message: `Failed to expand glob: ${err instanceof Error ? err.message : String(err)}`,
101
+ });
102
+ }
103
+ }
104
+ else {
105
+ expandedPaths.push(file);
106
+ }
107
+ }
108
+ // Read files and extract strings
109
+ for (const filePath of expandedPaths) {
110
+ const readPath = cwd ? join(cwd, filePath) : filePath;
111
+ let content;
112
+ try {
113
+ content = await fs.readFile(readPath);
114
+ }
115
+ catch (err) {
116
+ errors.push({
117
+ file: filePath,
118
+ message: `Failed to read file: ${err instanceof Error ? err.message : String(err)}`,
119
+ });
120
+ continue;
121
+ }
122
+ filesRead.push(filePath);
123
+ strings.push(...extractByPattern(filePath, content, pattern));
124
+ }
125
+ return { strings, filesRead, errors };
126
+ }
127
+ //# sourceMappingURL=string-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-resolver.js","sourceRoot":"","sources":["../../../src/core/resolvers/string-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAe3C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAe;IAC9C,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,MAAM,IAAI,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3D,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,OAAe,EACf,OAAe;IAEf,MAAM,OAAO,GAAsB,EAAE,CAAC;IACtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,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AQ,IAAI,aAAa,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QACtD,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,wBAAwB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;aACpF,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * FileSystem interface for the testing package resolver layer.
3
+ *
4
+ * Mirrors the organon-tools FileSystem interface but is self-contained
5
+ * so @organon-methodology/testing has no dependency on @organon-methodology/tools internals.
6
+ * The resolver layer uses this interface for all I/O; assertion functions
7
+ * in core/assertions/ never import this module (INV-TEST-1).
8
+ */
9
+ export interface FileSystem {
10
+ readFile(path: string): Promise<string>;
11
+ glob(pattern: string, options?: {
12
+ cwd?: string;
13
+ }): Promise<string[]>;
14
+ exists(path: string): Promise<boolean>;
15
+ }
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/resolvers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * FileSystem interface for the testing package resolver layer.
3
+ *
4
+ * Mirrors the organon-tools FileSystem interface but is self-contained
5
+ * so @organon-methodology/testing has no dependency on @organon-methodology/tools internals.
6
+ * The resolver layer uses this interface for all I/O; assertion functions
7
+ * in core/assertions/ never import this module (INV-TEST-1).
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/resolvers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @organon-methodology/testing — Semantic testing framework for tier-4 invariant verification.
3
+ *
4
+ * Public API exports for the @organon-methodology/testing package.
5
+ */
6
+ export { testInvariant, createRegistry, getDefaultRegistry, validateInvariantId, validateDescription, validateTestFn, InvariantTestError, } from './core/invariant-test.js';
7
+ export type { InvariantTestMetadata, InvariantTestFn, TestRunner, TestInvariantOptions, InvariantTestRegistry, } from './core/invariant-test.js';
8
+ export { assertMaxValue, MaxValueResolverError, MaxValueAssertionError, } from './core/assert-max-value.js';
9
+ export type { MaxValueOptions, } from './core/assert-max-value.js';
10
+ export { validateMaxValue, } from './core/assertions/max-value.js';
11
+ export type { MaxValueEntry, ValidateMaxValueOptions, MaxValueViolation, } from './core/assertions/max-value.js';
12
+ export type { FileSystem, } from './core/resolvers/types.js';
13
+ export { createNodeFileSystem } from './core/resolvers/node-fs.js';
14
+ export { resolveValues, expandGlobs, } from './core/resolvers/file-resolver.js';
15
+ export type { ExtractedValue, ResolvedValues, ResolverError, FileMatch, ResolveValuesOptions, } from './core/resolvers/file-resolver.js';
16
+ export { assertFileExists, FileExistsResolverError, FileExistsAssertionError, } from './core/assert-file-exists.js';
17
+ export type { FileExistsOptions, } from './core/assert-file-exists.js';
18
+ export { validateFileExists, } from './core/assertions/file-exists.js';
19
+ export type { FileExistsEntry, FileExistsViolation, } from './core/assertions/file-exists.js';
20
+ export { assertCustom, CustomAssertionError, } from './core/assert-custom.js';
21
+ export type { CustomAssertionOptions, } from './core/assert-custom.js';
22
+ export { assertNoSideEffects, NoSideEffectsResolverError, NoSideEffectsAssertionError, } from './core/assert-no-side-effects.js';
23
+ export type { NoSideEffectsOptions, } from './core/assert-no-side-effects.js';
24
+ export { validateNoSideEffects, isForbidden, } from './core/assertions/no-side-effects.js';
25
+ export type { NoSideEffectsViolation, } from './core/assertions/no-side-effects.js';
26
+ export { assertNamingConvention, NamingConventionResolverError, NamingConventionAssertionError, } from './core/assert-naming-convention.js';
27
+ export type { NamingConventionOptions, Convention, } from './core/assert-naming-convention.js';
28
+ export { validateNamingConvention, matchesConvention, } from './core/assertions/naming-convention.js';
29
+ export type { NamingConventionViolation, } from './core/assertions/naming-convention.js';
30
+ export { assertExportsPresent, ExportsPresentResolverError, ExportsPresentAssertionError, extractExportNames, } from './core/assert-exports-present.js';
31
+ export type { ExportsPresentOptions, } from './core/assert-exports-present.js';
32
+ export { validateExportsPresent, } from './core/assertions/exports-present.js';
33
+ export type { ExportsPresentViolation, } from './core/assertions/exports-present.js';
34
+ export { extractImports, resolveImports, } from './core/resolvers/import-resolver.js';
35
+ export type { ImportMatch, ResolvedImports, } from './core/resolvers/import-resolver.js';
36
+ export { extractFileStems, extractByPattern, resolveFileStems, resolveStringsByPattern, } from './core/resolvers/string-resolver.js';
37
+ export type { ExtractedString, ResolvedStrings, } from './core/resolvers/string-resolver.js';
38
+ export { readFilesParallel, } from './core/resolvers/parallel-reader.js';
39
+ export type { FileReadResult, } from './core/resolvers/parallel-reader.js';
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EACL,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EACL,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AAExC,YAAY,EACV,aAAa,EACb,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,gCAAgC,CAAC;AAMxC,YAAY,EACV,UAAU,GACX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EACL,aAAa,EACb,WAAW,GACZ,MAAM,mCAAmC,CAAC;AAE3C,YAAY,EACV,cAAc,EACd,cAAc,EACd,aAAa,EACb,SAAS,EACT,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAM3C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EACV,eAAe,EACf,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAM1C,OAAO,EACL,YA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Ac,GACf,MAAM,qCAAqC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @organon-methodology/testing — Semantic testing framework for tier-4 invariant verification.
3
+ *
4
+ * Public API exports for the @organon-methodology/testing package.
5
+ */
6
+ // ---------------------------------------------------------------------------
7
+ // Core: testInvariant() wrapper
8
+ // ---------------------------------------------------------------------------
9
+ export { testInvariant, createRegistry, getDefaultRegistry, validateInvariantId, validateDescription, validateTestFn, InvariantTestError, } from './core/invariant-test.js';
10
+ // ---------------------------------------------------------------------------
11
+ // Assertions: assertMaxValue()
12
+ // ---------------------------------------------------------------------------
13
+ export { assertMaxValue, MaxValueResolverError, MaxValueAssertionError, } from './core/assert-max-value.js';
14
+ // ---------------------------------------------------------------------------
15
+ // Pure assertion validators (for advanced use / testing)
16
+ // ---------------------------------------------------------------------------
17
+ export { validateMaxValue, } from './core/assertions/max-value.js';
18
+ export { createNodeFileSystem } from './core/resolvers/node-fs.js';
19
+ export { resolveValues, expandGlobs, } from './core/resolvers/file-resolver.js';
20
+ // ---------------------------------------------------------------------------
21
+ // Assertions: assertFileExists()
22
+ // ---------------------------------------------------------------------------
23
+ export { assertFileExists, FileExistsResolverError, FileExistsAssertionError, } from './core/assert-file-exists.js';
24
+ export { validateFileExists, } from './core/assertions/file-exists.js';
25
+ // ---------------------------------------------------------------------------
26
+ // Assertions: assertCustom()
27
+ // ---------------------------------------------------------------------------
28
+ export { assertCustom, CustomAssertionError, } from './core/assert-custom.js';
29
+ // ---------------------------------------------------------------------------
30
+ // Assertions: assertNoSideEffects()
31
+ // ---------------------------------------------------------------------------
32
+ export { assertNoSideEffects, NoSideEffectsResolverError, NoSideEffectsAssertionError, } from './core/assert-no-side-effects.js';
33
+ export { validateNoSideEffects, isForbidden, } from './core/assertions/no-side-effects.js';
34
+ // ---------------------------------------------------------------------------
35
+ // Assertions: assertNamingConvention()
36
+ // ---------------------------------------------------------------------------
37
+ export { assertNamingConvention, NamingConventionResolverError, NamingConventionAssertionError, } from './core/assert-naming-convention.js';
38
+ export { validateNamingConvention, matchesConvention, } from './core/assertions/naming-convention.js';
39
+ // ---------------------------------------------------------------------------
40
+ // Assertions: assertExportsPresent()
41
+ // ---------------------------------------------------------------------------
42
+ export { assertExportsPresent, ExportsPresentResolverError, ExportsPresentAssertionError, extractExportNames, } from './core/assert-exports-present.js';
43
+ export { validateExportsPresent, } from './core/assertions/exports-present.js';
44
+ // ---------------------------------------------------------------------------
45
+ // Resolvers (for advanced use)
46
+ // ---------------------------------------------------------------------------
47
+ export { extractImports, resolveImports, } from './core/resolvers/import-resolver.js';
48
+ export { extractFileStems, extractByPattern, resolveFileStems, resolveStringsByPattern, } from './core/resolvers/string-resolver.js';
49
+ export { readFilesParallel, } from './core/resolvers/parallel-reader.js';
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,8EAA8E;AAC9E,gCAAgC;AAChC,8EAA8E;AAE9E,OAAO,EACL,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAUlC,8EAA8E;AAC9E,+BAA+B;AAC/B,8EAA8E;AAE9E,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAMpC,8EAA8E;AAC9E,yDAAyD;AACzD,8EAA8E;AAE9E,OAAO,EACL,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AAgBxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EACL,aAAa,EACb,WAAW,GACZ,MAAM,mCAAmC,CAAC;AAU3C,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EACL,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAO1C,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E,OAAO,EACL,YAAY,EACZ,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAMjC,8EAA8E;AAC9E,oCAAoC;AACpC,8EAA8E;AAE9E,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,kCAAkC,CAAC;AAM1C,OAAO,EACL,qBAAqB,EACrB,WAAW,GACZ,MAAM,sCAAsC,CAAC;AAM9C,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E;AAE9E,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,oCAAoC,CAAC;AAO5C,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,wCAAwC,CAAC;AAMhD,8EAA8E;AAC9E,qCAAqC;AACrC,8EAA8E;AAE9E,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAM1C,OAAO,EACL,sBAAsB,GACvB,MAAM,sCAAsC,CAAC;AAM9C,8EAA8E;AAC9E,+BAA+B;AAC/B,8EAA8E;AAE9E,OAAO,EACL,cAAc,EACd,cAAc,GACf,MAAM,qCAAqC,CAAC;AAO7C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,qCAAqC,CAAC;AAO7C,OAAO,EACL,iBAAiB,GAClB,MAAM,qCAAqC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@organon-methodology/testing",
3
+ "version": "0.3.0",
4
+ "description": "Semantic testing framework for automated tier-4 invariant verification",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./vitest": {
14
+ "types": "./dist/adapters/vitest.d.ts",
15
+ "import": "./dist/adapters/vitest.js"
16
+ }
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/VledicFranco/organon.git",
21
+ "directory": "packages/testing"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc",
25
+ "dev": "tsc --watch",
26
+ "clean": "node --input-type=module -e \"import{rmSync}from'node:fs';rmSync('dist',{recursive:true,force:true})\"",
27
+ "test": "vitest run",
28
+ "test:watch": "vitest",
29
+ "test:coverage": "vitest run --coverage",
30
+ "prepublishOnly": "npm run clean && npm run build"
31
+ },
32
+ "keywords": [
33
+ "organon",
34
+ "testing",
35
+ "invariants",
36
+ "invariant",
37
+ "tier-4",
38
+ "verification"
39
+ ],
40
+ "author": "Organon Methodology Contributors",
41
+ "license": "MIT",
42
+ "engines": {
43
+ "node": ">=18.0.0"
44
+ },
45
+ "files": [
46
+ "dist",
47
+ "LICENSE",
48
+ "README.md"
49
+ ],
50
+ "peerDependencies": {
51
+ "vitest": ">=1.0.0"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "vitest": {
55
+ "optional": true
56
+ }
57
+ },
58
+ "devDependencies": {
59
+ "@types/node": "^20.11.0",
60
+ "@vitest/coverage-v8": "^4.0.18",
61
+ "typescript": "^5.3.0",
62
+ "vitest": "^4.0.18"
63
+ },
64
+ "dependencies": {
65
+ "fast-glob": "^3.3.3"
66
+ }
67
+ }