You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AngularDart接口测试命令执行报错,如何调整命令解决连接问题?

Fixing AngularDart Test Connection Refusal Error

The error occurs because even though you configured pub serve to listen on 192.168.173.1:8180, the test runner is still trying to fetch test files from the default localhost:8180 URL—an endpoint that isn't being served. To resolve this, you need to explicitly tell the test runner to use your custom hostname and port as the base URL for test files.

Here's the modified command with the critical addition:

pub run angular_test --test-arg=--tags=aot --test-arg=--platform=dartium --test-arg=--reporter=expanded --test-arg=--url-base=http://192.168.173.1:8180/ --serve-arg=--hostname=192.168.173.1 --serve-arg=--port=8180 --verbose

Key Change Explained

  • Added --test-arg=--url-base=http://192.168.173.1:8180/: This overrides the test runner's default localhost base URL, directing it to load all test assets from your configured pub serve instance.

Quick Validation Steps

  1. Confirm pub serve is accessible: Open http://192.168.173.1:8180 in a browser—you should see the pub serve directory listing.
  2. Check network restrictions: Ensure no firewall or local network rules are blocking traffic to port 8180 on 192.168.173.1.

内容的提问来源于stack exchange,提问作者Fabrício Cunha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 04:34:41