Skip to content

Commit fa1f8f8

Browse files
committed
Fix cli test
1 parent 41ffbab commit fa1f8f8

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

bunfig.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ linkWorkspacePackages = true
77
[test]
88
# Exclude test repositories, integration tests, and Playwright e2e tests from test execution by default
99
exclude = ["evals/test-repos/**", "**/*.integration.test.*", "web/src/__tests__/e2e/**"]
10-
preload = ["./sdk/test/setup-env.ts", "./test/setup-bigquery-mocks.ts", "./web/test/setup-globals.ts"]
10+
preload = ["./test/setup-scm-loader.ts", "./sdk/test/setup-env.ts", "./test/setup-bigquery-mocks.ts", "./web/test/setup-globals.ts"]

cli/src/hooks/helpers/__tests__/send-message.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,8 +1635,12 @@ describe('freebuff gate errors', () => {
16351635
// the structured gate responses).
16361636
const messages = baseMessage()
16371637
const updater = makeUpdater(messages)
1638+
const err = Object.assign(new Error('oops'), {
1639+
error: 'session_superseded',
1640+
statusCode: 500,
1641+
})
16381642
handleRunError({
1639-
error: { error: 'session_superseded', statusCode: 500, message: 'oops' },
1643+
error: err,
16401644
timerController: createMockTimerController(),
16411645
updater,
16421646
setIsRetrying: () => {},

cli/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"esModuleInterop": true,
1313
"skipLibCheck": true,
1414
"preserveSymlinks": false,
15+
"baseUrl": ".",
1516
"paths": {
1617
"@codebuff/sdk": ["../sdk/src/index.ts"]
1718
}

test/setup-scm-loader.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { plugin } from 'bun'
2+
import { readFile } from 'fs/promises'
3+
4+
plugin({
5+
name: 'scm-text-loader',
6+
setup(build) {
7+
build.onLoad({ filter: /\.scm$/ }, async (args) => {
8+
const text = await readFile(args.path, 'utf8')
9+
return {
10+
exports: { default: text },
11+
loader: 'object',
12+
}
13+
})
14+
},
15+
})

0 commit comments

Comments
 (0)