Skip to content

Commit abf529a

Browse files
committed
docs: Add comprehensive testing guide for zx scripts
- Add complete testing documentation at docs/testing.md - Add working example script at examples/testing-example.mjs - Add complete test suite example at examples/testing-example.test.mjs - Update VitePress config to include testing guide in navigation Fixes #1297 This PR addresses the issue asking for best practices on how to test zx scripts. The documentation covers: - Mocking $.spawn for unit testing - Using custom spawn functions - Extracting logic to testable functions - Integration testing approaches - Context isolation with within() - Complete working examples All examples have been tested and verified to work correctly.
1 parent 327bfaa commit abf529a

File tree

4 files changed

+737
-0
lines changed

4 files changed

+737
-0
lines changed

docs/.vitepress/config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export default defineConfig({
6767
{ text: 'Configuration', link: '/configuration' },
6868
{ text: 'Process Promise', link: '/process-promise' },
6969
{ text: 'Process Output', link: '/process-output' },
70+
{ text: 'Testing', link: '/testing' },
7071
{ text: 'Contribution Guide', link: '/contribution' },
7172
{ text: 'Architecture', link: '/architecture' },
7273
{ text: 'Migration from v7', link: '/migration-from-v7' },

0 commit comments

Comments
 (0)