bluera-knowledge 0.13.3 → 0.14.1
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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +14 -0
- package/commands/uninstall.md +65 -0
- package/dist/{chunk-AOSDVRRH.js → chunk-AIS5S77C.js} +2 -2
- package/dist/{chunk-XL2UHMBL.js → chunk-UAWKTJWN.js} +134 -15
- package/dist/chunk-UAWKTJWN.js.map +1 -0
- package/dist/{chunk-AJI5DCKY.js → chunk-Y24ZJRZP.js} +8 -3
- package/dist/{chunk-AJI5DCKY.js.map → chunk-Y24ZJRZP.js.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/mcp/server.js +2 -2
- package/dist/workers/background-worker-cli.js +2 -2
- package/hooks/check-dependencies.sh +46 -57
- package/package.json +12 -1
- package/.claude/commands/code-review.md +0 -15
- package/.claude/commands/commit.md +0 -34
- package/.claude/council-cache/1a43ed5977b8f29afc79a9bf5c4082ee5ad8338c42ab991a4241a48f80c1e46d.json +0 -7
- package/.claude/hooks/post-edit-check.sh +0 -40
- package/.claude/rules/code-quality.md +0 -12
- package/.claude/rules/git.md +0 -5
- package/.claude/rules/versioning.md +0 -7
- package/.claude/settings.local.json.example +0 -45
- package/.claude/skills/atomic-commits/SKILL.md +0 -61
- package/.claude/skills/code-review-repo/skill.md +0 -62
- package/.editorconfig +0 -15
- package/.env.example +0 -21
- package/.github/workflows/auto-release.yml +0 -64
- package/.github/workflows/ci.yml +0 -168
- package/.github/workflows/release.yml +0 -74
- package/.github/workflows/update-marketplace.yml +0 -96
- package/.husky/pre-commit +0 -48
- package/.husky/pre-push +0 -39
- package/.mcp.json +0 -11
- package/.prettierrc +0 -9
- package/.versionrc.json +0 -24
- package/CLAUDE.md +0 -110
- package/CONTRIBUTING.md +0 -307
- package/NOTICE +0 -47
- package/SECURITY.md +0 -65
- package/bun.lock +0 -2036
- package/dist/chunk-XL2UHMBL.js.map +0 -1
- package/docs/claude-code-best-practices.md +0 -458
- package/docs/cli.md +0 -170
- package/docs/commands.md +0 -392
- package/docs/crawler-architecture.md +0 -89
- package/docs/mcp-integration.md +0 -130
- package/docs/token-efficiency.md +0 -91
- package/eslint-rules/require-skip-comment.js +0 -81
- package/eslint.config.js +0 -103
- package/knip.json +0 -43
- package/scripts/test-mcp-dev.js +0 -260
- package/scripts/validate-npm-release.sh +0 -314
- package/src/analysis/adapter-registry.test.ts +0 -211
- package/src/analysis/adapter-registry.ts +0 -155
- package/src/analysis/ast-parser.test.ts +0 -470
- package/src/analysis/ast-parser.ts +0 -198
- package/src/analysis/code-graph.test.ts +0 -718
- package/src/analysis/code-graph.ts +0 -249
- package/src/analysis/dependency-usage-analyzer.test.ts +0 -619
- package/src/analysis/dependency-usage-analyzer.ts +0 -433
- package/src/analysis/go-ast-parser.test.ts +0 -531
- package/src/analysis/go-ast-parser.ts +0 -471
- package/src/analysis/language-adapter.ts +0 -127
- package/src/analysis/parser-factory.test.ts +0 -210
- package/src/analysis/parser-factory.ts +0 -52
- package/src/analysis/python-ast-parser.test.ts +0 -210
- package/src/analysis/python-ast-parser.ts +0 -34
- package/src/analysis/repo-url-resolver.test.ts +0 -533
- package/src/analysis/repo-url-resolver.ts +0 -233
- package/src/analysis/rust-ast-parser.test.ts +0 -568
- package/src/analysis/rust-ast-parser.ts +0 -467
- package/src/analysis/tree-sitter-parser.test.ts +0 -297
- package/src/analysis/tree-sitter-parser.ts +0 -217
- package/src/analysis/zil/index.ts +0 -34
- package/src/analysis/zil/zil-adapter.test.ts +0 -187
- package/src/analysis/zil/zil-adapter.ts +0 -121
- package/src/analysis/zil/zil-lexer.test.ts +0 -222
- package/src/analysis/zil/zil-lexer.ts +0 -239
- package/src/analysis/zil/zil-parser.test.ts +0 -210
- package/src/analysis/zil/zil-parser.ts +0 -360
- package/src/analysis/zil/zil-special-forms.ts +0 -193
- package/src/cli/commands/crawl.test.ts +0 -1086
- package/src/cli/commands/crawl.ts +0 -220
- package/src/cli/commands/index-cmd.test.ts +0 -733
- package/src/cli/commands/index-cmd.ts +0 -128
- package/src/cli/commands/mcp.test.ts +0 -218
- package/src/cli/commands/mcp.ts +0 -18
- package/src/cli/commands/plugin-api.test.ts +0 -373
- package/src/cli/commands/plugin-api.ts +0 -82
- package/src/cli/commands/search.test.ts +0 -1047
- package/src/cli/commands/search.ts +0 -197
- package/src/cli/commands/serve.test.ts +0 -371
- package/src/cli/commands/serve.ts +0 -43
- package/src/cli/commands/setup.test.ts +0 -895
- package/src/cli/commands/setup.ts +0 -176
- package/src/cli/commands/store.test.ts +0 -1370
- package/src/cli/commands/store.ts +0 -229
- package/src/cli/commands/sync.test.ts +0 -54
- package/src/cli/commands/sync.ts +0 -313
- package/src/cli/index.ts +0 -8
- package/src/cli/program.ts +0 -59
- package/src/crawl/article-converter.test.ts +0 -576
- package/src/crawl/article-converter.ts +0 -142
- package/src/crawl/bridge.test.ts +0 -796
- package/src/crawl/bridge.ts +0 -339
- package/src/crawl/claude-client.test.ts +0 -902
- package/src/crawl/claude-client.ts +0 -261
- package/src/crawl/intelligent-crawler.test.ts +0 -1028
- package/src/crawl/intelligent-crawler.ts +0 -478
- package/src/crawl/markdown-utils.test.ts +0 -703
- package/src/crawl/markdown-utils.ts +0 -225
- package/src/crawl/schemas.ts +0 -114
- package/src/db/embeddings.test.ts +0 -79
- package/src/db/embeddings.ts +0 -78
- package/src/db/index.ts +0 -2
- package/src/db/lance.test.ts +0 -479
- package/src/db/lance.ts +0 -190
- package/src/defaults/repos.ts +0 -67
- package/src/index.ts +0 -124
- package/src/logging/index.ts +0 -25
- package/src/logging/logger.test.ts +0 -75
- package/src/logging/logger.ts +0 -145
- package/src/logging/payload.test.ts +0 -152
- package/src/logging/payload.ts +0 -119
- package/src/mcp/cache.test.ts +0 -202
- package/src/mcp/cache.ts +0 -103
- package/src/mcp/commands/index.ts +0 -22
- package/src/mcp/commands/job.commands.ts +0 -48
- package/src/mcp/commands/meta.commands.ts +0 -54
- package/src/mcp/commands/registry.ts +0 -180
- package/src/mcp/commands/store.commands.ts +0 -75
- package/src/mcp/commands/sync.commands.test.ts +0 -371
- package/src/mcp/commands/sync.commands.ts +0 -263
- package/src/mcp/handlers/execute.handler.test.ts +0 -179
- package/src/mcp/handlers/execute.handler.ts +0 -23
- package/src/mcp/handlers/index.ts +0 -39
- package/src/mcp/handlers/job.handler.test.ts +0 -189
- package/src/mcp/handlers/job.handler.ts +0 -118
- package/src/mcp/handlers/search.handler.test.ts +0 -324
- package/src/mcp/handlers/search.handler.ts +0 -287
- package/src/mcp/handlers/store.handler.test.ts +0 -408
- package/src/mcp/handlers/store.handler.ts +0 -318
- package/src/mcp/plugin-mcp-config.test.ts +0 -71
- package/src/mcp/schemas/index.test.ts +0 -356
- package/src/mcp/schemas/index.ts +0 -155
- package/src/mcp/server.test.ts +0 -91
- package/src/mcp/server.ts +0 -235
- package/src/mcp/types.ts +0 -41
- package/src/plugin/commands.test.ts +0 -925
- package/src/plugin/commands.ts +0 -311
- package/src/plugin/dependency-analyzer.test.ts +0 -380
- package/src/plugin/dependency-analyzer.ts +0 -210
- package/src/plugin/git-clone.test.ts +0 -387
- package/src/plugin/git-clone.ts +0 -57
- package/src/scripts/validate-npm-release.test.ts +0 -70
- package/src/server/app.test.ts +0 -752
- package/src/server/app.ts +0 -128
- package/src/server/index.test.ts +0 -475
- package/src/server/index.ts +0 -1
- package/src/services/chunking.service.test.ts +0 -363
- package/src/services/chunking.service.ts +0 -380
- package/src/services/code-graph.service.test.ts +0 -298
- package/src/services/code-graph.service.ts +0 -326
- package/src/services/code-unit.service.test.ts +0 -693
- package/src/services/code-unit.service.ts +0 -234
- package/src/services/config.service.test.ts +0 -146
- package/src/services/config.service.ts +0 -92
- package/src/services/gitignore.service.test.ts +0 -157
- package/src/services/gitignore.service.ts +0 -132
- package/src/services/index.service.test.ts +0 -2301
- package/src/services/index.service.ts +0 -442
- package/src/services/index.ts +0 -119
- package/src/services/job.service.test.ts +0 -531
- package/src/services/job.service.ts +0 -298
- package/src/services/project-root.service.test.ts +0 -504
- package/src/services/project-root.service.ts +0 -112
- package/src/services/search.service.test.ts +0 -2263
- package/src/services/search.service.ts +0 -1341
- package/src/services/services.test.ts +0 -108
- package/src/services/snippet.service.test.ts +0 -213
- package/src/services/snippet.service.ts +0 -193
- package/src/services/store-definition.service.test.ts +0 -440
- package/src/services/store-definition.service.ts +0 -198
- package/src/services/store.service.test.ts +0 -843
- package/src/services/store.service.ts +0 -363
- package/src/services/token.service.test.ts +0 -45
- package/src/services/token.service.ts +0 -33
- package/src/services/watch.service.test.ts +0 -600
- package/src/services/watch.service.ts +0 -84
- package/src/types/brands.test.ts +0 -47
- package/src/types/brands.ts +0 -32
- package/src/types/config.ts +0 -79
- package/src/types/document.ts +0 -54
- package/src/types/index.ts +0 -73
- package/src/types/job.ts +0 -61
- package/src/types/progress.ts +0 -9
- package/src/types/result.test.ts +0 -54
- package/src/types/result.ts +0 -41
- package/src/types/search.ts +0 -105
- package/src/types/store-definition.test.ts +0 -492
- package/src/types/store-definition.ts +0 -129
- package/src/types/store.test.ts +0 -69
- package/src/types/store.ts +0 -47
- package/src/utils/type-guards.test.ts +0 -351
- package/src/utils/type-guards.ts +0 -61
- package/src/workers/background-worker-cli.test.ts +0 -35
- package/src/workers/background-worker-cli.ts +0 -149
- package/src/workers/background-worker.test.ts +0 -222
- package/src/workers/background-worker.ts +0 -322
- package/src/workers/pid-file.test.ts +0 -167
- package/src/workers/pid-file.ts +0 -82
- package/src/workers/spawn-worker.test.ts +0 -194
- package/src/workers/spawn-worker.ts +0 -70
- package/tests/analysis/ast-parser.test.ts +0 -98
- package/tests/analysis/code-graph.test.ts +0 -60
- package/tests/fixtures/README.md +0 -114
- package/tests/fixtures/code-snippets/api/error-handling.ts +0 -256
- package/tests/fixtures/code-snippets/api/rest-controller.ts +0 -297
- package/tests/fixtures/code-snippets/auth/jwt-auth.ts +0 -197
- package/tests/fixtures/code-snippets/auth/oauth-flow.ts +0 -245
- package/tests/fixtures/code-snippets/database/repository-pattern.ts +0 -280
- package/tests/fixtures/corpus/VERSION.md +0 -25
- package/tests/fixtures/corpus/articles/jwt-authentication.md +0 -97
- package/tests/fixtures/corpus/articles/react-hooks-patterns.md +0 -127
- package/tests/fixtures/corpus/articles/typescript-generics.md +0 -111
- package/tests/fixtures/corpus/documentation/express-middleware.md +0 -71
- package/tests/fixtures/corpus/documentation/express-routing.md +0 -83
- package/tests/fixtures/corpus/documentation/node-streams.md +0 -78
- package/tests/fixtures/corpus/oss-repos/express/History.md +0 -3871
- package/tests/fixtures/corpus/oss-repos/express/LICENSE +0 -24
- package/tests/fixtures/corpus/oss-repos/express/README.md +0 -276
- package/tests/fixtures/corpus/oss-repos/express/SECURITY.md +0 -56
- package/tests/fixtures/corpus/oss-repos/express/benchmarks/Makefile +0 -17
- package/tests/fixtures/corpus/oss-repos/express/benchmarks/README.md +0 -34
- package/tests/fixtures/corpus/oss-repos/express/benchmarks/middleware.js +0 -20
- package/tests/fixtures/corpus/oss-repos/express/benchmarks/run +0 -18
- package/tests/fixtures/corpus/oss-repos/express/examples/README.md +0 -29
- package/tests/fixtures/corpus/oss-repos/express/examples/auth/index.js +0 -134
- package/tests/fixtures/corpus/oss-repos/express/examples/auth/views/foot.ejs +0 -2
- package/tests/fixtures/corpus/oss-repos/express/examples/auth/views/head.ejs +0 -20
- package/tests/fixtures/corpus/oss-repos/express/examples/auth/views/login.ejs +0 -21
- package/tests/fixtures/corpus/oss-repos/express/examples/content-negotiation/db.js +0 -9
- package/tests/fixtures/corpus/oss-repos/express/examples/content-negotiation/index.js +0 -46
- package/tests/fixtures/corpus/oss-repos/express/examples/content-negotiation/users.js +0 -19
- package/tests/fixtures/corpus/oss-repos/express/examples/cookie-sessions/index.js +0 -25
- package/tests/fixtures/corpus/oss-repos/express/examples/cookies/index.js +0 -53
- package/tests/fixtures/corpus/oss-repos/express/examples/downloads/files/CCTV/345/244/247/350/265/233/344/270/212/346/265/267/345/210/206/350/265/233/345/214/272.txt +0 -2
- package/tests/fixtures/corpus/oss-repos/express/examples/downloads/files/amazing.txt +0 -1
- package/tests/fixtures/corpus/oss-repos/express/examples/downloads/files/notes/groceries.txt +0 -3
- package/tests/fixtures/corpus/oss-repos/express/examples/downloads/index.js +0 -40
- package/tests/fixtures/corpus/oss-repos/express/examples/ejs/index.js +0 -57
- package/tests/fixtures/corpus/oss-repos/express/examples/ejs/public/stylesheets/style.css +0 -4
- package/tests/fixtures/corpus/oss-repos/express/examples/ejs/views/footer.html +0 -2
- package/tests/fixtures/corpus/oss-repos/express/examples/ejs/views/header.html +0 -9
- package/tests/fixtures/corpus/oss-repos/express/examples/ejs/views/users.html +0 -10
- package/tests/fixtures/corpus/oss-repos/express/examples/error/index.js +0 -53
- package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/index.js +0 -103
- package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/views/404.ejs +0 -3
- package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/views/500.ejs +0 -8
- package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/views/error_header.ejs +0 -10
- package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/views/footer.ejs +0 -2
- package/tests/fixtures/corpus/oss-repos/express/examples/error-pages/views/index.ejs +0 -20
- package/tests/fixtures/corpus/oss-repos/express/examples/hello-world/index.js +0 -15
- package/tests/fixtures/corpus/oss-repos/express/examples/markdown/index.js +0 -44
- package/tests/fixtures/corpus/oss-repos/express/examples/markdown/views/index.md +0 -4
- package/tests/fixtures/corpus/oss-repos/express/examples/multi-router/controllers/api_v1.js +0 -15
- package/tests/fixtures/corpus/oss-repos/express/examples/multi-router/controllers/api_v2.js +0 -15
- package/tests/fixtures/corpus/oss-repos/express/examples/multi-router/index.js +0 -18
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/main/index.js +0 -5
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/pet/index.js +0 -31
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/pet/views/edit.ejs +0 -17
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/pet/views/show.ejs +0 -15
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/user/index.js +0 -41
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/user/views/edit.hbs +0 -27
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/user/views/list.hbs +0 -18
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/user/views/show.hbs +0 -31
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/controllers/user-pet/index.js +0 -22
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/db.js +0 -16
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/index.js +0 -95
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/lib/boot.js +0 -83
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/public/style.css +0 -14
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/views/404.ejs +0 -13
- package/tests/fixtures/corpus/oss-repos/express/examples/mvc/views/5xx.ejs +0 -13
- package/tests/fixtures/corpus/oss-repos/express/examples/online/index.js +0 -61
- package/tests/fixtures/corpus/oss-repos/express/examples/params/index.js +0 -74
- package/tests/fixtures/corpus/oss-repos/express/examples/resource/index.js +0 -95
- package/tests/fixtures/corpus/oss-repos/express/examples/route-map/index.js +0 -75
- package/tests/fixtures/corpus/oss-repos/express/examples/route-middleware/index.js +0 -90
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/index.js +0 -55
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/post.js +0 -13
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/public/style.css +0 -24
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/site.js +0 -5
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/user.js +0 -47
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/footer.ejs +0 -2
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/header.ejs +0 -9
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/index.ejs +0 -10
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/posts/index.ejs +0 -12
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/users/edit.ejs +0 -23
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/users/index.ejs +0 -14
- package/tests/fixtures/corpus/oss-repos/express/examples/route-separation/views/users/view.ejs +0 -9
- package/tests/fixtures/corpus/oss-repos/express/examples/search/index.js +0 -61
- package/tests/fixtures/corpus/oss-repos/express/examples/search/public/client.js +0 -15
- package/tests/fixtures/corpus/oss-repos/express/examples/search/public/index.html +0 -21
- package/tests/fixtures/corpus/oss-repos/express/examples/session/index.js +0 -37
- package/tests/fixtures/corpus/oss-repos/express/examples/session/redis.js +0 -39
- package/tests/fixtures/corpus/oss-repos/express/examples/static-files/index.js +0 -43
- package/tests/fixtures/corpus/oss-repos/express/examples/static-files/public/css/style.css +0 -3
- package/tests/fixtures/corpus/oss-repos/express/examples/static-files/public/hello.txt +0 -1
- package/tests/fixtures/corpus/oss-repos/express/examples/static-files/public/js/app.js +0 -1
- package/tests/fixtures/corpus/oss-repos/express/examples/vhost/index.js +0 -53
- package/tests/fixtures/corpus/oss-repos/express/examples/view-constructor/github-view.js +0 -53
- package/tests/fixtures/corpus/oss-repos/express/examples/view-constructor/index.js +0 -48
- package/tests/fixtures/corpus/oss-repos/express/examples/view-locals/index.js +0 -155
- package/tests/fixtures/corpus/oss-repos/express/examples/view-locals/user.js +0 -36
- package/tests/fixtures/corpus/oss-repos/express/examples/view-locals/views/index.ejs +0 -20
- package/tests/fixtures/corpus/oss-repos/express/examples/web-service/index.js +0 -117
- package/tests/fixtures/corpus/oss-repos/express/index.js +0 -11
- package/tests/fixtures/corpus/oss-repos/express/lib/application.js +0 -631
- package/tests/fixtures/corpus/oss-repos/express/lib/express.js +0 -81
- package/tests/fixtures/corpus/oss-repos/express/lib/request.js +0 -514
- package/tests/fixtures/corpus/oss-repos/express/lib/response.js +0 -1053
- package/tests/fixtures/corpus/oss-repos/express/lib/utils.js +0 -271
- package/tests/fixtures/corpus/oss-repos/express/lib/view.js +0 -205
- package/tests/fixtures/corpus/oss-repos/express/package.json +0 -99
- package/tests/fixtures/corpus/oss-repos/express/test/Route.js +0 -274
- package/tests/fixtures/corpus/oss-repos/express/test/Router.js +0 -636
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/auth.js +0 -117
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/content-negotiation.js +0 -49
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/cookie-sessions.js +0 -38
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/cookies.js +0 -71
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/downloads.js +0 -47
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/ejs.js +0 -17
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/error-pages.js +0 -99
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/error.js +0 -29
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/hello-world.js +0 -21
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/markdown.js +0 -21
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/multi-router.js +0 -44
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/mvc.js +0 -132
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/params.js +0 -44
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/resource.js +0 -68
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/route-map.js +0 -45
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/route-separation.js +0 -97
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/vhost.js +0 -46
- package/tests/fixtures/corpus/oss-repos/express/test/acceptance/web-service.js +0 -105
- package/tests/fixtures/corpus/oss-repos/express/test/app.all.js +0 -38
- package/tests/fixtures/corpus/oss-repos/express/test/app.engine.js +0 -83
- package/tests/fixtures/corpus/oss-repos/express/test/app.head.js +0 -66
- package/tests/fixtures/corpus/oss-repos/express/test/app.js +0 -120
- package/tests/fixtures/corpus/oss-repos/express/test/app.listen.js +0 -55
- package/tests/fixtures/corpus/oss-repos/express/test/app.locals.js +0 -26
- package/tests/fixtures/corpus/oss-repos/express/test/app.options.js +0 -116
- package/tests/fixtures/corpus/oss-repos/express/test/app.param.js +0 -323
- package/tests/fixtures/corpus/oss-repos/express/test/app.render.js +0 -374
- package/tests/fixtures/corpus/oss-repos/express/test/app.request.js +0 -143
- package/tests/fixtures/corpus/oss-repos/express/test/app.response.js +0 -143
- package/tests/fixtures/corpus/oss-repos/express/test/app.route.js +0 -197
- package/tests/fixtures/corpus/oss-repos/express/test/app.router.js +0 -1217
- package/tests/fixtures/corpus/oss-repos/express/test/app.routes.error.js +0 -62
- package/tests/fixtures/corpus/oss-repos/express/test/app.use.js +0 -542
- package/tests/fixtures/corpus/oss-repos/express/test/config.js +0 -207
- package/tests/fixtures/corpus/oss-repos/express/test/exports.js +0 -82
- package/tests/fixtures/corpus/oss-repos/express/test/express.json.js +0 -755
- package/tests/fixtures/corpus/oss-repos/express/test/express.raw.js +0 -513
- package/tests/fixtures/corpus/oss-repos/express/test/express.static.js +0 -815
- package/tests/fixtures/corpus/oss-repos/express/test/express.text.js +0 -566
- package/tests/fixtures/corpus/oss-repos/express/test/express.urlencoded.js +0 -828
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/% of dogs.txt +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/.name +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/blog/index.html +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/blog/post/index.tmpl +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/broken.send +0 -0
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/default_layout/name.tmpl +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/default_layout/user.tmpl +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/email.tmpl +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/empty.txt +0 -0
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/local_layout/user.tmpl +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/name.tmpl +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/name.txt +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/nums.txt +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/pets/names.txt +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/snow /342/230/203/.gitkeep +0 -0
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/todo.html +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/todo.txt +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/user.html +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/user.tmpl +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/users/index.html +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/fixtures/users/tobi.txt +0 -1
- package/tests/fixtures/corpus/oss-repos/express/test/middleware.basic.js +0 -42
- package/tests/fixtures/corpus/oss-repos/express/test/regression.js +0 -20
- package/tests/fixtures/corpus/oss-repos/express/test/req.accepts.js +0 -125
- package/tests/fixtures/corpus/oss-repos/express/test/req.acceptsCharsets.js +0 -50
- package/tests/fixtures/corpus/oss-repos/express/test/req.acceptsEncodings.js +0 -39
- package/tests/fixtures/corpus/oss-repos/express/test/req.acceptsLanguages.js +0 -57
- package/tests/fixtures/corpus/oss-repos/express/test/req.baseUrl.js +0 -88
- package/tests/fixtures/corpus/oss-repos/express/test/req.fresh.js +0 -70
- package/tests/fixtures/corpus/oss-repos/express/test/req.get.js +0 -60
- package/tests/fixtures/corpus/oss-repos/express/test/req.host.js +0 -156
- package/tests/fixtures/corpus/oss-repos/express/test/req.hostname.js +0 -188
- package/tests/fixtures/corpus/oss-repos/express/test/req.ip.js +0 -113
- package/tests/fixtures/corpus/oss-repos/express/test/req.ips.js +0 -71
- package/tests/fixtures/corpus/oss-repos/express/test/req.is.js +0 -169
- package/tests/fixtures/corpus/oss-repos/express/test/req.path.js +0 -20
- package/tests/fixtures/corpus/oss-repos/express/test/req.protocol.js +0 -113
- package/tests/fixtures/corpus/oss-repos/express/test/req.query.js +0 -106
- package/tests/fixtures/corpus/oss-repos/express/test/req.range.js +0 -104
- package/tests/fixtures/corpus/oss-repos/express/test/req.route.js +0 -28
- package/tests/fixtures/corpus/oss-repos/express/test/req.secure.js +0 -101
- package/tests/fixtures/corpus/oss-repos/express/test/req.signedCookies.js +0 -37
- package/tests/fixtures/corpus/oss-repos/express/test/req.stale.js +0 -50
- package/tests/fixtures/corpus/oss-repos/express/test/req.subdomains.js +0 -173
- package/tests/fixtures/corpus/oss-repos/express/test/req.xhr.js +0 -42
- package/tests/fixtures/corpus/oss-repos/express/test/res.append.js +0 -116
- package/tests/fixtures/corpus/oss-repos/express/test/res.attachment.js +0 -79
- package/tests/fixtures/corpus/oss-repos/express/test/res.clearCookie.js +0 -62
- package/tests/fixtures/corpus/oss-repos/express/test/res.cookie.js +0 -295
- package/tests/fixtures/corpus/oss-repos/express/test/res.download.js +0 -487
- package/tests/fixtures/corpus/oss-repos/express/test/res.format.js +0 -248
- package/tests/fixtures/corpus/oss-repos/express/test/res.get.js +0 -21
- package/tests/fixtures/corpus/oss-repos/express/test/res.json.js +0 -186
- package/tests/fixtures/corpus/oss-repos/express/test/res.jsonp.js +0 -344
- package/tests/fixtures/corpus/oss-repos/express/test/res.links.js +0 -65
- package/tests/fixtures/corpus/oss-repos/express/test/res.locals.js +0 -40
- package/tests/fixtures/corpus/oss-repos/express/test/res.location.js +0 -316
- package/tests/fixtures/corpus/oss-repos/express/test/res.redirect.js +0 -214
- package/tests/fixtures/corpus/oss-repos/express/test/res.render.js +0 -367
- package/tests/fixtures/corpus/oss-repos/express/test/res.send.js +0 -569
- package/tests/fixtures/corpus/oss-repos/express/test/res.sendFile.js +0 -913
- package/tests/fixtures/corpus/oss-repos/express/test/res.sendStatus.js +0 -44
- package/tests/fixtures/corpus/oss-repos/express/test/res.set.js +0 -124
- package/tests/fixtures/corpus/oss-repos/express/test/res.status.js +0 -206
- package/tests/fixtures/corpus/oss-repos/express/test/res.type.js +0 -46
- package/tests/fixtures/corpus/oss-repos/express/test/res.vary.js +0 -90
- package/tests/fixtures/corpus/oss-repos/express/test/support/env.js +0 -3
- package/tests/fixtures/corpus/oss-repos/express/test/support/tmpl.js +0 -36
- package/tests/fixtures/corpus/oss-repos/express/test/support/utils.js +0 -86
- package/tests/fixtures/corpus/oss-repos/express/test/utils.js +0 -83
- package/tests/fixtures/corpus/oss-repos/hono/.devcontainer/Dockerfile +0 -11
- package/tests/fixtures/corpus/oss-repos/hono/.devcontainer/devcontainer.json +0 -21
- package/tests/fixtures/corpus/oss-repos/hono/.devcontainer/docker-compose.yml +0 -18
- package/tests/fixtures/corpus/oss-repos/hono/.eslintignore +0 -1
- package/tests/fixtures/corpus/oss-repos/hono/.eslintrc.cjs +0 -9
- package/tests/fixtures/corpus/oss-repos/hono/.gitpod.yml +0 -9
- package/tests/fixtures/corpus/oss-repos/hono/.prettierrc +0 -9
- package/tests/fixtures/corpus/oss-repos/hono/.vitest.config/jsx-runtime-default.ts +0 -15
- package/tests/fixtures/corpus/oss-repos/hono/.vitest.config/jsx-runtime-dom.ts +0 -15
- package/tests/fixtures/corpus/oss-repos/hono/.vitest.config/setup-vitest.ts +0 -47
- package/tests/fixtures/corpus/oss-repos/hono/LICENSE +0 -21
- package/tests/fixtures/corpus/oss-repos/hono/README.md +0 -91
- package/tests/fixtures/corpus/oss-repos/hono/build.ts +0 -80
- package/tests/fixtures/corpus/oss-repos/hono/bun.lockb +0 -0
- package/tests/fixtures/corpus/oss-repos/hono/bunfig.toml +0 -7
- package/tests/fixtures/corpus/oss-repos/hono/codecov.yml +0 -13
- package/tests/fixtures/corpus/oss-repos/hono/docs/CODE_OF_CONDUCT.md +0 -128
- package/tests/fixtures/corpus/oss-repos/hono/docs/CONTRIBUTING.md +0 -62
- package/tests/fixtures/corpus/oss-repos/hono/docs/MIGRATION.md +0 -295
- package/tests/fixtures/corpus/oss-repos/hono/docs/images/hono-logo.png +0 -0
- package/tests/fixtures/corpus/oss-repos/hono/docs/images/hono-logo.pxm +0 -0
- package/tests/fixtures/corpus/oss-repos/hono/docs/images/hono-logo.svg +0 -6
- package/tests/fixtures/corpus/oss-repos/hono/docs/images/hono-title.png +0 -0
- package/tests/fixtures/corpus/oss-repos/hono/docs/images/hono-title.pxm +0 -0
- package/tests/fixtures/corpus/oss-repos/hono/jsr.json +0 -119
- package/tests/fixtures/corpus/oss-repos/hono/package.cjs.json +0 -3
- package/tests/fixtures/corpus/oss-repos/hono/package.json +0 -650
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/aws-lambda/handler.ts +0 -492
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/aws-lambda/index.ts +0 -13
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/aws-lambda/types.ts +0 -144
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/conninfo.ts +0 -28
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/index.ts +0 -9
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/serve-static.ts +0 -35
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/server.ts +0 -30
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/ssg.ts +0 -27
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/bun/websocket.ts +0 -110
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-pages/handler.ts +0 -120
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-pages/index.ts +0 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/conninfo.ts +0 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/index.ts +0 -8
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/serve-static-module.ts +0 -12
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/serve-static.ts +0 -39
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/utils.ts +0 -50
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/websocket.ts +0 -50
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/conninfo.ts +0 -17
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/deno.d.ts +0 -28
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/index.ts +0 -9
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/serve-static.ts +0 -40
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/ssg.ts +0 -27
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/deno/websocket.ts +0 -51
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/lambda-edge/conninfo.ts +0 -15
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/lambda-edge/handler.ts +0 -189
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/lambda-edge/index.ts +0 -14
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/netlify/handler.ts +0 -10
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/netlify/index.ts +0 -6
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/netlify/mod.ts +0 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/service-worker/handler.ts +0 -34
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/service-worker/index.ts +0 -5
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/service-worker/types.ts +0 -14
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/vercel/conninfo.ts +0 -8
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/vercel/handler.ts +0 -9
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/vercel/index.ts +0 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/client/client.ts +0 -214
- package/tests/fixtures/corpus/oss-repos/hono/src/client/index.ts +0 -14
- package/tests/fixtures/corpus/oss-repos/hono/src/client/types.ts +0 -182
- package/tests/fixtures/corpus/oss-repos/hono/src/client/utils.ts +0 -54
- package/tests/fixtures/corpus/oss-repos/hono/src/compose.ts +0 -94
- package/tests/fixtures/corpus/oss-repos/hono/src/context.ts +0 -917
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/accepts/accepts.ts +0 -84
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/accepts/index.ts +0 -6
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/adapter/index.ts +0 -85
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/conninfo/index.ts +0 -6
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/conninfo/types.ts +0 -45
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/cookie/index.ts +0 -130
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/css/common.ts +0 -243
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/css/index.ts +0 -220
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/dev/index.ts +0 -79
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/factory/index.ts +0 -246
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/html/index.ts +0 -56
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/index.ts +0 -13
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/middleware.ts +0 -79
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/ssg.ts +0 -388
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/utils.ts +0 -71
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/streaming/index.ts +0 -9
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/streaming/sse.ts +0 -89
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/streaming/stream.ts +0 -36
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/streaming/text.ts +0 -15
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/testing/index.ts +0 -26
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/websocket/index.ts +0 -57
- package/tests/fixtures/corpus/oss-repos/hono/src/hono-base.ts +0 -523
- package/tests/fixtures/corpus/oss-repos/hono/src/hono.ts +0 -34
- package/tests/fixtures/corpus/oss-repos/hono/src/http-exception.ts +0 -78
- package/tests/fixtures/corpus/oss-repos/hono/src/index.ts +0 -51
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/base.ts +0 -419
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/children.ts +0 -20
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/components.ts +0 -195
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/constants.ts +0 -5
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/context.ts +0 -50
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/client.ts +0 -89
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/components.ts +0 -39
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/context.ts +0 -52
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/css.ts +0 -246
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/hooks/index.ts +0 -91
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/index.ts +0 -159
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/intrinsic-element/components.ts +0 -398
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/jsx-dev-runtime.ts +0 -22
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/jsx-runtime.ts +0 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/render.ts +0 -772
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/server.ts +0 -70
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/utils.ts +0 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/hooks/index.ts +0 -426
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/index.ts +0 -114
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/intrinsic-element/common.ts +0 -11
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/intrinsic-element/components.ts +0 -196
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/intrinsic-elements.ts +0 -924
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/jsx-dev-runtime.ts +0 -26
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/jsx-runtime.ts +0 -18
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/streaming.ts +0 -184
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/types.ts +0 -41
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/utils.ts +0 -36
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/basic-auth/index.ts +0 -128
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/bearer-auth/index.ts +0 -159
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/body-limit/index.ts +0 -115
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/cache/index.ts +0 -127
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/combine/index.ts +0 -153
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/compress/index.ts +0 -79
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/context-storage/index.ts +0 -55
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/cors/index.ts +0 -141
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/csrf/index.ts +0 -90
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/etag/index.ts +0 -88
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/ip-restriction/index.ts +0 -178
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/jsx-renderer/index.ts +0 -158
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/jwt/index.ts +0 -8
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/jwt/jwt.ts +0 -159
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/logger/index.ts +0 -93
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/method-override/index.ts +0 -146
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/powered-by/index.ts +0 -13
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/pretty-json/index.ts +0 -50
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/request-id/index.ts +0 -8
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/request-id/request-id.ts +0 -59
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/secure-headers/index.ts +0 -8
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/secure-headers/permissions-policy.ts +0 -86
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/secure-headers/secure-headers.ts +0 -319
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/serve-static/index.ts +0 -140
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/timeout/index.ts +0 -58
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/timing/index.ts +0 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/timing/timing.ts +0 -225
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/trailing-slash/index.ts +0 -71
- package/tests/fixtures/corpus/oss-repos/hono/src/preset/quick.ts +0 -24
- package/tests/fixtures/corpus/oss-repos/hono/src/preset/tiny.ts +0 -20
- package/tests/fixtures/corpus/oss-repos/hono/src/request.ts +0 -403
- package/tests/fixtures/corpus/oss-repos/hono/src/router/linear-router/index.ts +0 -6
- package/tests/fixtures/corpus/oss-repos/hono/src/router/linear-router/router.ts +0 -132
- package/tests/fixtures/corpus/oss-repos/hono/src/router/pattern-router/index.ts +0 -6
- package/tests/fixtures/corpus/oss-repos/hono/src/router/pattern-router/router.ts +0 -54
- package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/index.ts +0 -6
- package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/node.ts +0 -159
- package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/router.ts +0 -274
- package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/trie.ts +0 -74
- package/tests/fixtures/corpus/oss-repos/hono/src/router/smart-router/index.ts +0 -6
- package/tests/fixtures/corpus/oss-repos/hono/src/router/smart-router/router.ts +0 -69
- package/tests/fixtures/corpus/oss-repos/hono/src/router/trie-router/index.ts +0 -6
- package/tests/fixtures/corpus/oss-repos/hono/src/router/trie-router/node.ts +0 -205
- package/tests/fixtures/corpus/oss-repos/hono/src/router/trie-router/router.ts +0 -28
- package/tests/fixtures/corpus/oss-repos/hono/src/router.ts +0 -103
- package/tests/fixtures/corpus/oss-repos/hono/src/types.ts +0 -2006
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/basic-auth.ts +0 -26
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/body.ts +0 -225
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/buffer.ts +0 -65
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/color.ts +0 -26
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/concurrent.ts +0 -55
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/cookie.ts +0 -230
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/crypto.ts +0 -65
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/encode.ts +0 -34
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/filepath.ts +0 -56
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/handler.ts +0 -15
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/html.ts +0 -182
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/http-status.ts +0 -69
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/ipaddr.ts +0 -113
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/index.ts +0 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/jwa.ts +0 -23
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/jws.ts +0 -226
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/jwt.ts +0 -114
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/types.ts +0 -83
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/jwt/utf8.ts +0 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/mime.ts +0 -142
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/stream.ts +0 -96
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/types.ts +0 -102
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/url.ts +0 -310
- package/tests/fixtures/corpus/oss-repos/hono/src/validator/index.ts +0 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/validator/validator.ts +0 -151
- package/tests/fixtures/corpus/oss-repos/hono/tsconfig.build.json +0 -23
- package/tests/fixtures/corpus/oss-repos/hono/tsconfig.json +0 -28
- package/tests/fixtures/corpus/oss-repos/hono/vitest.config.ts +0 -34
- package/tests/fixtures/corpus/oss-repos/hono/yarn.lock +0 -6232
- package/tests/fixtures/documentation/api-reference.md +0 -412
- package/tests/fixtures/documentation/architecture.md +0 -214
- package/tests/fixtures/documentation/deployment-guide.md +0 -420
- package/tests/fixtures/github-readmes/express.md +0 -133
- package/tests/fixtures/github-readmes/nextjs.md +0 -106
- package/tests/fixtures/github-readmes/react.md +0 -74
- package/tests/fixtures/github-readmes/typescript.md +0 -93
- package/tests/fixtures/github-readmes/vite.md +0 -79
- package/tests/fixtures/queries/core.json +0 -125
- package/tests/fixtures/queries/extended.json +0 -427
- package/tests/fixtures/queries/generated/.gitkeep +0 -0
- package/tests/fixtures/test-server.ts +0 -268
- package/tests/helpers/performance-metrics.ts +0 -370
- package/tests/helpers/search-relevance.ts +0 -326
- package/tests/integration/cli-consistency.test.ts +0 -298
- package/tests/integration/cli.test.ts +0 -69
- package/tests/integration/e2e-workflow.test.ts +0 -614
- package/tests/integration/mcp.test.ts +0 -250
- package/tests/integration/python-bridge.test.ts +0 -193
- package/tests/integration/search-quality.test.ts +0 -720
- package/tests/integration/serve.test.ts +0 -260
- package/tests/integration/stress.test.ts +0 -326
- package/tests/mcp/server.test.ts +0 -15
- package/tests/scripts/schemas/evaluation.json +0 -44
- package/tests/scripts/schemas/query-generation.json +0 -21
- package/tests/services/code-unit.service.test.ts +0 -95
- package/tests/services/job.service.test.ts +0 -124
- package/tests/services/search.progressive-context.test.ts +0 -35
- package/tsconfig.json +0 -34
- package/tsup.config.ts +0 -15
- package/turndown-plugin-gfm.d.ts +0 -29
- package/vitest.config.ts +0 -90
- /package/dist/{chunk-AOSDVRRH.js.map → chunk-AIS5S77C.js.map} +0 -0
|
@@ -1,902 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Comprehensive tests for ClaudeClient
|
|
3
|
-
* Coverage: determineCrawlUrls, extractContent, subprocess management, timeouts, JSON parsing, exit codes, truncation
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
7
|
-
import { ClaudeClient } from './claude-client.js';
|
|
8
|
-
import type { ChildProcess } from 'node:child_process';
|
|
9
|
-
import { EventEmitter } from 'node:events';
|
|
10
|
-
|
|
11
|
-
// Mock child_process
|
|
12
|
-
vi.mock('node:child_process', () => ({
|
|
13
|
-
spawn: vi.fn(),
|
|
14
|
-
execSync: vi.fn(),
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
|
-
const { spawn, execSync } = await import('node:child_process');
|
|
18
|
-
|
|
19
|
-
describe('ClaudeClient', () => {
|
|
20
|
-
let client: ClaudeClient;
|
|
21
|
-
let mockProcess: MockChildProcess;
|
|
22
|
-
|
|
23
|
-
class MockChildProcess extends EventEmitter {
|
|
24
|
-
stdin = {
|
|
25
|
-
write: vi.fn(),
|
|
26
|
-
end: vi.fn(),
|
|
27
|
-
};
|
|
28
|
-
stdout = new EventEmitter();
|
|
29
|
-
stderr = new EventEmitter();
|
|
30
|
-
kill = vi.fn();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
beforeEach(() => {
|
|
34
|
-
vi.clearAllMocks();
|
|
35
|
-
ClaudeClient.resetAvailabilityCache(); // Reset static cache between tests
|
|
36
|
-
client = new ClaudeClient({ timeout: 100 }); // Short timeout for tests
|
|
37
|
-
mockProcess = new MockChildProcess();
|
|
38
|
-
vi.mocked(spawn).mockReturnValue(mockProcess as unknown as ChildProcess);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe('isAvailable', () => {
|
|
42
|
-
it('should return true when claude is in PATH', () => {
|
|
43
|
-
vi.mocked(execSync).mockReturnValue(Buffer.from('/usr/local/bin/claude'));
|
|
44
|
-
|
|
45
|
-
expect(ClaudeClient.isAvailable()).toBe(true);
|
|
46
|
-
expect(execSync).toHaveBeenCalledWith('which claude', { stdio: 'ignore' });
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should return false when claude is not in PATH', () => {
|
|
50
|
-
vi.mocked(execSync).mockImplementation(() => {
|
|
51
|
-
throw new Error('Command not found');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
expect(ClaudeClient.isAvailable()).toBe(false);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('should cache the result after first check', () => {
|
|
58
|
-
vi.mocked(execSync).mockReturnValue(Buffer.from('/usr/local/bin/claude'));
|
|
59
|
-
|
|
60
|
-
// First call
|
|
61
|
-
expect(ClaudeClient.isAvailable()).toBe(true);
|
|
62
|
-
expect(execSync).toHaveBeenCalledTimes(1);
|
|
63
|
-
|
|
64
|
-
// Second call - should use cache
|
|
65
|
-
expect(ClaudeClient.isAvailable()).toBe(true);
|
|
66
|
-
expect(execSync).toHaveBeenCalledTimes(1); // Still 1, not 2
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should reset cache with resetAvailabilityCache', () => {
|
|
70
|
-
vi.mocked(execSync).mockReturnValue(Buffer.from('/usr/local/bin/claude'));
|
|
71
|
-
|
|
72
|
-
expect(ClaudeClient.isAvailable()).toBe(true);
|
|
73
|
-
expect(execSync).toHaveBeenCalledTimes(1);
|
|
74
|
-
|
|
75
|
-
ClaudeClient.resetAvailabilityCache();
|
|
76
|
-
|
|
77
|
-
expect(ClaudeClient.isAvailable()).toBe(true);
|
|
78
|
-
expect(execSync).toHaveBeenCalledTimes(2); // Called again after reset
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
describe('determineCrawlUrls', () => {
|
|
83
|
-
it('should successfully parse valid crawl strategy response', async () => {
|
|
84
|
-
const promise = client.determineCrawlUrls(
|
|
85
|
-
'https://example.com',
|
|
86
|
-
'<html>test</html>',
|
|
87
|
-
'Find all docs'
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// Simulate successful response
|
|
91
|
-
setTimeout(() => {
|
|
92
|
-
mockProcess.stdout.emit(
|
|
93
|
-
'data',
|
|
94
|
-
Buffer.from(
|
|
95
|
-
JSON.stringify({
|
|
96
|
-
urls: ['https://example.com/page1', 'https://example.com/page2'],
|
|
97
|
-
reasoning: 'Found documentation pages',
|
|
98
|
-
})
|
|
99
|
-
)
|
|
100
|
-
);
|
|
101
|
-
mockProcess.emit('close', 0);
|
|
102
|
-
}, 10);
|
|
103
|
-
|
|
104
|
-
const result = await promise;
|
|
105
|
-
expect(result.urls).toEqual(['https://example.com/page1', 'https://example.com/page2']);
|
|
106
|
-
expect(result.reasoning).toBe('Found documentation pages');
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('should extract structured_output from Claude CLI wrapper format', async () => {
|
|
110
|
-
const promise = client.determineCrawlUrls(
|
|
111
|
-
'https://example.com',
|
|
112
|
-
'<html>test</html>',
|
|
113
|
-
'Find all docs'
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
// Claude CLI with --json-schema returns this wrapper format
|
|
117
|
-
setTimeout(() => {
|
|
118
|
-
mockProcess.stdout.emit(
|
|
119
|
-
'data',
|
|
120
|
-
Buffer.from(
|
|
121
|
-
JSON.stringify({
|
|
122
|
-
type: 'result',
|
|
123
|
-
subtype: 'success',
|
|
124
|
-
result: '',
|
|
125
|
-
structured_output: {
|
|
126
|
-
urls: ['https://example.com/page1', 'https://example.com/page2'],
|
|
127
|
-
reasoning: 'Found documentation pages',
|
|
128
|
-
},
|
|
129
|
-
})
|
|
130
|
-
)
|
|
131
|
-
);
|
|
132
|
-
mockProcess.emit('close', 0);
|
|
133
|
-
}, 10);
|
|
134
|
-
|
|
135
|
-
const result = await promise;
|
|
136
|
-
expect(result.urls).toEqual(['https://example.com/page1', 'https://example.com/page2']);
|
|
137
|
-
expect(result.reasoning).toBe('Found documentation pages');
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it('should fall back to raw response when structured_output is not an object', async () => {
|
|
141
|
-
const promise = client.determineCrawlUrls(
|
|
142
|
-
'https://example.com',
|
|
143
|
-
'<html>test</html>',
|
|
144
|
-
'Find all docs'
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
// When structured_output is not an object, use the raw response
|
|
148
|
-
// (which will fail validation if it doesn't have urls/reasoning)
|
|
149
|
-
setTimeout(() => {
|
|
150
|
-
mockProcess.stdout.emit(
|
|
151
|
-
'data',
|
|
152
|
-
Buffer.from(
|
|
153
|
-
JSON.stringify({
|
|
154
|
-
type: 'result',
|
|
155
|
-
structured_output: 'not an object',
|
|
156
|
-
})
|
|
157
|
-
)
|
|
158
|
-
);
|
|
159
|
-
mockProcess.emit('close', 0);
|
|
160
|
-
}, 10);
|
|
161
|
-
|
|
162
|
-
await expect(promise).rejects.toThrow('invalid crawl strategy');
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('should call spawn with correct arguments for determineCrawlUrls', async () => {
|
|
166
|
-
const promise = client.determineCrawlUrls(
|
|
167
|
-
'https://example.com',
|
|
168
|
-
'<html>test</html>',
|
|
169
|
-
'Find all docs'
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
setTimeout(() => {
|
|
173
|
-
mockProcess.stdout.emit(
|
|
174
|
-
'data',
|
|
175
|
-
Buffer.from(
|
|
176
|
-
JSON.stringify({
|
|
177
|
-
urls: ['https://example.com/page1'],
|
|
178
|
-
reasoning: 'Test',
|
|
179
|
-
})
|
|
180
|
-
)
|
|
181
|
-
);
|
|
182
|
-
mockProcess.emit('close', 0);
|
|
183
|
-
}, 10);
|
|
184
|
-
|
|
185
|
-
await promise;
|
|
186
|
-
|
|
187
|
-
expect(spawn).toHaveBeenCalledWith(
|
|
188
|
-
'claude',
|
|
189
|
-
expect.arrayContaining([
|
|
190
|
-
'-p',
|
|
191
|
-
'--json-schema',
|
|
192
|
-
expect.any(String),
|
|
193
|
-
'--output-format',
|
|
194
|
-
'json',
|
|
195
|
-
]),
|
|
196
|
-
expect.objectContaining({
|
|
197
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
198
|
-
})
|
|
199
|
-
);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
it('should write prompt to stdin', async () => {
|
|
203
|
-
const promise = client.determineCrawlUrls(
|
|
204
|
-
'https://example.com',
|
|
205
|
-
'<html><body>Test</body></html>',
|
|
206
|
-
'Find tutorials'
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
setTimeout(() => {
|
|
210
|
-
mockProcess.stdout.emit(
|
|
211
|
-
'data',
|
|
212
|
-
Buffer.from(
|
|
213
|
-
JSON.stringify({
|
|
214
|
-
urls: ['https://example.com/tutorial'],
|
|
215
|
-
reasoning: 'Found tutorial',
|
|
216
|
-
})
|
|
217
|
-
)
|
|
218
|
-
);
|
|
219
|
-
mockProcess.emit('close', 0);
|
|
220
|
-
}, 10);
|
|
221
|
-
|
|
222
|
-
await promise;
|
|
223
|
-
|
|
224
|
-
expect(mockProcess.stdin.write).toHaveBeenCalledWith(
|
|
225
|
-
expect.stringContaining('Find tutorials')
|
|
226
|
-
);
|
|
227
|
-
expect(mockProcess.stdin.end).toHaveBeenCalled();
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
it('should reject when response has no urls array', async () => {
|
|
231
|
-
const promise = client.determineCrawlUrls(
|
|
232
|
-
'https://example.com',
|
|
233
|
-
'<html>test</html>',
|
|
234
|
-
'Find all'
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
setTimeout(() => {
|
|
238
|
-
mockProcess.stdout.emit(
|
|
239
|
-
'data',
|
|
240
|
-
Buffer.from(
|
|
241
|
-
JSON.stringify({
|
|
242
|
-
reasoning: 'No URLs found',
|
|
243
|
-
})
|
|
244
|
-
)
|
|
245
|
-
);
|
|
246
|
-
mockProcess.emit('close', 0);
|
|
247
|
-
}, 10);
|
|
248
|
-
|
|
249
|
-
await expect(promise).rejects.toThrow('invalid crawl strategy');
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
it('should reject when response has empty urls array', async () => {
|
|
253
|
-
const promise = client.determineCrawlUrls(
|
|
254
|
-
'https://example.com',
|
|
255
|
-
'<html>test</html>',
|
|
256
|
-
'Find all'
|
|
257
|
-
);
|
|
258
|
-
|
|
259
|
-
setTimeout(() => {
|
|
260
|
-
mockProcess.stdout.emit(
|
|
261
|
-
'data',
|
|
262
|
-
Buffer.from(
|
|
263
|
-
JSON.stringify({
|
|
264
|
-
urls: [],
|
|
265
|
-
reasoning: 'No matching pages',
|
|
266
|
-
})
|
|
267
|
-
)
|
|
268
|
-
);
|
|
269
|
-
mockProcess.emit('close', 0);
|
|
270
|
-
}, 10);
|
|
271
|
-
|
|
272
|
-
await expect(promise).rejects.toThrow('invalid crawl strategy');
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it('should reject when response has no reasoning', async () => {
|
|
276
|
-
const promise = client.determineCrawlUrls(
|
|
277
|
-
'https://example.com',
|
|
278
|
-
'<html>test</html>',
|
|
279
|
-
'Find all'
|
|
280
|
-
);
|
|
281
|
-
|
|
282
|
-
setTimeout(() => {
|
|
283
|
-
mockProcess.stdout.emit(
|
|
284
|
-
'data',
|
|
285
|
-
Buffer.from(
|
|
286
|
-
JSON.stringify({
|
|
287
|
-
urls: ['https://example.com/page1'],
|
|
288
|
-
})
|
|
289
|
-
)
|
|
290
|
-
);
|
|
291
|
-
mockProcess.emit('close', 0);
|
|
292
|
-
}, 10);
|
|
293
|
-
|
|
294
|
-
await expect(promise).rejects.toThrow('invalid crawl strategy');
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
it('should reject when urls contains non-string values', async () => {
|
|
298
|
-
const promise = client.determineCrawlUrls(
|
|
299
|
-
'https://example.com',
|
|
300
|
-
'<html>test</html>',
|
|
301
|
-
'Find all'
|
|
302
|
-
);
|
|
303
|
-
|
|
304
|
-
setTimeout(() => {
|
|
305
|
-
mockProcess.stdout.emit(
|
|
306
|
-
'data',
|
|
307
|
-
Buffer.from(
|
|
308
|
-
JSON.stringify({
|
|
309
|
-
urls: ['https://example.com/page1', 123, null],
|
|
310
|
-
reasoning: 'Mixed types',
|
|
311
|
-
})
|
|
312
|
-
)
|
|
313
|
-
);
|
|
314
|
-
mockProcess.emit('close', 0);
|
|
315
|
-
}, 10);
|
|
316
|
-
|
|
317
|
-
await expect(promise).rejects.toThrow('invalid crawl strategy');
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
it('should reject when response is not valid JSON', async () => {
|
|
321
|
-
const promise = client.determineCrawlUrls(
|
|
322
|
-
'https://example.com',
|
|
323
|
-
'<html>test</html>',
|
|
324
|
-
'Find all'
|
|
325
|
-
);
|
|
326
|
-
|
|
327
|
-
setTimeout(() => {
|
|
328
|
-
mockProcess.stdout.emit('data', Buffer.from('Not valid JSON'));
|
|
329
|
-
mockProcess.emit('close', 0);
|
|
330
|
-
}, 10);
|
|
331
|
-
|
|
332
|
-
await expect(promise).rejects.toThrow();
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
it('should reject when response is null', async () => {
|
|
336
|
-
const promise = client.determineCrawlUrls(
|
|
337
|
-
'https://example.com',
|
|
338
|
-
'<html>test</html>',
|
|
339
|
-
'Find all'
|
|
340
|
-
);
|
|
341
|
-
|
|
342
|
-
setTimeout(() => {
|
|
343
|
-
mockProcess.stdout.emit('data', Buffer.from('null'));
|
|
344
|
-
mockProcess.emit('close', 0);
|
|
345
|
-
}, 10);
|
|
346
|
-
|
|
347
|
-
await expect(promise).rejects.toThrow('invalid crawl strategy');
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
it('should truncate HTML longer than 50000 characters', async () => {
|
|
351
|
-
const longHtml = '<html>' + 'a'.repeat(60000) + '</html>';
|
|
352
|
-
const promise = client.determineCrawlUrls('https://example.com', longHtml, 'Find all');
|
|
353
|
-
|
|
354
|
-
setTimeout(() => {
|
|
355
|
-
mockProcess.stdout.emit(
|
|
356
|
-
'data',
|
|
357
|
-
Buffer.from(
|
|
358
|
-
JSON.stringify({
|
|
359
|
-
urls: ['https://example.com/page1'],
|
|
360
|
-
reasoning: 'Test',
|
|
361
|
-
})
|
|
362
|
-
)
|
|
363
|
-
);
|
|
364
|
-
mockProcess.emit('close', 0);
|
|
365
|
-
}, 10);
|
|
366
|
-
|
|
367
|
-
await promise;
|
|
368
|
-
|
|
369
|
-
const writtenPrompt = vi.mocked(mockProcess.stdin.write).mock.calls[0]?.[0] as string;
|
|
370
|
-
expect(writtenPrompt).toContain('[... HTML truncated ...]');
|
|
371
|
-
expect(writtenPrompt.length).toBeLessThan(longHtml.length);
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
it('should not truncate HTML shorter than 50000 characters', async () => {
|
|
375
|
-
const shortHtml = '<html><body>Short content</body></html>';
|
|
376
|
-
const promise = client.determineCrawlUrls('https://example.com', shortHtml, 'Find all');
|
|
377
|
-
|
|
378
|
-
setTimeout(() => {
|
|
379
|
-
mockProcess.stdout.emit(
|
|
380
|
-
'data',
|
|
381
|
-
Buffer.from(
|
|
382
|
-
JSON.stringify({
|
|
383
|
-
urls: ['https://example.com/page1'],
|
|
384
|
-
reasoning: 'Test',
|
|
385
|
-
})
|
|
386
|
-
)
|
|
387
|
-
);
|
|
388
|
-
mockProcess.emit('close', 0);
|
|
389
|
-
}, 10);
|
|
390
|
-
|
|
391
|
-
await promise;
|
|
392
|
-
|
|
393
|
-
const writtenPrompt = vi.mocked(mockProcess.stdin.write).mock.calls[0]?.[0] as string;
|
|
394
|
-
expect(writtenPrompt).toContain(shortHtml);
|
|
395
|
-
expect(writtenPrompt).not.toContain('[... HTML truncated ...]');
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
it('should include seedUrl in prompt for relative URL resolution', async () => {
|
|
399
|
-
const promise = client.determineCrawlUrls(
|
|
400
|
-
'https://code.claude.com/docs',
|
|
401
|
-
'<html><a href="/docs/en/hooks">Hooks</a></html>',
|
|
402
|
-
'Find all docs'
|
|
403
|
-
);
|
|
404
|
-
|
|
405
|
-
setTimeout(() => {
|
|
406
|
-
mockProcess.stdout.emit(
|
|
407
|
-
'data',
|
|
408
|
-
Buffer.from(
|
|
409
|
-
JSON.stringify({
|
|
410
|
-
urls: ['https://code.claude.com/docs/en/hooks'],
|
|
411
|
-
reasoning: 'Found hooks documentation',
|
|
412
|
-
})
|
|
413
|
-
)
|
|
414
|
-
);
|
|
415
|
-
mockProcess.emit('close', 0);
|
|
416
|
-
}, 10);
|
|
417
|
-
|
|
418
|
-
await promise;
|
|
419
|
-
|
|
420
|
-
const writtenPrompt = vi.mocked(mockProcess.stdin.write).mock.calls[0]?.[0] as string;
|
|
421
|
-
expect(writtenPrompt).toContain('Base URL: https://code.claude.com/docs');
|
|
422
|
-
expect(writtenPrompt).toContain('resolve them against the Base URL');
|
|
423
|
-
});
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
describe('extractContent', () => {
|
|
427
|
-
it('should successfully extract content', async () => {
|
|
428
|
-
const promise = client.extractContent(
|
|
429
|
-
'# Documentation\n\nPricing: $10/month',
|
|
430
|
-
'Extract pricing info'
|
|
431
|
-
);
|
|
432
|
-
|
|
433
|
-
setTimeout(() => {
|
|
434
|
-
mockProcess.stdout.emit('data', Buffer.from('The pricing is $10/month\n'));
|
|
435
|
-
mockProcess.emit('close', 0);
|
|
436
|
-
}, 10);
|
|
437
|
-
|
|
438
|
-
const result = await promise;
|
|
439
|
-
expect(result).toBe('The pricing is $10/month');
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
it('should call spawn without JSON schema for extraction', async () => {
|
|
443
|
-
const promise = client.extractContent('# Test', 'Extract summary');
|
|
444
|
-
|
|
445
|
-
setTimeout(() => {
|
|
446
|
-
mockProcess.stdout.emit('data', Buffer.from('Summary text'));
|
|
447
|
-
mockProcess.emit('close', 0);
|
|
448
|
-
}, 10);
|
|
449
|
-
|
|
450
|
-
await promise;
|
|
451
|
-
|
|
452
|
-
expect(spawn).toHaveBeenCalledWith(
|
|
453
|
-
'claude',
|
|
454
|
-
['-p'],
|
|
455
|
-
expect.objectContaining({
|
|
456
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
457
|
-
})
|
|
458
|
-
);
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
it('should trim whitespace from extracted content', async () => {
|
|
462
|
-
const promise = client.extractContent('# Test', 'Extract');
|
|
463
|
-
|
|
464
|
-
setTimeout(() => {
|
|
465
|
-
mockProcess.stdout.emit('data', Buffer.from(' \n Extracted content \n '));
|
|
466
|
-
mockProcess.emit('close', 0);
|
|
467
|
-
}, 10);
|
|
468
|
-
|
|
469
|
-
const result = await promise;
|
|
470
|
-
expect(result).toBe('Extracted content');
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
it('should truncate markdown longer than 100000 characters', async () => {
|
|
474
|
-
const longMarkdown = '# Title\n' + 'Content '.repeat(20000);
|
|
475
|
-
const promise = client.extractContent(longMarkdown, 'Extract');
|
|
476
|
-
|
|
477
|
-
setTimeout(() => {
|
|
478
|
-
mockProcess.stdout.emit('data', Buffer.from('Result'));
|
|
479
|
-
mockProcess.emit('close', 0);
|
|
480
|
-
}, 10);
|
|
481
|
-
|
|
482
|
-
await promise;
|
|
483
|
-
|
|
484
|
-
const writtenPrompt = vi.mocked(mockProcess.stdin.write).mock.calls[0]?.[0] as string;
|
|
485
|
-
expect(writtenPrompt).toContain('[... content truncated ...]');
|
|
486
|
-
expect(writtenPrompt.length).toBeLessThan(longMarkdown.length);
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
it('should not truncate markdown shorter than 100000 characters', async () => {
|
|
490
|
-
const shortMarkdown = '# Title\n\nShort content';
|
|
491
|
-
const promise = client.extractContent(shortMarkdown, 'Extract');
|
|
492
|
-
|
|
493
|
-
setTimeout(() => {
|
|
494
|
-
mockProcess.stdout.emit('data', Buffer.from('Result'));
|
|
495
|
-
mockProcess.emit('close', 0);
|
|
496
|
-
}, 10);
|
|
497
|
-
|
|
498
|
-
await promise;
|
|
499
|
-
|
|
500
|
-
const writtenPrompt = vi.mocked(mockProcess.stdin.write).mock.calls[0]?.[0] as string;
|
|
501
|
-
expect(writtenPrompt).toContain(shortMarkdown);
|
|
502
|
-
expect(writtenPrompt).not.toContain('[... content truncated ...]');
|
|
503
|
-
});
|
|
504
|
-
});
|
|
505
|
-
|
|
506
|
-
describe('Subprocess Management', () => {
|
|
507
|
-
it('should handle process spawn errors', async () => {
|
|
508
|
-
const promise = client.determineCrawlUrls(
|
|
509
|
-
'https://example.com',
|
|
510
|
-
'<html>test</html>',
|
|
511
|
-
'Find all'
|
|
512
|
-
);
|
|
513
|
-
|
|
514
|
-
setTimeout(() => {
|
|
515
|
-
mockProcess.emit('error', new Error('spawn ENOENT'));
|
|
516
|
-
}, 10);
|
|
517
|
-
|
|
518
|
-
await expect(promise).rejects.toThrow('Failed to spawn Claude CLI');
|
|
519
|
-
});
|
|
520
|
-
|
|
521
|
-
it('should collect stdout data across multiple chunks', async () => {
|
|
522
|
-
const promise = client.extractContent('# Test', 'Extract');
|
|
523
|
-
|
|
524
|
-
setTimeout(() => {
|
|
525
|
-
mockProcess.stdout.emit('data', Buffer.from('First '));
|
|
526
|
-
mockProcess.stdout.emit('data', Buffer.from('chunk '));
|
|
527
|
-
mockProcess.stdout.emit('data', Buffer.from('of data'));
|
|
528
|
-
mockProcess.emit('close', 0);
|
|
529
|
-
}, 10);
|
|
530
|
-
|
|
531
|
-
const result = await promise;
|
|
532
|
-
expect(result).toBe('First chunk of data');
|
|
533
|
-
});
|
|
534
|
-
|
|
535
|
-
it('should collect stderr data', async () => {
|
|
536
|
-
const promise = client.determineCrawlUrls(
|
|
537
|
-
'https://example.com',
|
|
538
|
-
'<html>test</html>',
|
|
539
|
-
'Find all'
|
|
540
|
-
);
|
|
541
|
-
|
|
542
|
-
setTimeout(() => {
|
|
543
|
-
mockProcess.stderr.emit('data', Buffer.from('Error message 1\n'));
|
|
544
|
-
mockProcess.stderr.emit('data', Buffer.from('Error message 2\n'));
|
|
545
|
-
mockProcess.emit('close', 1);
|
|
546
|
-
}, 10);
|
|
547
|
-
|
|
548
|
-
await expect(promise).rejects.toThrow('Error message 1');
|
|
549
|
-
});
|
|
550
|
-
|
|
551
|
-
it('should handle process close with exit code 0', async () => {
|
|
552
|
-
const promise = client.extractContent('# Test', 'Extract');
|
|
553
|
-
|
|
554
|
-
setTimeout(() => {
|
|
555
|
-
mockProcess.stdout.emit('data', Buffer.from('Success'));
|
|
556
|
-
mockProcess.emit('close', 0);
|
|
557
|
-
}, 10);
|
|
558
|
-
|
|
559
|
-
await expect(promise).resolves.toBe('Success');
|
|
560
|
-
});
|
|
561
|
-
|
|
562
|
-
it('should reject on non-zero exit code', async () => {
|
|
563
|
-
const promise = client.extractContent('# Test', 'Extract');
|
|
564
|
-
|
|
565
|
-
setTimeout(() => {
|
|
566
|
-
mockProcess.emit('close', 1);
|
|
567
|
-
}, 10);
|
|
568
|
-
|
|
569
|
-
await expect(promise).rejects.toThrow('exited with code 1');
|
|
570
|
-
});
|
|
571
|
-
|
|
572
|
-
it('should include stderr in error message on non-zero exit', async () => {
|
|
573
|
-
const promise = client.extractContent('# Test', 'Extract');
|
|
574
|
-
|
|
575
|
-
setTimeout(() => {
|
|
576
|
-
mockProcess.stderr.emit('data', Buffer.from('Authentication failed'));
|
|
577
|
-
mockProcess.emit('close', 1);
|
|
578
|
-
}, 10);
|
|
579
|
-
|
|
580
|
-
await expect(promise).rejects.toThrow('Authentication failed');
|
|
581
|
-
});
|
|
582
|
-
|
|
583
|
-
it('should handle null exit code', async () => {
|
|
584
|
-
const promise = client.extractContent('# Test', 'Extract');
|
|
585
|
-
|
|
586
|
-
setTimeout(() => {
|
|
587
|
-
mockProcess.emit('close', null);
|
|
588
|
-
}, 10);
|
|
589
|
-
|
|
590
|
-
await expect(promise).rejects.toThrow('exited with code null');
|
|
591
|
-
});
|
|
592
|
-
});
|
|
593
|
-
|
|
594
|
-
describe('Timeout Handling', () => {
|
|
595
|
-
it('should timeout after configured timeout period', async () => {
|
|
596
|
-
const promise = client.determineCrawlUrls(
|
|
597
|
-
'https://example.com',
|
|
598
|
-
'<html>test</html>',
|
|
599
|
-
'Find all'
|
|
600
|
-
);
|
|
601
|
-
|
|
602
|
-
// Don't emit close event - let it timeout
|
|
603
|
-
await expect(promise).rejects.toThrow('timed out after 100ms');
|
|
604
|
-
});
|
|
605
|
-
|
|
606
|
-
it('should kill process on timeout', async () => {
|
|
607
|
-
const promise = client.determineCrawlUrls(
|
|
608
|
-
'https://example.com',
|
|
609
|
-
'<html>test</html>',
|
|
610
|
-
'Find all'
|
|
611
|
-
);
|
|
612
|
-
|
|
613
|
-
await expect(promise).rejects.toThrow('timed out');
|
|
614
|
-
expect(mockProcess.kill).toHaveBeenCalledWith('SIGTERM');
|
|
615
|
-
});
|
|
616
|
-
|
|
617
|
-
it('should clear timeout on successful completion', async () => {
|
|
618
|
-
const promise = client.extractContent('# Test', 'Extract');
|
|
619
|
-
|
|
620
|
-
setTimeout(() => {
|
|
621
|
-
mockProcess.stdout.emit('data', Buffer.from('Result'));
|
|
622
|
-
mockProcess.emit('close', 0);
|
|
623
|
-
}, 10);
|
|
624
|
-
|
|
625
|
-
await promise;
|
|
626
|
-
|
|
627
|
-
// If timeout wasn't cleared, it would have killed the process
|
|
628
|
-
// This test passing means timeout was cleared
|
|
629
|
-
expect(mockProcess.kill).not.toHaveBeenCalled();
|
|
630
|
-
});
|
|
631
|
-
|
|
632
|
-
it('should clear timeout on error', async () => {
|
|
633
|
-
const promise = client.extractContent('# Test', 'Extract');
|
|
634
|
-
|
|
635
|
-
setTimeout(() => {
|
|
636
|
-
mockProcess.emit('error', new Error('Spawn error'));
|
|
637
|
-
}, 10);
|
|
638
|
-
|
|
639
|
-
await expect(promise).rejects.toThrow();
|
|
640
|
-
expect(mockProcess.kill).not.toHaveBeenCalled();
|
|
641
|
-
});
|
|
642
|
-
|
|
643
|
-
it('should use default timeout of 30000ms when not specified', async () => {
|
|
644
|
-
const defaultClient = new ClaudeClient();
|
|
645
|
-
vi.mocked(spawn).mockReturnValue(mockProcess as unknown as ChildProcess);
|
|
646
|
-
|
|
647
|
-
const promise = defaultClient.extractContent('# Test', 'Extract');
|
|
648
|
-
|
|
649
|
-
// Should not timeout quickly
|
|
650
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
651
|
-
|
|
652
|
-
// Complete before default timeout
|
|
653
|
-
mockProcess.stdout.emit('data', Buffer.from('Result'));
|
|
654
|
-
mockProcess.emit('close', 0);
|
|
655
|
-
|
|
656
|
-
await expect(promise).resolves.toBe('Result');
|
|
657
|
-
});
|
|
658
|
-
|
|
659
|
-
it('should allow timeout of 0 to disable timeout', async () => {
|
|
660
|
-
const noTimeoutClient = new ClaudeClient({ timeout: 0 });
|
|
661
|
-
vi.mocked(spawn).mockReturnValue(mockProcess as unknown as ChildProcess);
|
|
662
|
-
|
|
663
|
-
const promise = noTimeoutClient.extractContent('# Test', 'Extract');
|
|
664
|
-
|
|
665
|
-
// Wait longer than normal timeout would be
|
|
666
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
667
|
-
|
|
668
|
-
// Should still be waiting (no timeout)
|
|
669
|
-
mockProcess.stdout.emit('data', Buffer.from('Result'));
|
|
670
|
-
mockProcess.emit('close', 0);
|
|
671
|
-
|
|
672
|
-
await expect(promise).resolves.toBe('Result');
|
|
673
|
-
});
|
|
674
|
-
});
|
|
675
|
-
|
|
676
|
-
describe('JSON Parsing', () => {
|
|
677
|
-
it('should handle malformed JSON in response', async () => {
|
|
678
|
-
const promise = client.determineCrawlUrls(
|
|
679
|
-
'https://example.com',
|
|
680
|
-
'<html>test</html>',
|
|
681
|
-
'Find all'
|
|
682
|
-
);
|
|
683
|
-
|
|
684
|
-
setTimeout(() => {
|
|
685
|
-
mockProcess.stdout.emit('data', Buffer.from('{ invalid json }'));
|
|
686
|
-
mockProcess.emit('close', 0);
|
|
687
|
-
}, 10);
|
|
688
|
-
|
|
689
|
-
await expect(promise).rejects.toThrow();
|
|
690
|
-
});
|
|
691
|
-
|
|
692
|
-
it('should handle incomplete JSON in response', async () => {
|
|
693
|
-
const promise = client.determineCrawlUrls(
|
|
694
|
-
'https://example.com',
|
|
695
|
-
'<html>test</html>',
|
|
696
|
-
'Find all'
|
|
697
|
-
);
|
|
698
|
-
|
|
699
|
-
setTimeout(() => {
|
|
700
|
-
mockProcess.stdout.emit('data', Buffer.from('{"urls": ["https://example.com"'));
|
|
701
|
-
mockProcess.emit('close', 0);
|
|
702
|
-
}, 10);
|
|
703
|
-
|
|
704
|
-
await expect(promise).rejects.toThrow();
|
|
705
|
-
});
|
|
706
|
-
|
|
707
|
-
it('should handle JSON with extra whitespace', async () => {
|
|
708
|
-
const promise = client.determineCrawlUrls(
|
|
709
|
-
'https://example.com',
|
|
710
|
-
'<html>test</html>',
|
|
711
|
-
'Find all'
|
|
712
|
-
);
|
|
713
|
-
|
|
714
|
-
setTimeout(() => {
|
|
715
|
-
mockProcess.stdout.emit(
|
|
716
|
-
'data',
|
|
717
|
-
Buffer.from(`
|
|
718
|
-
{
|
|
719
|
-
"urls": ["https://example.com/page1"],
|
|
720
|
-
"reasoning": "Found page"
|
|
721
|
-
}
|
|
722
|
-
`)
|
|
723
|
-
);
|
|
724
|
-
mockProcess.emit('close', 0);
|
|
725
|
-
}, 10);
|
|
726
|
-
|
|
727
|
-
const result = await promise;
|
|
728
|
-
expect(result.urls).toEqual(['https://example.com/page1']);
|
|
729
|
-
});
|
|
730
|
-
|
|
731
|
-
it('should handle JSON arrays as invalid for determineCrawlUrls', async () => {
|
|
732
|
-
const promise = client.determineCrawlUrls(
|
|
733
|
-
'https://example.com',
|
|
734
|
-
'<html>test</html>',
|
|
735
|
-
'Find all'
|
|
736
|
-
);
|
|
737
|
-
|
|
738
|
-
setTimeout(() => {
|
|
739
|
-
mockProcess.stdout.emit('data', Buffer.from('[]'));
|
|
740
|
-
mockProcess.emit('close', 0);
|
|
741
|
-
}, 10);
|
|
742
|
-
|
|
743
|
-
await expect(promise).rejects.toThrow('invalid crawl strategy');
|
|
744
|
-
});
|
|
745
|
-
|
|
746
|
-
it('should handle JSON primitives as invalid for determineCrawlUrls', async () => {
|
|
747
|
-
const promise = client.determineCrawlUrls(
|
|
748
|
-
'https://example.com',
|
|
749
|
-
'<html>test</html>',
|
|
750
|
-
'Find all'
|
|
751
|
-
);
|
|
752
|
-
|
|
753
|
-
setTimeout(() => {
|
|
754
|
-
mockProcess.stdout.emit('data', Buffer.from('"string response"'));
|
|
755
|
-
mockProcess.emit('close', 0);
|
|
756
|
-
}, 10);
|
|
757
|
-
|
|
758
|
-
await expect(promise).rejects.toThrow('invalid crawl strategy');
|
|
759
|
-
});
|
|
760
|
-
});
|
|
761
|
-
|
|
762
|
-
describe('Response Validation', () => {
|
|
763
|
-
it('should validate urls is an array', async () => {
|
|
764
|
-
const promise = client.determineCrawlUrls(
|
|
765
|
-
'https://example.com',
|
|
766
|
-
'<html>test</html>',
|
|
767
|
-
'Find all'
|
|
768
|
-
);
|
|
769
|
-
|
|
770
|
-
setTimeout(() => {
|
|
771
|
-
mockProcess.stdout.emit(
|
|
772
|
-
'data',
|
|
773
|
-
Buffer.from(
|
|
774
|
-
JSON.stringify({
|
|
775
|
-
urls: 'not an array',
|
|
776
|
-
reasoning: 'Test',
|
|
777
|
-
})
|
|
778
|
-
)
|
|
779
|
-
);
|
|
780
|
-
mockProcess.emit('close', 0);
|
|
781
|
-
}, 10);
|
|
782
|
-
|
|
783
|
-
await expect(promise).rejects.toThrow('invalid crawl strategy');
|
|
784
|
-
});
|
|
785
|
-
|
|
786
|
-
it('should validate reasoning is a string', async () => {
|
|
787
|
-
const promise = client.determineCrawlUrls(
|
|
788
|
-
'https://example.com',
|
|
789
|
-
'<html>test</html>',
|
|
790
|
-
'Find all'
|
|
791
|
-
);
|
|
792
|
-
|
|
793
|
-
setTimeout(() => {
|
|
794
|
-
mockProcess.stdout.emit(
|
|
795
|
-
'data',
|
|
796
|
-
Buffer.from(
|
|
797
|
-
JSON.stringify({
|
|
798
|
-
urls: ['https://example.com/page1'],
|
|
799
|
-
reasoning: 123,
|
|
800
|
-
})
|
|
801
|
-
)
|
|
802
|
-
);
|
|
803
|
-
mockProcess.emit('close', 0);
|
|
804
|
-
}, 10);
|
|
805
|
-
|
|
806
|
-
await expect(promise).rejects.toThrow('invalid crawl strategy');
|
|
807
|
-
});
|
|
808
|
-
|
|
809
|
-
it('should accept valid response with multiple URLs', async () => {
|
|
810
|
-
const promise = client.determineCrawlUrls(
|
|
811
|
-
'https://example.com',
|
|
812
|
-
'<html>test</html>',
|
|
813
|
-
'Find all'
|
|
814
|
-
);
|
|
815
|
-
|
|
816
|
-
setTimeout(() => {
|
|
817
|
-
mockProcess.stdout.emit(
|
|
818
|
-
'data',
|
|
819
|
-
Buffer.from(
|
|
820
|
-
JSON.stringify({
|
|
821
|
-
urls: [
|
|
822
|
-
'https://example.com/page1',
|
|
823
|
-
'https://example.com/page2',
|
|
824
|
-
'https://example.com/page3',
|
|
825
|
-
],
|
|
826
|
-
reasoning: 'Found 3 documentation pages',
|
|
827
|
-
})
|
|
828
|
-
)
|
|
829
|
-
);
|
|
830
|
-
mockProcess.emit('close', 0);
|
|
831
|
-
}, 10);
|
|
832
|
-
|
|
833
|
-
const result = await promise;
|
|
834
|
-
expect(result.urls).toHaveLength(3);
|
|
835
|
-
expect(result.reasoning).toBe('Found 3 documentation pages');
|
|
836
|
-
});
|
|
837
|
-
});
|
|
838
|
-
|
|
839
|
-
describe('Error Messages', () => {
|
|
840
|
-
it('should wrap errors with context for determineCrawlUrls', async () => {
|
|
841
|
-
const promise = client.determineCrawlUrls(
|
|
842
|
-
'https://example.com',
|
|
843
|
-
'<html>test</html>',
|
|
844
|
-
'Find all'
|
|
845
|
-
);
|
|
846
|
-
|
|
847
|
-
setTimeout(() => {
|
|
848
|
-
mockProcess.emit('close', 1);
|
|
849
|
-
}, 10);
|
|
850
|
-
|
|
851
|
-
await expect(promise).rejects.toThrow('Failed to determine crawl strategy');
|
|
852
|
-
});
|
|
853
|
-
|
|
854
|
-
it('should wrap errors with context for extractContent', async () => {
|
|
855
|
-
const promise = client.extractContent('# Test', 'Extract');
|
|
856
|
-
|
|
857
|
-
setTimeout(() => {
|
|
858
|
-
mockProcess.emit('close', 1);
|
|
859
|
-
}, 10);
|
|
860
|
-
|
|
861
|
-
await expect(promise).rejects.toThrow('Failed to extract content');
|
|
862
|
-
});
|
|
863
|
-
|
|
864
|
-
it('should preserve original error message in wrapped error', async () => {
|
|
865
|
-
const promise = client.extractContent('# Test', 'Extract');
|
|
866
|
-
|
|
867
|
-
setTimeout(() => {
|
|
868
|
-
mockProcess.emit('error', new Error('ENOENT: no such file'));
|
|
869
|
-
}, 10);
|
|
870
|
-
|
|
871
|
-
await expect(promise).rejects.toThrow('ENOENT: no such file');
|
|
872
|
-
});
|
|
873
|
-
});
|
|
874
|
-
|
|
875
|
-
describe('Concurrent Requests', () => {
|
|
876
|
-
it('should handle multiple concurrent requests', async () => {
|
|
877
|
-
const mockProcess1 = new MockChildProcess();
|
|
878
|
-
const mockProcess2 = new MockChildProcess();
|
|
879
|
-
|
|
880
|
-
vi.mocked(spawn)
|
|
881
|
-
.mockReturnValueOnce(mockProcess1 as unknown as ChildProcess)
|
|
882
|
-
.mockReturnValueOnce(mockProcess2 as unknown as ChildProcess);
|
|
883
|
-
|
|
884
|
-
const promise1 = client.extractContent('# Test 1', 'Extract 1');
|
|
885
|
-
const promise2 = client.extractContent('# Test 2', 'Extract 2');
|
|
886
|
-
|
|
887
|
-
setTimeout(() => {
|
|
888
|
-
mockProcess1.stdout.emit('data', Buffer.from('Result 1'));
|
|
889
|
-
mockProcess1.emit('close', 0);
|
|
890
|
-
}, 10);
|
|
891
|
-
|
|
892
|
-
setTimeout(() => {
|
|
893
|
-
mockProcess2.stdout.emit('data', Buffer.from('Result 2'));
|
|
894
|
-
mockProcess2.emit('close', 0);
|
|
895
|
-
}, 20);
|
|
896
|
-
|
|
897
|
-
const [result1, result2] = await Promise.all([promise1, promise2]);
|
|
898
|
-
expect(result1).toBe('Result 1');
|
|
899
|
-
expect(result2).toBe('Result 2');
|
|
900
|
-
});
|
|
901
|
-
});
|
|
902
|
-
});
|