testdriverai 7.3.22 → 7.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/interfaces/vitest-plugin.mjs +33 -27
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -49,12 +49,41 @@ function initializeSentry() {
|
|
|
49
49
|
runner: "vitest",
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
|
-
//
|
|
52
|
+
// Filter out events that should not be reported to Sentry
|
|
53
53
|
beforeSend(event, hint) {
|
|
54
54
|
const error = hint.originalException;
|
|
55
|
+
|
|
56
|
+
// Don't send user-cancelled errors
|
|
55
57
|
if (error && error.message && error.message.includes("User cancelled")) {
|
|
56
58
|
return null;
|
|
57
59
|
}
|
|
60
|
+
|
|
61
|
+
// Don't send test failures - these are expected behavior, not bugs in the SDK
|
|
62
|
+
// Test failures indicate the test found a problem, which is the intended use case
|
|
63
|
+
if (event.exception?.values) {
|
|
64
|
+
for (const exception of event.exception.values) {
|
|
65
|
+
// Filter out TestFailure type (from Vitest test failures)
|
|
66
|
+
if (exception.type === "TestFailure") {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Filter out common user code errors (ReferenceError, TypeError from user tests)
|
|
71
|
+
// Only report if the error originates from TestDriver SDK code, not user test code
|
|
72
|
+
const isUserCodeError = exception.stacktrace?.frames?.some(frame => {
|
|
73
|
+
const filename = frame.filename || frame.abs_path || "";
|
|
74
|
+
// Check if error is from user test files (not from SDK internals)
|
|
75
|
+
return filename.includes("/tests/") ||
|
|
76
|
+
filename.includes("/test/") ||
|
|
77
|
+
filename.includes(".test.") ||
|
|
78
|
+
filename.includes(".spec.");
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
if (isUserCodeError && (exception.type === "ReferenceError" || exception.type === "TypeError")) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
58
87
|
return event;
|
|
59
88
|
},
|
|
60
89
|
});
|
|
@@ -67,22 +96,6 @@ function initializeSentry() {
|
|
|
67
96
|
}
|
|
68
97
|
}
|
|
69
98
|
|
|
70
|
-
/**
|
|
71
|
-
* Previously captured test failures in Sentry.
|
|
72
|
-
* Now disabled - test failures are expected behavior, not crashes.
|
|
73
|
-
* We only want to report actual exceptions and crashes to Sentry.
|
|
74
|
-
*
|
|
75
|
-
* @param {Object} _params - Test failure parameters (ignored)
|
|
76
|
-
* @deprecated This function no longer sends data to Sentry.
|
|
77
|
-
*/
|
|
78
|
-
// eslint-disable-next-line no-unused-vars
|
|
79
|
-
function captureTestFailure(_params) {
|
|
80
|
-
// Test failures are expected behavior - they indicate a test found a bug.
|
|
81
|
-
// We should only report actual exceptions and crashes to Sentry, not every failed test.
|
|
82
|
-
// This function is now a no-op to prevent flooding Sentry with test failures.
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
99
|
/**
|
|
87
100
|
* Flush Sentry events before process exit
|
|
88
101
|
* @param {number} [timeout=2000] - Timeout in ms
|
|
@@ -1122,16 +1135,9 @@ class TestDriverReporter {
|
|
|
1122
1135
|
errorMessage = error.message;
|
|
1123
1136
|
errorStack = error.stack;
|
|
1124
1137
|
|
|
1125
|
-
//
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
testFile,
|
|
1129
|
-
errorMessage,
|
|
1130
|
-
errorStack,
|
|
1131
|
-
sessionId,
|
|
1132
|
-
platform: platform || pluginState.detectedPlatform,
|
|
1133
|
-
duration,
|
|
1134
|
-
});
|
|
1138
|
+
// Note: We do NOT report test failures to Sentry.
|
|
1139
|
+
// Test failures are expected behavior (they indicate a test found a bug).
|
|
1140
|
+
// We only want actual SDK crashes and exceptions reported to Sentry.
|
|
1135
1141
|
}
|
|
1136
1142
|
|
|
1137
1143
|
const suiteName = test.suite?.name;
|