xtrm-tools 2.2.0 → 2.4.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 (286) hide show
  1. package/README.md +127 -104
  2. package/cli/dist/index.cjs +1078 -970
  3. package/cli/dist/index.cjs.map +1 -1
  4. package/cli/package.json +1 -1
  5. package/config/pi/extensions/beads.ts +33 -5
  6. package/config/pi/extensions/service-skills.ts +17 -9
  7. package/config/pi/install-schema.json +2 -1
  8. package/hooks/beads-gate-core.mjs +6 -4
  9. package/hooks/beads-memory-gate.mjs +12 -5
  10. package/hooks/hooks.json +126 -0
  11. package/package.json +3 -1
  12. package/skills/test-planning/SKILL.md +208 -0
  13. package/skills/test-planning/evals/evals.json +23 -0
  14. package/skills/using-xtrm/SKILL.md +5 -27
  15. package/project-skills/tdd-guard/.claude/hooks/tdd-guard-pretool-bridge.cjs +0 -103
  16. package/project-skills/tdd-guard/.claude/settings.json +0 -38
  17. package/project-skills/tdd-guard/.claude/skills/using-tdd-guard/SKILL.md +0 -79
  18. package/project-skills/tdd-guard/CLAUDE.md +0 -98
  19. package/project-skills/tdd-guard/CONTRIBUTING.md +0 -38
  20. package/project-skills/tdd-guard/DEVELOPMENT.md +0 -127
  21. package/project-skills/tdd-guard/LICENSE +0 -21
  22. package/project-skills/tdd-guard/README.md +0 -398
  23. package/project-skills/tdd-guard/docs/adr/001-claude-session-subdirectory.md +0 -52
  24. package/project-skills/tdd-guard/docs/adr/002-secure-claude-binary-path.md +0 -56
  25. package/project-skills/tdd-guard/docs/adr/003-remove-configurable-data-directory.md +0 -56
  26. package/project-skills/tdd-guard/docs/adr/004-monorepo-architecture.md +0 -64
  27. package/project-skills/tdd-guard/docs/adr/005-claude-project-dir-support.md +0 -55
  28. package/project-skills/tdd-guard/docs/adr/006-phpunit-separate-repository.md +0 -93
  29. package/project-skills/tdd-guard/docs/adr/007-golangci-lint-path-support.md +0 -83
  30. package/project-skills/tdd-guard/docs/adr/008-storybook-reporter-design.md +0 -182
  31. package/project-skills/tdd-guard/docs/assets/tdd-guard-demo-screenshot.gif +0 -0
  32. package/project-skills/tdd-guard/docs/config-migration.md +0 -143
  33. package/project-skills/tdd-guard/docs/configuration.md +0 -137
  34. package/project-skills/tdd-guard/docs/custom-instructions.md +0 -43
  35. package/project-skills/tdd-guard/docs/enforcement.md +0 -46
  36. package/project-skills/tdd-guard/docs/ignore-patterns.md +0 -81
  37. package/project-skills/tdd-guard/docs/linting.md +0 -109
  38. package/project-skills/tdd-guard/docs/quick-commands.md +0 -52
  39. package/project-skills/tdd-guard/docs/session-management.md +0 -75
  40. package/project-skills/tdd-guard/docs/storybook-vitest-addon.md +0 -120
  41. package/project-skills/tdd-guard/docs/validation-model.md +0 -63
  42. package/project-skills/tdd-guard/eslint.config.mjs +0 -140
  43. package/project-skills/tdd-guard/package-lock.json +0 -16937
  44. package/project-skills/tdd-guard/package.json +0 -102
  45. package/project-skills/tdd-guard/reporters/go/README.md +0 -67
  46. package/project-skills/tdd-guard/reporters/go/cmd/tdd-guard-go/main.go +0 -127
  47. package/project-skills/tdd-guard/reporters/go/cmd/tdd-guard-go/main_test.go +0 -280
  48. package/project-skills/tdd-guard/reporters/go/go.mod +0 -3
  49. package/project-skills/tdd-guard/reporters/go/go.sum +0 -0
  50. package/project-skills/tdd-guard/reporters/go/internal/formatter/formatter.go +0 -126
  51. package/project-skills/tdd-guard/reporters/go/internal/formatter/formatter_test.go +0 -264
  52. package/project-skills/tdd-guard/reporters/go/internal/io/tee_reader.go +0 -26
  53. package/project-skills/tdd-guard/reporters/go/internal/io/tee_reader_test.go +0 -37
  54. package/project-skills/tdd-guard/reporters/go/internal/parser/mixed_reader.go +0 -94
  55. package/project-skills/tdd-guard/reporters/go/internal/parser/mixed_reader_test.go +0 -198
  56. package/project-skills/tdd-guard/reporters/go/internal/parser/parser.go +0 -245
  57. package/project-skills/tdd-guard/reporters/go/internal/parser/parser_test.go +0 -547
  58. package/project-skills/tdd-guard/reporters/go/internal/storage/storage.go +0 -35
  59. package/project-skills/tdd-guard/reporters/go/internal/storage/storage_test.go +0 -113
  60. package/project-skills/tdd-guard/reporters/go/internal/transformer/transformer.go +0 -103
  61. package/project-skills/tdd-guard/reporters/go/internal/transformer/transformer_test.go +0 -303
  62. package/project-skills/tdd-guard/reporters/jest/README.md +0 -102
  63. package/project-skills/tdd-guard/reporters/jest/package.json +0 -38
  64. package/project-skills/tdd-guard/reporters/jest/src/JestReporter.test-data.ts +0 -199
  65. package/project-skills/tdd-guard/reporters/jest/src/JestReporter.test.ts +0 -302
  66. package/project-skills/tdd-guard/reporters/jest/src/JestReporter.ts +0 -201
  67. package/project-skills/tdd-guard/reporters/jest/src/index.ts +0 -4
  68. package/project-skills/tdd-guard/reporters/jest/src/types.ts +0 -42
  69. package/project-skills/tdd-guard/reporters/jest/tsconfig.json +0 -11
  70. package/project-skills/tdd-guard/reporters/phpunit/.php-cs-fixer.php +0 -28
  71. package/project-skills/tdd-guard/reporters/phpunit/README.md +0 -97
  72. package/project-skills/tdd-guard/reporters/phpunit/SYNC_README.md +0 -29
  73. package/project-skills/tdd-guard/reporters/phpunit/composer.json +0 -55
  74. package/project-skills/tdd-guard/reporters/phpunit/phpunit.xml.dist +0 -19
  75. package/project-skills/tdd-guard/reporters/phpunit/psalm.xml +0 -44
  76. package/project-skills/tdd-guard/reporters/phpunit/src/Event/ErroredTestSubscriber.php +0 -28
  77. package/project-skills/tdd-guard/reporters/phpunit/src/Event/FailedTestSubscriber.php +0 -28
  78. package/project-skills/tdd-guard/reporters/phpunit/src/Event/IncompleteTestSubscriber.php +0 -28
  79. package/project-skills/tdd-guard/reporters/phpunit/src/Event/PassedTestSubscriber.php +0 -27
  80. package/project-skills/tdd-guard/reporters/phpunit/src/Event/SkippedTestSubscriber.php +0 -28
  81. package/project-skills/tdd-guard/reporters/phpunit/src/Event/TestRunnerFinishedSubscriber.php +0 -24
  82. package/project-skills/tdd-guard/reporters/phpunit/src/PathValidator.php +0 -88
  83. package/project-skills/tdd-guard/reporters/phpunit/src/Storage.php +0 -26
  84. package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardExtension.php +0 -33
  85. package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardListener.php +0 -158
  86. package/project-skills/tdd-guard/reporters/phpunit/src/TddGuardSubscriber.php +0 -35
  87. package/project-skills/tdd-guard/reporters/phpunit/src/TestResultCollector.php +0 -105
  88. package/project-skills/tdd-guard/reporters/phpunit/tests/PathValidatorTest.php +0 -74
  89. package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardExtensionFailedTest.php +0 -241
  90. package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardExtensionTest.php +0 -84
  91. package/project-skills/tdd-guard/reporters/phpunit/tests/TddGuardStorageLocationTest.php +0 -71
  92. package/project-skills/tdd-guard/reporters/pytest/README.md +0 -77
  93. package/project-skills/tdd-guard/reporters/pytest/pyproject.toml +0 -43
  94. package/project-skills/tdd-guard/reporters/pytest/pytest.ini.example +0 -7
  95. package/project-skills/tdd-guard/reporters/pytest/tdd_guard_pytest/__init__.py +0 -1
  96. package/project-skills/tdd-guard/reporters/pytest/tdd_guard_pytest/pytest_reporter.py +0 -134
  97. package/project-skills/tdd-guard/reporters/pytest/tests/__init__.py +0 -1
  98. package/project-skills/tdd-guard/reporters/pytest/tests/conftest.py +0 -3
  99. package/project-skills/tdd-guard/reporters/pytest/tests/helpers.py +0 -293
  100. package/project-skills/tdd-guard/reporters/pytest/tests/test_config_option.py +0 -38
  101. package/project-skills/tdd-guard/reporters/pytest/tests/test_path_validation.py +0 -59
  102. package/project-skills/tdd-guard/reporters/pytest/tests/test_plugin_config.py +0 -32
  103. package/project-skills/tdd-guard/reporters/pytest/tests/test_project_root.py +0 -296
  104. package/project-skills/tdd-guard/reporters/pytest/tests/test_pytest_reporter.py +0 -137
  105. package/project-skills/tdd-guard/reporters/rspec/Gemfile +0 -3
  106. package/project-skills/tdd-guard/reporters/rust/Cargo.lock +0 -458
  107. package/project-skills/tdd-guard/reporters/rust/Cargo.toml +0 -33
  108. package/project-skills/tdd-guard/reporters/rust/Makefile.example +0 -95
  109. package/project-skills/tdd-guard/reporters/rust/README.md +0 -88
  110. package/project-skills/tdd-guard/reporters/rust/src/error_parser.rs +0 -309
  111. package/project-skills/tdd-guard/reporters/rust/src/main.rs +0 -464
  112. package/project-skills/tdd-guard/reporters/rust/src/parser.rs +0 -225
  113. package/project-skills/tdd-guard/reporters/rust/src/transformer.rs +0 -409
  114. package/project-skills/tdd-guard/reporters/storybook/README.md +0 -108
  115. package/project-skills/tdd-guard/reporters/storybook/package-lock.json +0 -9482
  116. package/project-skills/tdd-guard/reporters/storybook/package.json +0 -43
  117. package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.test-data.ts +0 -22
  118. package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.test.ts +0 -190
  119. package/project-skills/tdd-guard/reporters/storybook/src/StorybookReporter.ts +0 -88
  120. package/project-skills/tdd-guard/reporters/storybook/src/index.ts +0 -12
  121. package/project-skills/tdd-guard/reporters/storybook/src/types.ts +0 -37
  122. package/project-skills/tdd-guard/reporters/storybook/tsconfig.json +0 -11
  123. package/project-skills/tdd-guard/reporters/test/artifacts/go/failing/go.mod +0 -3
  124. package/project-skills/tdd-guard/reporters/test/artifacts/go/failing/single_failing_test.go +0 -13
  125. package/project-skills/tdd-guard/reporters/test/artifacts/go/import/go.mod +0 -3
  126. package/project-skills/tdd-guard/reporters/test/artifacts/go/import/single_import_error_test.go +0 -17
  127. package/project-skills/tdd-guard/reporters/test/artifacts/go/passing/go.mod +0 -3
  128. package/project-skills/tdd-guard/reporters/test/artifacts/go/passing/single_passing_test.go +0 -13
  129. package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-failing.test.js +0 -5
  130. package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-import-error.test.js +0 -8
  131. package/project-skills/tdd-guard/reporters/test/artifacts/jest/single-passing.test.js +0 -5
  132. package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SingleFailingTest.php +0 -11
  133. package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SingleImportErrorTest.php +0 -14
  134. package/project-skills/tdd-guard/reporters/test/artifacts/phpunit/SinglePassingTest.php +0 -11
  135. package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_failing.py +0 -3
  136. package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_import_error.py +0 -6
  137. package/project-skills/tdd-guard/reporters/test/artifacts/pytest/test_single_passing.py +0 -3
  138. package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/Cargo.lock +0 -7
  139. package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/Cargo.toml +0 -4
  140. package/project-skills/tdd-guard/reporters/test/artifacts/rust/failing/src/lib.rs +0 -14
  141. package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/Cargo.lock +0 -7
  142. package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/Cargo.toml +0 -4
  143. package/project-skills/tdd-guard/reporters/test/artifacts/rust/import/src/lib.rs +0 -13
  144. package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/Cargo.lock +0 -7
  145. package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/Cargo.toml +0 -4
  146. package/project-skills/tdd-guard/reporters/test/artifacts/rust/passing/src/lib.rs +0 -14
  147. package/project-skills/tdd-guard/reporters/test/artifacts/storybook/Calculator.js +0 -4
  148. package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-failing.stories.js +0 -15
  149. package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-import-error.stories.js +0 -14
  150. package/project-skills/tdd-guard/reporters/test/artifacts/storybook/single-passing.stories.js +0 -15
  151. package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-failing.test.js +0 -7
  152. package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-import-error.test.js +0 -9
  153. package/project-skills/tdd-guard/reporters/test/artifacts/vitest/single-passing.test.js +0 -7
  154. package/project-skills/tdd-guard/reporters/test/factories/go.ts +0 -59
  155. package/project-skills/tdd-guard/reporters/test/factories/helpers.ts +0 -48
  156. package/project-skills/tdd-guard/reporters/test/factories/index.ts +0 -7
  157. package/project-skills/tdd-guard/reporters/test/factories/jest.ts +0 -51
  158. package/project-skills/tdd-guard/reporters/test/factories/phpunit.ts +0 -63
  159. package/project-skills/tdd-guard/reporters/test/factories/pytest.ts +0 -41
  160. package/project-skills/tdd-guard/reporters/test/factories/rust.ts +0 -158
  161. package/project-skills/tdd-guard/reporters/test/factories/storybook.ts +0 -198
  162. package/project-skills/tdd-guard/reporters/test/factories/vitest.ts +0 -51
  163. package/project-skills/tdd-guard/reporters/test/reporters.integration.test.ts +0 -735
  164. package/project-skills/tdd-guard/reporters/test/types.ts +0 -28
  165. package/project-skills/tdd-guard/reporters/vitest/README.md +0 -64
  166. package/project-skills/tdd-guard/reporters/vitest/package.json +0 -35
  167. package/project-skills/tdd-guard/reporters/vitest/src/VitestReporter.test-data.ts +0 -85
  168. package/project-skills/tdd-guard/reporters/vitest/src/VitestReporter.test.ts +0 -446
  169. package/project-skills/tdd-guard/reporters/vitest/src/VitestReporter.ts +0 -110
  170. package/project-skills/tdd-guard/reporters/vitest/src/index.ts +0 -4
  171. package/project-skills/tdd-guard/reporters/vitest/src/types.ts +0 -39
  172. package/project-skills/tdd-guard/reporters/vitest/tsconfig.json +0 -11
  173. package/project-skills/tdd-guard/src/cli/buildContext.test.ts +0 -200
  174. package/project-skills/tdd-guard/src/cli/buildContext.ts +0 -48
  175. package/project-skills/tdd-guard/src/cli/tdd-guard.test.ts +0 -159
  176. package/project-skills/tdd-guard/src/cli/tdd-guard.ts +0 -48
  177. package/project-skills/tdd-guard/src/config/Config.test.ts +0 -538
  178. package/project-skills/tdd-guard/src/config/Config.ts +0 -172
  179. package/project-skills/tdd-guard/src/contracts/schemas/guardSchemas.test.ts +0 -58
  180. package/project-skills/tdd-guard/src/contracts/schemas/guardSchemas.ts +0 -8
  181. package/project-skills/tdd-guard/src/contracts/schemas/lintSchemas.test.ts +0 -347
  182. package/project-skills/tdd-guard/src/contracts/schemas/lintSchemas.ts +0 -61
  183. package/project-skills/tdd-guard/src/contracts/schemas/pytestSchemas.test.ts +0 -24
  184. package/project-skills/tdd-guard/src/contracts/schemas/pytestSchemas.ts +0 -7
  185. package/project-skills/tdd-guard/src/contracts/schemas/reporterSchemas.test.ts +0 -377
  186. package/project-skills/tdd-guard/src/contracts/schemas/reporterSchemas.ts +0 -75
  187. package/project-skills/tdd-guard/src/contracts/schemas/toolSchemas.test.ts +0 -563
  188. package/project-skills/tdd-guard/src/contracts/schemas/toolSchemas.ts +0 -140
  189. package/project-skills/tdd-guard/src/contracts/types/ClientType.ts +0 -1
  190. package/project-skills/tdd-guard/src/contracts/types/ConfigOptions.ts +0 -12
  191. package/project-skills/tdd-guard/src/contracts/types/Context.ts +0 -16
  192. package/project-skills/tdd-guard/src/contracts/types/ModelClient.ts +0 -3
  193. package/project-skills/tdd-guard/src/contracts/types/ValidationResult.ts +0 -6
  194. package/project-skills/tdd-guard/src/guard/GuardManager.test.ts +0 -336
  195. package/project-skills/tdd-guard/src/guard/GuardManager.ts +0 -83
  196. package/project-skills/tdd-guard/src/hooks/HookEvents.test.ts +0 -107
  197. package/project-skills/tdd-guard/src/hooks/HookEvents.ts +0 -39
  198. package/project-skills/tdd-guard/src/hooks/fileTypeDetection.ts +0 -16
  199. package/project-skills/tdd-guard/src/hooks/postToolLint.test.ts +0 -327
  200. package/project-skills/tdd-guard/src/hooks/postToolLint.ts +0 -165
  201. package/project-skills/tdd-guard/src/hooks/processHookData.test.ts +0 -465
  202. package/project-skills/tdd-guard/src/hooks/processHookData.ts +0 -203
  203. package/project-skills/tdd-guard/src/hooks/sessionHandler.test.ts +0 -136
  204. package/project-skills/tdd-guard/src/hooks/sessionHandler.ts +0 -31
  205. package/project-skills/tdd-guard/src/hooks/userPromptHandler.test.ts +0 -131
  206. package/project-skills/tdd-guard/src/hooks/userPromptHandler.ts +0 -55
  207. package/project-skills/tdd-guard/src/index.ts +0 -19
  208. package/project-skills/tdd-guard/src/linters/Linter.ts +0 -5
  209. package/project-skills/tdd-guard/src/linters/eslint/ESLint.test.ts +0 -183
  210. package/project-skills/tdd-guard/src/linters/eslint/ESLint.ts +0 -82
  211. package/project-skills/tdd-guard/src/linters/golangci/GolangciLint.test.ts +0 -170
  212. package/project-skills/tdd-guard/src/linters/golangci/GolangciLint.ts +0 -148
  213. package/project-skills/tdd-guard/src/processors/index.ts +0 -1
  214. package/project-skills/tdd-guard/src/processors/lintProcessor.ts +0 -77
  215. package/project-skills/tdd-guard/src/processors/testResults/TestResultsProcessor.test.ts +0 -303
  216. package/project-skills/tdd-guard/src/processors/testResults/TestResultsProcessor.ts +0 -255
  217. package/project-skills/tdd-guard/src/providers/LinterProvider.test.ts +0 -43
  218. package/project-skills/tdd-guard/src/providers/LinterProvider.ts +0 -20
  219. package/project-skills/tdd-guard/src/providers/ModelClientProvider.test.ts +0 -68
  220. package/project-skills/tdd-guard/src/providers/ModelClientProvider.ts +0 -22
  221. package/project-skills/tdd-guard/src/storage/FileStorage.test.ts +0 -76
  222. package/project-skills/tdd-guard/src/storage/FileStorage.ts +0 -108
  223. package/project-skills/tdd-guard/src/storage/MemoryStorage.ts +0 -57
  224. package/project-skills/tdd-guard/src/storage/Storage.test.ts +0 -227
  225. package/project-skills/tdd-guard/src/storage/Storage.ts +0 -17
  226. package/project-skills/tdd-guard/src/validation/context/context.test.ts +0 -364
  227. package/project-skills/tdd-guard/src/validation/context/context.ts +0 -155
  228. package/project-skills/tdd-guard/src/validation/models/AnthropicApi.test.ts +0 -171
  229. package/project-skills/tdd-guard/src/validation/models/AnthropicApi.ts +0 -49
  230. package/project-skills/tdd-guard/src/validation/models/ClaudeAgentSdk.test.ts +0 -167
  231. package/project-skills/tdd-guard/src/validation/models/ClaudeAgentSdk.ts +0 -54
  232. package/project-skills/tdd-guard/src/validation/models/ClaudeCli.test.ts +0 -239
  233. package/project-skills/tdd-guard/src/validation/models/ClaudeCli.ts +0 -57
  234. package/project-skills/tdd-guard/src/validation/prompts/file-types.ts +0 -52
  235. package/project-skills/tdd-guard/src/validation/prompts/operations/edit.ts +0 -58
  236. package/project-skills/tdd-guard/src/validation/prompts/operations/multi-edit.ts +0 -54
  237. package/project-skills/tdd-guard/src/validation/prompts/operations/write.ts +0 -54
  238. package/project-skills/tdd-guard/src/validation/prompts/response.ts +0 -40
  239. package/project-skills/tdd-guard/src/validation/prompts/rules.ts +0 -51
  240. package/project-skills/tdd-guard/src/validation/prompts/system-prompt.ts +0 -10
  241. package/project-skills/tdd-guard/src/validation/prompts/tools/lint-results.ts +0 -15
  242. package/project-skills/tdd-guard/src/validation/prompts/tools/test-output.ts +0 -14
  243. package/project-skills/tdd-guard/src/validation/prompts/tools/todos.ts +0 -9
  244. package/project-skills/tdd-guard/src/validation/validator.test.ts +0 -268
  245. package/project-skills/tdd-guard/src/validation/validator.ts +0 -159
  246. package/project-skills/tdd-guard/test/artifacts/go/.golangci.yml +0 -6
  247. package/project-skills/tdd-guard/test/artifacts/go/with-issues/file-with-issues.go +0 -12
  248. package/project-skills/tdd-guard/test/artifacts/go/with-issues/go.mod +0 -3
  249. package/project-skills/tdd-guard/test/artifacts/go/without-issues/file-without-issues.go +0 -7
  250. package/project-skills/tdd-guard/test/artifacts/go/without-issues/go.mod +0 -3
  251. package/project-skills/tdd-guard/test/artifacts/javascript/eslint.config.js +0 -20
  252. package/project-skills/tdd-guard/test/artifacts/javascript/file-with-issues.js +0 -12
  253. package/project-skills/tdd-guard/test/artifacts/javascript/file-without-issues.js +0 -10
  254. package/project-skills/tdd-guard/test/hooks/fileTypeDetection.test.ts +0 -26
  255. package/project-skills/tdd-guard/test/hooks/processHookData.fileType.test.ts +0 -46
  256. package/project-skills/tdd-guard/test/hooks/processHookData.python.test.ts +0 -68
  257. package/project-skills/tdd-guard/test/integration/test-context.test.ts +0 -66
  258. package/project-skills/tdd-guard/test/integration/validator.core.test.ts +0 -96
  259. package/project-skills/tdd-guard/test/integration/validator.scenarios.test.ts +0 -497
  260. package/project-skills/tdd-guard/test/utils/assertions.ts +0 -29
  261. package/project-skills/tdd-guard/test/utils/factories/contextFactory.ts +0 -30
  262. package/project-skills/tdd-guard/test/utils/factories/editFactory.ts +0 -82
  263. package/project-skills/tdd-guard/test/utils/factories/helpers.test.ts +0 -46
  264. package/project-skills/tdd-guard/test/utils/factories/helpers.ts +0 -46
  265. package/project-skills/tdd-guard/test/utils/factories/lintFactory.ts +0 -352
  266. package/project-skills/tdd-guard/test/utils/factories/modelClientProviderFactory.ts +0 -21
  267. package/project-skills/tdd-guard/test/utils/factories/multiEditFactory.ts +0 -79
  268. package/project-skills/tdd-guard/test/utils/factories/operations.ts +0 -57
  269. package/project-skills/tdd-guard/test/utils/factories/reporterFactory.ts +0 -55
  270. package/project-skills/tdd-guard/test/utils/factories/scenarios/index.ts +0 -22
  271. package/project-skills/tdd-guard/test/utils/factories/scenarios/languages/python.ts +0 -745
  272. package/project-skills/tdd-guard/test/utils/factories/scenarios/languages/typescript.ts +0 -767
  273. package/project-skills/tdd-guard/test/utils/factories/scenarios/types.ts +0 -77
  274. package/project-skills/tdd-guard/test/utils/factories/scenarios/utils.ts +0 -15
  275. package/project-skills/tdd-guard/test/utils/factories/sessionStartFactory.ts +0 -36
  276. package/project-skills/tdd-guard/test/utils/factories/testDefaults.ts +0 -90
  277. package/project-skills/tdd-guard/test/utils/factories/testResultsFactory.ts +0 -234
  278. package/project-skills/tdd-guard/test/utils/factories/todoFactory.ts +0 -99
  279. package/project-skills/tdd-guard/test/utils/factories/userPromptSubmitFactory.ts +0 -39
  280. package/project-skills/tdd-guard/test/utils/factories/writeFactory.ts +0 -70
  281. package/project-skills/tdd-guard/test/utils/index.ts +0 -131
  282. package/project-skills/tdd-guard/tsconfig.build.json +0 -16
  283. package/project-skills/tdd-guard/tsconfig.eslint.json +0 -17
  284. package/project-skills/tdd-guard/tsconfig.json +0 -32
  285. package/project-skills/tdd-guard/tsconfig.node.json +0 -10
  286. package/project-skills/tdd-guard/vitest.config.ts +0 -85
@@ -1,14 +0,0 @@
1
- import { expect } from '@storybook/test'
2
- import { NonExistent } from './non-existent-module' // This module doesn't exist
3
-
4
- export default {
5
- title: 'Calculator',
6
- render: () => null, // No UI component, just testing logic
7
- }
8
-
9
- export const Primary = {
10
- name: 'should add numbers correctly',
11
- play: async () => {
12
- await expect(true).toBe(true)
13
- },
14
- }
@@ -1,15 +0,0 @@
1
- import { expect } from '@storybook/test'
2
- import { Calculator } from './Calculator'
3
-
4
- export default {
5
- title: 'Calculator',
6
- render: () => null, // No UI component, just testing logic
7
- }
8
-
9
- export const Primary = {
10
- name: 'should add numbers correctly',
11
- play: async () => {
12
- const result = Calculator.add(2, 3)
13
- await expect(result).toBe(5)
14
- },
15
- }
@@ -1,7 +0,0 @@
1
- import { describe, test, expect } from 'vitest'
2
-
3
- describe('Calculator', () => {
4
- test('should add numbers correctly', () => {
5
- expect(2 + 3).toBe(6)
6
- })
7
- })
@@ -1,9 +0,0 @@
1
- import { describe, test, expect } from 'vitest'
2
- import { nonExistentFunction } from './non-existent-module'
3
-
4
- describe('Calculator', () => {
5
- test('should add numbers correctly', () => {
6
- nonExistentFunction()
7
- expect(2 + 3).toBe(5)
8
- })
9
- })
@@ -1,7 +0,0 @@
1
- import { describe, test, expect } from 'vitest'
2
-
3
- describe('Calculator', () => {
4
- test('should add numbers correctly', () => {
5
- expect(2 + 3).toBe(5)
6
- })
7
- })
@@ -1,59 +0,0 @@
1
- import { spawnSync, execFileSync } from 'node:child_process'
2
- import { join } from 'node:path'
3
- import { existsSync } from 'node:fs'
4
- import type { ReporterConfig, TestScenarios } from '../types'
5
- import { copyTestArtifacts } from './helpers'
6
-
7
- export function createGoReporter(): ReporterConfig {
8
- // Use hardcoded absolute path for security when available, fall back to PATH for CI environments
9
- const goBinary = existsSync('/usr/local/go/bin/go') ? '/usr/local/go/bin/go' : 'go'
10
- const artifactDir = 'go'
11
- const testScenarios = {
12
- singlePassing: 'passing',
13
- singleFailing: 'failing',
14
- singleImportError: 'import',
15
- }
16
-
17
- return {
18
- name: 'GoReporter',
19
- testScenarios,
20
- run: (tempDir, scenario: keyof TestScenarios) => {
21
- // Copy the test module directory to temp
22
- copyTestArtifacts(artifactDir, testScenarios, scenario, tempDir)
23
-
24
- const reporterPath = join(__dirname, '../../go')
25
- const binaryPath = join(tempDir, 'tdd-guard-go')
26
-
27
- // Build the reporter binary, output to temp directory
28
- spawnSync(goBinary, ['build', '-o', binaryPath, './cmd/tdd-guard-go'], {
29
- cwd: reporterPath,
30
- stdio: 'pipe',
31
- })
32
-
33
- // Run go test with JSON output
34
- const goTestResult = spawnSync(goBinary, ['test', '-json', '.'], {
35
- cwd: tempDir,
36
- stdio: 'pipe',
37
- encoding: 'utf8',
38
- })
39
-
40
- // Combine stdout and stderr for processing
41
- const testOutput = (goTestResult.stdout || '') + (goTestResult.stderr || '')
42
-
43
- // Pipe test output to our reporter
44
- try {
45
- execFileSync(binaryPath, ['-project-root', tempDir], {
46
- cwd: tempDir,
47
- input: testOutput,
48
- stdio: 'pipe',
49
- encoding: 'utf8',
50
- })
51
- } catch (error) {
52
- // Return the error for test verification
53
- return error as ReturnType<typeof spawnSync>
54
- }
55
-
56
- return goTestResult
57
- },
58
- }
59
- }
@@ -1,48 +0,0 @@
1
- import { copyFileSync, mkdirSync, cpSync, statSync } from 'node:fs'
2
- import { join } from 'node:path'
3
- import type { TestScenarios } from '../types'
4
-
5
- /**
6
- * Copy test artifacts from the artifacts directory to the temp directory
7
- * Handles both files and directories automatically
8
- */
9
- export function copyTestArtifacts(
10
- artifactDir: string,
11
- testScenarios: TestScenarios,
12
- scenario: keyof TestScenarios,
13
- tempDir: string,
14
- options?: {
15
- targetSubdir?: string // For PHPUnit which needs files in 'tests/'
16
- }
17
- ): void {
18
- const artifactName = testScenarios[scenario]
19
- const sourcePath = join(__dirname, '../artifacts', artifactDir, artifactName)
20
-
21
- // Check if source is a directory or file
22
- const stats = statSync(sourcePath)
23
-
24
- if (stats.isDirectory()) {
25
- // Copy entire directory contents
26
- cpSync(sourcePath, tempDir, { recursive: true })
27
- } else {
28
- // Copy single file
29
- const targetDir = options?.targetSubdir
30
- ? join(tempDir, options.targetSubdir)
31
- : tempDir
32
-
33
- // Create target directory if needed
34
- if (options?.targetSubdir) {
35
- mkdirSync(targetDir, { recursive: true })
36
- }
37
-
38
- const destPath = join(targetDir, artifactName)
39
- copyFileSync(sourcePath, destPath)
40
- }
41
- }
42
-
43
- /**
44
- * Get the path to a reporter module
45
- */
46
- export function getReporterPath(reporterModule: string): string {
47
- return join(__dirname, '../..', reporterModule).replace(/\\/g, '/')
48
- }
@@ -1,7 +0,0 @@
1
- export { createJestReporter } from './jest'
2
- export { createVitestReporter } from './vitest'
3
- export { createPhpunitReporter } from './phpunit'
4
- export { createPytestReporter } from './pytest'
5
- export { createGoReporter } from './go'
6
- export { createRustReporter } from './rust'
7
- export { createStorybookReporter } from './storybook'
@@ -1,51 +0,0 @@
1
- import { spawnSync } from 'node:child_process'
2
- import { writeFileSync } from 'node:fs'
3
- import { join } from 'node:path'
4
- import type { ReporterConfig, TestScenarios } from '../types'
5
- import { copyTestArtifacts, getReporterPath } from './helpers'
6
-
7
- export function createJestReporter(): ReporterConfig {
8
- const artifactDir = 'jest'
9
- const testScenarios = {
10
- singlePassing: 'single-passing.test.js',
11
- singleFailing: 'single-failing.test.js',
12
- singleImportError: 'single-import-error.test.js',
13
- }
14
-
15
- return {
16
- name: 'JestReporter',
17
- testScenarios,
18
- run: (tempDir, scenario: keyof TestScenarios) => {
19
- // Copy test file
20
- copyTestArtifacts(artifactDir, testScenarios, scenario, tempDir)
21
-
22
- // Write Jest config
23
- writeFileSync(join(tempDir, 'jest.config.js'), createJestConfig(tempDir))
24
-
25
- // Run Jest
26
- const jestCliPath = require.resolve('jest-cli/bin/jest')
27
- spawnSync(process.execPath, [jestCliPath, '--no-cache'], {
28
- cwd: tempDir,
29
- env: { ...process.env, CI: 'true' },
30
- stdio: 'pipe',
31
- })
32
- },
33
- }
34
- }
35
-
36
- function createJestConfig(tempDir: string): string {
37
- const reporterPath = getReporterPath('jest/dist/index.js')
38
- return `
39
- const path = require('path');
40
-
41
- module.exports = {
42
- testMatch: ['**/*.test.js'],
43
- reporters: [
44
- 'default',
45
- ['${reporterPath}', {
46
- projectRoot: '${tempDir}'
47
- }]
48
- ]
49
- };
50
- `
51
- }
@@ -1,63 +0,0 @@
1
- import { spawnSync } from 'node:child_process'
2
- import { symlinkSync, writeFileSync } from 'node:fs'
3
- import { join } from 'node:path'
4
- import type { ReporterConfig, TestScenarios } from '../types'
5
- import { copyTestArtifacts } from './helpers'
6
-
7
- export function createPhpunitReporter(): ReporterConfig {
8
- const artifactDir = 'phpunit'
9
- const testScenarios = {
10
- singlePassing: 'SinglePassingTest.php',
11
- singleFailing: 'SingleFailingTest.php',
12
- singleImportError: 'SingleImportErrorTest.php',
13
- }
14
-
15
- return {
16
- name: 'PHPUnitReporter',
17
- testScenarios,
18
- run: (tempDir, scenario: keyof TestScenarios) => {
19
- // Copy test file to tests subdirectory
20
- copyTestArtifacts(artifactDir, testScenarios, scenario, tempDir, {
21
- targetSubdir: 'tests',
22
- })
23
-
24
- // Write PHPUnit config
25
- writeFileSync(join(tempDir, 'phpunit.xml'), createPhpunitConfig(tempDir))
26
-
27
- // Create symlink to vendor directory
28
- const reporterVendorPath = join(__dirname, '../../phpunit/vendor')
29
- const tempVendorPath = join(tempDir, 'vendor')
30
- symlinkSync(reporterVendorPath, tempVendorPath)
31
-
32
- // Run PHPUnit
33
- const phpunitPath = join(__dirname, '../../phpunit/vendor/bin/phpunit')
34
- spawnSync(phpunitPath, ['-c', 'phpunit.xml'], {
35
- cwd: tempDir,
36
- env: { ...process.env },
37
- stdio: 'pipe',
38
- })
39
- },
40
- }
41
- }
42
-
43
- function createPhpunitConfig(tempDir: string): string {
44
- return `<?xml version="1.0" encoding="UTF-8"?>
45
- <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
46
- xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
47
- bootstrap="vendor/autoload.php"
48
- colors="true"
49
- stopOnFailure="false">
50
- <testsuites>
51
- <testsuite name="Integration Tests">
52
- <directory>tests</directory>
53
- </testsuite>
54
- </testsuites>
55
-
56
- <extensions>
57
- <bootstrap class="TddGuard\\PHPUnit\\TddGuardExtension">
58
- <parameter name="projectRoot" value="${tempDir}"/>
59
- </bootstrap>
60
- </extensions>
61
- </phpunit>
62
- `
63
- }
@@ -1,41 +0,0 @@
1
- import { spawnSync } from 'node:child_process'
2
- import { writeFileSync } from 'node:fs'
3
- import { join } from 'node:path'
4
- import type { ReporterConfig, TestScenarios } from '../types'
5
- import { copyTestArtifacts } from './helpers'
6
-
7
- export function createPytestReporter(): ReporterConfig {
8
- const artifactDir = 'pytest'
9
- const testScenarios = {
10
- singlePassing: 'test_single_passing.py',
11
- singleFailing: 'test_single_failing.py',
12
- singleImportError: 'test_single_import_error.py',
13
- }
14
-
15
- return {
16
- name: 'PytestReporter',
17
- testScenarios,
18
- run: (tempDir, scenario: keyof TestScenarios) => {
19
- // Copy test file
20
- copyTestArtifacts(artifactDir, testScenarios, scenario, tempDir)
21
-
22
- // Write pytest config
23
- writeFileSync(join(tempDir, 'pytest.ini'), createPytestConfig(tempDir))
24
-
25
- // Run pytest
26
- const pytestPath = join(__dirname, '../../pytest/.venv/bin/pytest')
27
- const testFile = testScenarios[scenario]
28
- spawnSync(pytestPath, [testFile, '-c', 'pytest.ini'], {
29
- cwd: tempDir,
30
- stdio: 'pipe',
31
- encoding: 'utf8',
32
- })
33
- },
34
- }
35
- }
36
-
37
- function createPytestConfig(tempDir: string): string {
38
- return `[pytest]
39
- tdd_guard_project_root = ${tempDir}
40
- `
41
- }
@@ -1,158 +0,0 @@
1
- // test/factories/rust.ts - Update required for the simplified Rust reporter
2
-
3
- import { spawnSync, execFileSync } from 'node:child_process'
4
- import { join } from 'node:path'
5
- import { existsSync, writeFileSync, copyFileSync } from 'node:fs'
6
- import type { ReporterConfig, TestScenarios } from '../types'
7
- import { copyTestArtifacts } from './helpers'
8
-
9
- export function createRustReporter(): ReporterConfig {
10
- // Use hardcoded absolute path for security when available, fall back to PATH for CI environments
11
- const rustBinary = existsSync('/usr/local/bin/cargo')
12
- ? '/usr/local/bin/cargo'
13
- : 'cargo'
14
- const artifactDir = 'rust'
15
- const testScenarios = {
16
- singlePassing: 'passing',
17
- singleFailing: 'failing',
18
- singleImportError: 'import',
19
- }
20
-
21
- return {
22
- name: 'RustReporter',
23
- testScenarios,
24
- run: (tempDir, scenario: keyof TestScenarios) => {
25
- // Copy the test module directory to temp
26
- copyTestArtifacts(artifactDir, testScenarios, scenario, tempDir)
27
-
28
- // Clean any cached build artifacts
29
- spawnSync(rustBinary, ['clean'], {
30
- cwd: tempDir,
31
- stdio: 'pipe',
32
- })
33
-
34
- const reporterPath = join(__dirname, '../../rust')
35
- const binaryPath = join(tempDir, 'tdd-guard-rust')
36
-
37
- // Build the reporter binary
38
- const buildResult = spawnSync(rustBinary, ['build', '--release'], {
39
- cwd: reporterPath,
40
- stdio: 'pipe',
41
- })
42
- if (buildResult.status !== 0) {
43
- throw new Error(`Failed to build rust reporter: ${buildResult.stderr}`)
44
- }
45
-
46
- // Copy the binary to temp dir using Node.js fs (portable, no shell dependency)
47
- const sourcePath = join(reporterPath, 'target/release/tdd-guard-rust')
48
- copyFileSync(sourcePath, binaryPath)
49
-
50
- // Check if nextest is available
51
- const hasNextest =
52
- spawnSync(rustBinary, ['nextest', '--version'], {
53
- stdio: 'pipe',
54
- }).status === 0
55
-
56
- // Run cargo test with JSON output (best effort)
57
- let cargoTestResult
58
-
59
- if (hasNextest) {
60
- // Try nextest first
61
- cargoTestResult = spawnSync(
62
- rustBinary,
63
- [
64
- 'nextest',
65
- 'run',
66
- '--message-format',
67
- 'libtest-json',
68
- '--no-fail-fast',
69
- ],
70
- {
71
- cwd: tempDir,
72
- stdio: 'pipe',
73
- encoding: 'utf8',
74
- env: { ...process.env, NEXTEST_EXPERIMENTAL_LIBTEST_JSON: '1' },
75
- }
76
- )
77
- }
78
-
79
- // Fall back to cargo test if nextest not available
80
- if (!hasNextest || cargoTestResult?.status === 127) {
81
- cargoTestResult = spawnSync(
82
- rustBinary,
83
- [
84
- '+nightly',
85
- 'test',
86
- '--no-fail-fast',
87
- '--',
88
- '-Z',
89
- 'unstable-options',
90
- '--format',
91
- 'json',
92
- ],
93
- {
94
- cwd: tempDir,
95
- stdio: 'pipe',
96
- encoding: 'utf8',
97
- }
98
- )
99
- }
100
-
101
- // For import error scenario, capture compilation errors
102
- if (scenario === 'singleImportError') {
103
- const buildTestResult = spawnSync(rustBinary, ['build', '--tests'], {
104
- cwd: tempDir,
105
- stdio: 'pipe',
106
- encoding: 'utf8',
107
- })
108
-
109
- // Combine build stderr with any test output
110
- const combinedOutput = `${buildTestResult.stderr}\n${cargoTestResult?.stdout}${cargoTestResult?.stderr}`
111
-
112
- // Write debug output
113
- const debugFile = join(tempDir, 'debug-output.txt')
114
- writeFileSync(debugFile, combinedOutput)
115
-
116
- // Process with reporter in passthrough mode
117
- try {
118
- execFileSync(
119
- binaryPath,
120
- ['--project-root', tempDir, '--passthrough'],
121
- {
122
- cwd: tempDir,
123
- input: combinedOutput,
124
- stdio: 'pipe',
125
- encoding: 'utf8',
126
- }
127
- )
128
- } catch (error) {
129
- // Reporter should handle errors gracefully
130
- console.debug('Reporter processing compilation error:', error)
131
- }
132
-
133
- return buildTestResult
134
- }
135
-
136
- // For normal test scenarios, process output
137
- const testOutput = `${cargoTestResult.stdout}${cargoTestResult.stderr}`
138
-
139
- // Write debug output
140
- const debugFile = join(tempDir, 'debug-output.txt')
141
- writeFileSync(debugFile, testOutput)
142
-
143
- // Run reporter in passthrough mode
144
- try {
145
- execFileSync(binaryPath, ['--project-root', tempDir, '--passthrough'], {
146
- cwd: tempDir,
147
- input: testOutput,
148
- stdio: 'pipe',
149
- encoding: 'utf8',
150
- })
151
- } catch (error) {
152
- console.debug('Reporter error:', error)
153
- }
154
-
155
- return cargoTestResult
156
- },
157
- }
158
- }
@@ -1,198 +0,0 @@
1
- import { spawn, spawnSync } from 'node:child_process'
2
- import { writeFileSync, mkdirSync, symlinkSync } from 'node:fs'
3
- import { join } from 'node:path'
4
- import getPort from 'get-port'
5
- import type { ReporterConfig, TestScenarios } from '../types'
6
- import { copyTestArtifacts, getReporterPath } from './helpers'
7
-
8
- export function createStorybookReporter(): ReporterConfig {
9
- const artifactDir = 'storybook'
10
- const testScenarios = {
11
- singlePassing: 'single-passing.stories.js',
12
- singleFailing: 'single-failing.stories.js',
13
- singleImportError: 'single-import-error.stories.js',
14
- }
15
-
16
- return {
17
- name: 'StorybookReporter',
18
- testScenarios,
19
- run: async (tempDir, scenario: keyof TestScenarios) => {
20
- // Get an available port to avoid conflicts when running tests in parallel
21
- const port = await getPort()
22
- // Copy Calculator.js (needed by all scenarios)
23
- copyTestArtifacts(
24
- artifactDir,
25
- { common: 'Calculator.js' },
26
- 'common',
27
- tempDir
28
- )
29
-
30
- // Copy the specific test scenario story file
31
- copyTestArtifacts(artifactDir, testScenarios, scenario, tempDir)
32
-
33
- // Create .storybook directory and config
34
- const storybookDir = join(tempDir, '.storybook')
35
- mkdirSync(storybookDir, { recursive: true })
36
- writeFileSync(join(storybookDir, 'main.js'), createStorybookConfig())
37
-
38
- // Note: We don't need test-runner hooks since we're using Jest reporter to capture results
39
-
40
- // Write test-runner config
41
- writeFileSync(
42
- join(tempDir, 'test-runner-jest.config.js'),
43
- createTestRunnerConfig(tempDir)
44
- )
45
-
46
- // Create minimal package.json
47
- writeFileSync(
48
- join(tempDir, 'package.json'),
49
- JSON.stringify({ name: 'storybook-test', type: 'module' })
50
- )
51
-
52
- // Create symlink to root node_modules so Vite can resolve dependencies
53
- const rootNodeModules = join(__dirname, '../../../node_modules')
54
- const tempNodeModules = join(tempDir, 'node_modules')
55
- symlinkSync(rootNodeModules, tempNodeModules, 'dir')
56
-
57
- // Ensure cache directory exists and is writable
58
- const cacheDir = join(tempDir, '.storybook-cache')
59
- mkdirSync(cacheDir, { recursive: true })
60
-
61
- // Start Storybook dev server from root node_modules (hoisted from workspace)
62
- const storybookBinPath = join(
63
- __dirname,
64
- '../../../node_modules/.bin/storybook'
65
- )
66
-
67
- const storybookProcess = spawn(
68
- storybookBinPath,
69
- ['dev', '--config-dir', '.storybook', '--port', String(port), '--ci'],
70
- {
71
- cwd: tempDir,
72
- env: {
73
- ...process.env,
74
- NODE_ENV: 'development',
75
- PATH: '/usr/local/bin:/usr/bin:/bin',
76
- // Use custom cache directory to avoid permission issues with symlinked node_modules
77
- STORYBOOK_CACHE_DIR: join(tempDir, '.storybook-cache'),
78
- },
79
- stdio: 'pipe',
80
- }
81
- )
82
-
83
- // Wait for Storybook to be ready
84
- const waitForStorybook = new Promise<void>((resolve, reject) => {
85
- const timeout = setTimeout(() => {
86
- storybookProcess.kill()
87
- reject(new Error('Storybook dev server timed out'))
88
- }, 60000)
89
-
90
- storybookProcess.stdout!.on('data', (data) => {
91
- const output = data.toString()
92
- if (
93
- output.includes('Local:') ||
94
- output.includes(`http://localhost:${port}`)
95
- ) {
96
- clearTimeout(timeout)
97
- resolve()
98
- }
99
- })
100
-
101
- storybookProcess.stderr!.on('data', () => {
102
- // Stderr is captured but not logged during normal operation
103
- })
104
-
105
- storybookProcess.on('error', (err) => {
106
- clearTimeout(timeout)
107
- reject(err)
108
- })
109
-
110
- storybookProcess.on('exit', (code, signal) => {
111
- clearTimeout(timeout)
112
- reject(
113
- new Error(
114
- `Storybook process exited early with code ${code}, signal ${signal}`
115
- )
116
- )
117
- })
118
- })
119
-
120
- try {
121
- await waitForStorybook
122
-
123
- // Run Storybook test-runner
124
- const testRunnerPath =
125
- require.resolve('@storybook/test-runner/dist/test-storybook')
126
- spawnSync(
127
- process.execPath,
128
- [
129
- testRunnerPath,
130
- '--url',
131
- `http://localhost:${port}`,
132
- '--maxWorkers=1',
133
- ],
134
- {
135
- cwd: tempDir,
136
- env: {
137
- ...process.env,
138
- CI: 'true',
139
- NODE_ENV: 'test',
140
- },
141
- stdio: 'pipe',
142
- }
143
- )
144
-
145
- // Vitest captures test-runner output automatically
146
- } finally {
147
- // Kill Storybook dev server - use SIGKILL to ensure it dies
148
- storybookProcess.kill('SIGKILL')
149
-
150
- // Wait for process to actually exit to free up port 6006
151
- await new Promise<void>((resolve) => {
152
- storybookProcess.once('exit', () => resolve())
153
- // Fallback timeout in case exit event doesn't fire
154
- setTimeout(resolve, 1000)
155
- })
156
- }
157
- },
158
- }
159
- }
160
-
161
- function createStorybookConfig(): string {
162
- return `
163
- module.exports = {
164
- stories: ['../*.stories.js'],
165
- framework: '@storybook/react-vite',
166
- core: {
167
- disableTelemetry: true,
168
- },
169
- }
170
- `
171
- }
172
-
173
- function createTestRunnerConfig(tempDir: string): string {
174
- const jestReporterPath = getReporterPath('jest/dist/index.js')
175
- return `
176
- const { getJestConfig } = require('@storybook/test-runner');
177
-
178
- module.exports = {
179
- // Extend Storybook's default Jest config
180
- ...getJestConfig(),
181
- // Set rootDir to temp directory so Jest finds the story files
182
- rootDir: '${tempDir}',
183
- // Use our Jest reporter to capture test results from Storybook test-runner
184
- reporters: [
185
- 'default', // Keep Jest's default console output
186
- ['${jestReporterPath}', { projectRoot: '${tempDir}' }]
187
- ],
188
- testEnvironmentOptions: {
189
- 'jest-playwright': {
190
- browsers: ['chromium'],
191
- launchOptions: {
192
- headless: true,
193
- },
194
- },
195
- },
196
- }
197
- `
198
- }