diff --git a/AGENTS.md b/AGENTS.md index 2772a65c..98a83a8c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -90,7 +90,7 @@ sdk-typescript/ │ │ └── README.md # Notebook tool documentation │ └── README.md # Vended tools overview │ -├── tests_integ/ # Integration tests (separate from source) +├── test/integ/ # Integration tests (separate from source) │ ├── bedrock.test.ts # Bedrock integration tests (requires AWS credentials) │ ├── hooks.test.ts # Hooks integration tests │ └── registry.test.ts # ToolRegistry integration tests @@ -140,7 +140,7 @@ sdk-typescript/ - **`src/tools/`**: Tool definitions and types for agent tool use - **`src/types/`**: Core type definitions used across the SDK - **`vended_tools/`**: Optional vended tools (not part of core SDK, independently importable) -- **`tests_integ/`**: Integration tests (tests public API and external integrations) +- **`test/integ/`**: Integration tests (tests public API and external integrations) - **`.github/workflows/`**: CI/CD automation and quality gates - **`.project/`**: Task management and project tracking @@ -284,7 +284,7 @@ export async function* mainFunction() { **For integration tests**: ``` -tests_integ/ +test/integ/ └── feature.test.ts # Tests public API ``` @@ -669,10 +669,10 @@ src/subdir/ ### Integration Test Location -**Rule**: Integration tests are separate in `tests_integ/` +**Rule**: Integration tests are separate in `test/integ/` ``` -tests_integ/ +test/integ/ ├── api.test.ts # Tests public API └── environment.test.ts # Tests environment compatibility ``` @@ -680,7 +680,7 @@ tests_integ/ ### Test File Naming - Unit tests: `{sourceFileName}.test.ts` in `src/**/__tests__/**` -- Integration tests: `{feature}.test.ts` in `tests_integ/` +- Integration tests: `{feature}.test.ts` in `test/integ/` ### Test Coverage diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 23e04260..0d83dbe9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,7 +75,7 @@ npm run test:watch npm run test:integ # Run integ tests for a single file -npm run test:integ -- tests_integ/openai.test.ts +npm run test:integ -- test/integ/openai.test.ts # Run browser tests (Chromium) npm run test:browser @@ -91,7 +91,7 @@ npm run test:all:coverage - **80%+ Coverage**: All code should have at least 80% test coverage - **Unit Tests**: Test individual functions in `src/**/__tests__/**` directories -- **Integration Tests**: Test complete workflows in `tests_integ/` directory +- **Integration Tests**: Test complete workflows in `test/integ/` directory - **TSDoc Coverage**: All exported functions must have complete documentation For detailed testing patterns and examples, see [AGENTS.md - Testing Patterns](AGENTS.md#testing-patterns). diff --git a/eslint.config.js b/eslint.config.js index 8e376ae9..86658752 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -22,13 +22,13 @@ export default [ }), // Apply UT rules to the integ tests unitTestRules({ - files: ['tests_integ/**/*.ts'], - tsconfig: './tests_integ/tsconfig.json', + files: ['test/integ/**/*.ts'], + tsconfig: './test/integ/tsconfig.json', }), // Then stricter integ test rules integTestRules({ - files: ['tests_integ/**/*.ts'], - tsconfig: './tests_integ/tsconfig.json', + files: ['test/integ/**/*.ts'], + tsconfig: './test/integ/tsconfig.json', }), ] diff --git a/package.json b/package.json index 4829ac1c..1bd73211 100644 --- a/package.json +++ b/package.json @@ -55,11 +55,11 @@ "test:all": "vitest run --project unit-node --project unit-browser", "test:all:coverage": "vitest run --coverage --project unit-node --project unit-browser", "test:package": "cd test/packages/esm-module && npm install && node esm.js && cd ../cjs-module && npm install && node cjs.js", - "lint": "eslint src tests_integ", - "lint:fix": "eslint src tests_integ --fix", - "format": "prettier --write src tests_integ", - "format:check": "prettier --check src tests_integ", - "type-check": "tsc --noEmit --project src/tsconfig.json && tsc --noEmit --project tests_integ/tsconfig.json", + "lint": "eslint src test/integ", + "lint:fix": "eslint src test/integ --fix", + "format": "prettier --write src test/integ", + "format:check": "prettier --check src test/integ", + "type-check": "tsc --noEmit --project src/tsconfig.json && tsc --noEmit --project test/integ/tsconfig.json", "type-check:watch": "tsc --noEmit --watch", "prepare": "npm run build && husky" }, diff --git a/tests_integ/__fixtures__/model-test-helpers.ts b/test/integ/__fixtures__/model-test-helpers.ts similarity index 100% rename from tests_integ/__fixtures__/model-test-helpers.ts rename to test/integ/__fixtures__/model-test-helpers.ts diff --git a/tests_integ/__fixtures__/test-helpers.ts b/test/integ/__fixtures__/test-helpers.ts similarity index 94% rename from tests_integ/__fixtures__/test-helpers.ts rename to test/integ/__fixtures__/test-helpers.ts index 7311bf50..e50b01af 100644 --- a/tests_integ/__fixtures__/test-helpers.ts +++ b/test/integ/__fixtures__/test-helpers.ts @@ -3,7 +3,7 @@ import { join } from 'node:path' /** * Helper to load fixture files from Vite URL imports. - * Vite ?url imports return paths like '/tests_integ/__resources__/file.png' in test environment. + * Vite ?url imports return paths like '/test/integ/__resources__/file.png' in test environment. * * @param url - The URL from a Vite ?url import * @returns The file contents as a Uint8Array diff --git a/tests_integ/__fixtures__/test-mcp-server.ts b/test/integ/__fixtures__/test-mcp-server.ts similarity index 100% rename from tests_integ/__fixtures__/test-mcp-server.ts rename to test/integ/__fixtures__/test-mcp-server.ts diff --git a/tests_integ/__resources__/letter.pdf b/test/integ/__resources__/letter.pdf similarity index 100% rename from tests_integ/__resources__/letter.pdf rename to test/integ/__resources__/letter.pdf diff --git a/tests_integ/__resources__/yellow.png b/test/integ/__resources__/yellow.png similarity index 100% rename from tests_integ/__resources__/yellow.png rename to test/integ/__resources__/yellow.png diff --git a/tests_integ/agent.test.ts b/test/integ/agent.test.ts similarity index 100% rename from tests_integ/agent.test.ts rename to test/integ/agent.test.ts diff --git a/tests_integ/bash.test.ts b/test/integ/bash.test.ts similarity index 100% rename from tests_integ/bash.test.ts rename to test/integ/bash.test.ts diff --git a/tests_integ/bedrock.test.ts b/test/integ/bedrock.test.ts similarity index 100% rename from tests_integ/bedrock.test.ts rename to test/integ/bedrock.test.ts diff --git a/tests_integ/browser/agent.browser.test.ts b/test/integ/browser/agent.browser.test.ts similarity index 100% rename from tests_integ/browser/agent.browser.test.ts rename to test/integ/browser/agent.browser.test.ts diff --git a/tests_integ/browser/bedrock.browser.test.ts b/test/integ/browser/bedrock.browser.test.ts similarity index 100% rename from tests_integ/browser/bedrock.browser.test.ts rename to test/integ/browser/bedrock.browser.test.ts diff --git a/tests_integ/browser/environment.browser.test.ts b/test/integ/browser/environment.browser.test.ts similarity index 100% rename from tests_integ/browser/environment.browser.test.ts rename to test/integ/browser/environment.browser.test.ts diff --git a/tests_integ/browser/vitest.d.ts b/test/integ/browser/vitest.d.ts similarity index 100% rename from tests_integ/browser/vitest.d.ts rename to test/integ/browser/vitest.d.ts diff --git a/tests_integ/environment.test.ts b/test/integ/environment.test.ts similarity index 100% rename from tests_integ/environment.test.ts rename to test/integ/environment.test.ts diff --git a/tests_integ/file-editor.test.ts b/test/integ/file-editor.test.ts similarity index 100% rename from tests_integ/file-editor.test.ts rename to test/integ/file-editor.test.ts diff --git a/tests_integ/http-request.test.ts b/test/integ/http-request.test.ts similarity index 100% rename from tests_integ/http-request.test.ts rename to test/integ/http-request.test.ts diff --git a/tests_integ/integ-setup.ts b/test/integ/integ-setup.ts similarity index 100% rename from tests_integ/integ-setup.ts rename to test/integ/integ-setup.ts diff --git a/tests_integ/mcp.test.ts b/test/integ/mcp.test.ts similarity index 97% rename from tests_integ/mcp.test.ts rename to test/integ/mcp.test.ts index a02ef162..ccbef567 100644 --- a/tests_integ/mcp.test.ts +++ b/test/integ/mcp.test.ts @@ -22,7 +22,7 @@ type TransportConfig = { } describe('MCP Integration Tests', () => { - const serverPath = resolve(process.cwd(), 'tests_integ/__fixtures__/test-mcp-server.ts') + const serverPath = resolve(process.cwd(), 'test/integ/__fixtures__/test-mcp-server.ts') let httpServerInfo: HttpServerInfo | undefined beforeAll(async () => { diff --git a/tests_integ/notebook.test.ts b/test/integ/notebook.test.ts similarity index 100% rename from tests_integ/notebook.test.ts rename to test/integ/notebook.test.ts diff --git a/tests_integ/openai.test.ts b/test/integ/openai.test.ts similarity index 100% rename from tests_integ/openai.test.ts rename to test/integ/openai.test.ts diff --git a/test/integ/tsconfig.json b/test/integ/tsconfig.json new file mode 100644 index 00000000..c38af910 --- /dev/null +++ b/test/integ/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "paths": { + "$/sdk/*": ["../../src/*"] + }, + "types": ["vite/client", "vitest/importMeta", "@types/node"] + }, + "references": [{ "path": "../../src/tsconfig.json" }] +} diff --git a/tests_integ/tsconfig.json b/tests_integ/tsconfig.json deleted file mode 100644 index f086eed7..00000000 --- a/tests_integ/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "paths": { - "$/sdk/*": ["../src/*"] - }, - "types": ["vite/client", "vitest/importMeta", "@types/node"] - }, - "references": [{ "path": "../src/tsconfig.json" }] -} diff --git a/vitest.config.ts b/vitest.config.ts index c703d575..84f8195e 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -68,12 +68,12 @@ export default defineConfig({ '$/sdk': path.resolve(__dirname, './src'), '$/vended': path.resolve(__dirname, './src/vended-tools'), }, - include: ['tests_integ/**/*.test.ts'], - exclude: ['tests_integ/**/*.browser.test.ts'], + include: ['test/integ/**/*.test.ts'], + exclude: ['test/integ/**/*.browser.test.ts'], name: { label: 'integ-node', color: 'magenta' }, testTimeout: 30000, retry: 1, - globalSetup: './tests_integ/integ-setup.ts', + globalSetup: './test/integ/integ-setup.ts', sequence: { concurrent: true, }, @@ -85,7 +85,7 @@ export default defineConfig({ '$/sdk': path.resolve(__dirname, './src'), '$/vended': path.resolve(__dirname, './src/vended-tools'), }, - include: ['tests_integ/**/*.browser.test.ts'], + include: ['test/integ/**/*.browser.test.ts'], name: { label: 'integ-browser', color: 'yellow' }, testTimeout: 30000, browser: { @@ -104,7 +104,7 @@ export default defineConfig({ getOpenAIAPIKey, }, }, - globalSetup: './tests_integ/integ-setup.ts', + globalSetup: './test/integ/integ-setup.ts', sequence: { concurrent: true, }, @@ -117,6 +117,7 @@ export default defineConfig({ coverage: { provider: 'v8', reporter: ['text', 'json', 'html'], + reportsDirectory: 'test/.artifacts/coverage', include: ['src/**/*.{ts,js}', 'src/vended-tools/**/*.{ts,js}'], exclude: coverageExclude, thresholds: {