Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -284,7 +284,7 @@ export async function* mainFunction() {

**For integration tests**:
```
tests_integ/
test/integ/
└── feature.test.ts # Tests public API
```

Expand Down Expand Up @@ -669,18 +669,18 @@ 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
```

### 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

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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).
Expand Down
8 changes: 4 additions & 4 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}),
]

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests_integ/mcp.test.ts → test/integ/mcp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions test/integ/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"paths": {
"$/sdk/*": ["../../src/*"]
},
"types": ["vite/client", "vitest/importMeta", "@types/node"]
},
"references": [{ "path": "../../src/tsconfig.json" }]
}
10 changes: 0 additions & 10 deletions tests_integ/tsconfig.json

This file was deleted.

11 changes: 6 additions & 5 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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: {
Expand All @@ -104,7 +104,7 @@ export default defineConfig({
getOpenAIAPIKey,
},
},
globalSetup: './tests_integ/integ-setup.ts',
globalSetup: './test/integ/integ-setup.ts',
sequence: {
concurrent: true,
},
Expand All @@ -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: {
Expand Down