豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 5696cce

Browse files
authored
test: do not suppress uncaught errors in tests (#1008)
We want to suppress uncaught errors in production because we do not want to crash the entire server. But it might be useful in tests.
1 parent b0c6d04 commit 5696cce

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

scripts/test.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ async function runTests(attempt) {
6868
env: {
6969
...process.env,
7070
CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS: true,
71+
CHROME_DEVTOOLS_MCP_CRASH_ON_UNCAUGHT: true,
7172
},
7273
});
7374

src/main.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ if (args.usageStatistics) {
5858
});
5959
}
6060

61-
process.on('unhandledRejection', (reason, promise) => {
62-
logger('Unhandled promise rejection', promise, reason);
63-
});
61+
if (process.env['CHROME_DEVTOOLS_MCP_CRASH_ON_UNCAUGHT'] !== 'true') {
62+
process.on('unhandledRejection', (reason, promise) => {
63+
logger('Unhandled promise rejection', promise, reason);
64+
});
65+
}
6466

6567
logger(`Starting Chrome DevTools MCP Server v${VERSION}`);
6668
const server = new McpServer(

0 commit comments

Comments
 (0)