Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ The Session Replay feature utilizes our tracing infrastructure to:
- **Unit Tests**: Component-focused tests in `test/replay/unit/`
- **Integration Tests**: Test component interactions in `test/replay/integration/`
- **End-to-End Tests**: Full flow verification in `test/replay/integration/e2e.test.js`
- **Mock Implementation**: `test/replay/util/mockRecordFn.js` provides a deterministic mock of rrweb
- **Mock Implementation**: `test/replay/util/mockRecordFn.ts` provides a deterministic mock of rrweb
- **Fixtures**: Realistic rrweb events in `test/fixtures/replay/` for testing
- **Test Tasks**: Dedicated test configurations for replay code specifically

Expand Down
38 changes: 19 additions & 19 deletions test/browser.core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Tracing from '../src/tracing/tracing.js';

import { fakeServer } from './browser.rollbar.test-utils.ts';
import { loadHtml } from './util/fixtures.ts';
import { setTimeout } from './util/timers.js';
import { setTimeoutAsync } from './util/timers.ts';

describe('options', function () {
beforeEach(function () {
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('options.captureUncaught', function () {
expect(element).to.exist;
element.click();

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -168,7 +168,7 @@ describe('options.captureUncaught', function () {

element.click();

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();
expect(server.requests.length).to.eql(0); // Disabled, no event
Expand All @@ -180,7 +180,7 @@ describe('options.captureUncaught', function () {

element.click();

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand All @@ -197,7 +197,7 @@ describe('options.captureUncaught', function () {

element.click();

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();
expect(server.requests.length).to.eql(0); // Disabled, no event
Expand Down Expand Up @@ -231,7 +231,7 @@ describe('options.captureUncaught', function () {
Error.prepareStackTrace(e, []);
}

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -268,7 +268,7 @@ describe('options.captureUncaught', function () {
element.click(); // use for loop to ensure the stack traces have identical line/col info
}

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -309,7 +309,7 @@ describe('options.captureUncaught', function () {
element.click(); // use for loop to ensure the stack traces have identical line/col info
}

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -344,7 +344,7 @@ describe('options.captureUncaught', function () {
expect(element).to.exist;
element.click();

await setTimeout(1, null);
await setTimeoutAsync(1);
server.respond();

const body = JSON.parse(server.requests[0].requestBody);
Expand Down Expand Up @@ -379,7 +379,7 @@ describe('options.captureUncaught', function () {
expect(element).to.exist;
element.click();

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -429,7 +429,7 @@ describe('options.captureUncaught', function () {

Promise.reject(new Error('test reject'));

await setTimeout(500, null);
await setTimeoutAsync(500);

server.respond();

Expand Down Expand Up @@ -462,7 +462,7 @@ describe('options.captureUncaught', function () {

Promise.reject(new Error('test reject'));

await setTimeout(500, null);
await setTimeoutAsync(500);

server.respond();

Expand Down Expand Up @@ -496,7 +496,7 @@ describe('options.captureUncaught', function () {

Promise.reject(new Error('test reject'));

await setTimeout(500, null);
await setTimeoutAsync(500);

server.respond();

Expand Down Expand Up @@ -539,7 +539,7 @@ describe('options.captureUncaught', function () {

rollbar.log('test message', { foo: 'bar' });

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -567,7 +567,7 @@ describe('options.captureUncaught', function () {

rollbar.log(new Error('test error'), { foo: 'bar' });

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -601,7 +601,7 @@ describe('options.captureUncaught', function () {

rollbar.error(err, { foo: 'bar' });

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -649,7 +649,7 @@ describe('options.captureUncaught', function () {
custom.self = custom;
rollbar.error(err, custom);

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -691,7 +691,7 @@ describe('options.captureUncaught', function () {

rollbar.log(null);

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -720,7 +720,7 @@ describe('options.captureUncaught', function () {
rollbar.log(error);
rollbar.log(error, { skipFrames: 1 });

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down
2 changes: 1 addition & 1 deletion test/browser.replay.recorder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sinon from 'sinon';

import Recorder from '../src/browser/replay/recorder.js';

import { stubRecordFn } from './replay/util/mockRecordFn.js';
import { stubRecordFn } from './replay/util/mockRecordFn.ts';

describe('Recorder', function () {
let mockTracing;
Expand Down
4 changes: 2 additions & 2 deletions test/browser.rollbar.autoInstrument.csp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import sinon from 'sinon';

import Rollbar from '../src/browser/rollbar.js';

import { setTimeout } from './util/timers.js';
import { setTimeoutAsync } from './util/timers.ts';

describe('options.autoInstrument', function () {
describe('contentSecurityPolicy', function () {
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('options.autoInstrument', function () {

document.dispatchEvent(cspEvent);

await setTimeout(100, null);
await setTimeoutAsync(100);

expect(queueStub.called).to.be.true;
const item = queueStub.getCall(0).args[0];
Expand Down
8 changes: 4 additions & 4 deletions test/browser.rollbar.autoInstrument.fetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import sinon from 'sinon';
import Rollbar from '../src/browser/rollbar.js';

import { fakeServer } from './browser.rollbar.test-utils.ts';
import { setTimeout } from './util/timers.js';
import { setTimeoutAsync } from './util/timers.ts';

describe('options.autoInstrument', function () {
beforeEach(function () {
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('options.autoInstrument', function () {

rollbar.log('test'); // generate a payload to inspect

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -153,7 +153,7 @@ describe('options.autoInstrument', function () {
};

await window.fetch(fetchRequest, fetchInit).then(async (_response) => {
await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -224,7 +224,7 @@ describe('options.autoInstrument', function () {
await window.fetch(fetchRequest, fetchInit).then(async (response) => {
rollbar.log('test'); // generate a payload to inspect

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down
6 changes: 3 additions & 3 deletions test/browser.rollbar.autoInstrument.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect } from 'chai';
import Rollbar from '../src/browser/rollbar.js';

import { fakeServer } from './browser.rollbar.test-utils.ts';
import { setTimeout } from './util/timers.js';
import { setTimeoutAsync } from './util/timers.ts';

describe('options.autoInstrument', function () {
beforeEach(function () {
Expand Down Expand Up @@ -39,7 +39,7 @@ describe('options.autoInstrument', function () {

rollbar.log('test'); // generate a payload to inspect

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -69,7 +69,7 @@ describe('options.autoInstrument', function () {

rollbar.log('test'); // generate a payload to inspect

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down
12 changes: 6 additions & 6 deletions test/browser.rollbar.autoInstrument.xhr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect } from 'chai';
import Rollbar from '../src/browser/rollbar.js';

import { fakeServer } from './browser.rollbar.test-utils.ts';
import { setTimeout } from './util/timers.js';
import { setTimeoutAsync } from './util/timers.ts';

describe('options.autoInstrument', function () {
beforeEach(function () {
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('options.autoInstrument', function () {
if (xhr.readyState === 4) {
rollbar.log('test'); // generate a payload to inspect

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -112,7 +112,7 @@ describe('options.autoInstrument', function () {
if (xhr.readyState === 4) {
rollbar.log('test'); // generate a payload to inspect

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -161,7 +161,7 @@ describe('options.autoInstrument', function () {
if (xhr.readyState === 4) {
rollbar.log('test'); // generate a payload to inspect

await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand Down Expand Up @@ -214,7 +214,7 @@ describe('options.autoInstrument', function () {
xhr.setRequestHeader('Content-type', 'application/json');
xhr.onreadystatechange = async function () {
if (xhr.readyState === 4) {
await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();

Expand All @@ -230,7 +230,7 @@ describe('options.autoInstrument', function () {
}
};
xhr.send(JSON.stringify({ name: 'bar', secret: 'xhr post' }));
await setTimeout(1, null);
await setTimeoutAsync(1);

server.respond();
});
Expand Down
19 changes: 0 additions & 19 deletions test/browser.rollbar.test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,6 @@
*/

import 'nise';
import sinon from 'sinon';

import Rollbar from '../src/browser/core.js';

declare global {
interface Window {
nise: typeof import('nise');

fetch: sinon.SinonStub;
fetchStub: sinon.SinonStub;

rollbar: Rollbar;
server: import('nise').FakeServer;
chrome: { runtime: boolean };
_rollbarURH: ((evt: PromiseRejectionEvent) => void) & {
belongsToShim?: boolean;
};
}
}

export const { fakeServer } = window.nise;

Expand Down
Loading