test(cmd): pin pipeline error to bundle resolution on web platform

This commit is contained in:
pj committed 2026-06-06 13:07:10 +05:30
1 parent f821e9a306
commit c62f30621a
1 file changed
+7 -11
+7 -11
View File
@@ -182,24 +182,20 @@ func TestParseTestArgs_IosDeviceFlag(t *testing.T) {
} }
func TestRun_TestSubcommand_PipelineErrors(t *testing.T) { func TestRun_TestSubcommand_PipelineErrors(t *testing.T) {
// Without a real spec, a real device, or a bootable AVD the pipeline // Web skips host-dependent device boot and bundles first, so a missing spec
// must surface a specific error rather than panicking — proves the flag // deterministically surfaces a bundle-resolution error. This proves the
// wiring reaches the runner. // flag wiring reaches the bundler rather than panicking on the way.
err := run([]string{ err := run([]string{
"sanderling", "test", "sanderling", "test",
"--spec", "definitely-missing-spec.ts", "--spec", "definitely-missing-spec.ts",
"--bundle-id", "com.example", "--bundle-id", "http://localhost:3000",
"--avd", "definitely-missing-avd", "--platform", "web",
}, io.Discard, io.Discard) }, io.Discard, io.Discard)
if err == nil { if err == nil {
t.Fatal("expected error, got nil") t.Fatal("expected error, got nil")
} }
message := err.Error() message := err.Error()
ok := strings.Contains(message, "bundle") || if !strings.HasPrefix(message, "bundle spec:") || !strings.Contains(message, "definitely-missing-spec.ts") {
strings.Contains(message, "device") || t.Errorf("expected bundle-resolution error for the missing spec, got %v", err)
strings.Contains(message, "AVD") ||
strings.Contains(message, "emulator")
if !ok {
t.Errorf("expected pipeline error (bundle/device/AVD/emulator), got %v", err)
} }
} }