Skip to content

Commit c3680f0

Browse files
committed
test(ai-evals): add Mocha + Chai + Sinon test suite for runExperiment
Adds a unit test suite matching sibling action conventions: - 8 tests covering all RunResult status branches (NOT_FOUND, CREATE_FAILED, FAILED, PASS, REGRESSION) and exit codes (0/1/2/3) - Stubs the SDK at its method boundary so tests are deterministic, fast, and isolated from network/auth concerns - Asserts CI metadata pass-through to experimentRuns.create as the 5th arg - Asserts lifecycle progress messages Tooling: - mocha + chai + sinon + nyc (matches setup-env / setup-local / browserstack-report-action) - ts-node loader so Mocha can read .ts source directly - @typescript-eslint v8 (supports TypeScript 5.9) - husky pre-commit hook: runs test + build + stages dist/ so src and dist cannot drift in a published commit 'npm test' chains tsc --noEmit -> eslint -> nyc mocha with HTML coverage report (coverage/index.html, gitignored).
1 parent c5cab01 commit c3680f0

5 files changed

Lines changed: 4873 additions & 164 deletions

File tree

ai-evals/.eslintrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended"
8+
],
9+
"env": {
10+
"node": true,
11+
"es2022": true,
12+
"mocha": true
13+
},
14+
"rules": {
15+
"@typescript-eslint/no-explicit-any": "off",
16+
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
17+
},
18+
"ignorePatterns": ["dist/", "node_modules/", "coverage/"]
19+
}

ai-evals/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules/
22
*.log
3+
.nyc_output/
4+
coverage/

0 commit comments

Comments
 (0)