Skip to content

Commit 2d1a110

Browse files
committed
browser: Ported all integration tests from raven-js
1 parent 65d0d41 commit 2d1a110

File tree

2 files changed

+254
-414
lines changed

2 files changed

+254
-414
lines changed

packages/browser/test/integration/frame.html

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@
8787
</script>
8888
<script src="../../build/bundle.js"></script>
8989
<script>
90-
// stub _makeRequest so we don't actually transmit any data
91-
Raven._makeRequest = function () { };
92-
9390
// store references to original, unwrapped built-ins in order to:
9491
// - get a clean, unwrapped setTimeout (so stack traces don't include
9592
// frames from mocha)
@@ -108,12 +105,34 @@
108105
consoleLog: console.log
109106
};
110107

111-
window.ravenData = [];
112-
Raven.config('https://[email protected]/1', {
113-
dataCallback: function (data) {
114-
ravenData.push(data);
108+
// expose events so we can access them in our tests
109+
window.sentryData = [];
110+
111+
// stub transport so we don't actually transmit any data
112+
function DummyTransport() { }
113+
DummyTransport.prototype.send = function (event) {
114+
// console.log(JSON.stringify(event, null, 2));
115+
sentryData.push(event);
116+
return true;
117+
}
118+
119+
Sentry.init({
120+
dsn: 'https://[email protected]/1',
121+
transport: DummyTransport,
122+
shouldAddBreadcrumb: function (breadcrumb) {
123+
// Filter internal Karma requests
124+
if (
125+
breadcrumb.type === 'http' &&
126+
(
127+
breadcrumb.data.url.indexOf('test.js') !== -1 ||
128+
breadcrumb.data.url.indexOf('frame.html') !== -1
129+
)
130+
) {
131+
return false;
132+
}
133+
return true;
115134
}
116-
}).install();
135+
})
117136

118137
function bar() {
119138
baz();

0 commit comments

Comments
 (0)