Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI issues #1044

Merged
merged 2 commits into from
Sep 14, 2022
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
30 changes: 29 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 30 additions & 20 deletions test/browser.rollbar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1495,17 +1495,21 @@ describe('options.autoInstrument', function() {
if(xhr.readyState === 4) {
try {
setTimeout(function() {
server.respond();
try {
server.respond();

expect(server.requests.length).to.eql(2);
var body = JSON.parse(server.requests[1].requestBody);
expect(server.requests.length).to.eql(2);
var body = JSON.parse(server.requests[1].requestBody);

expect(body.data.body.trace.exception.message).to.eql('HTTP request failed with Status 404');
expect(body.data.body.trace.exception.message).to.eql('HTTP request failed with Status 404');

// Just knowing a stack is present is enough for this test.
expect(body.data.body.trace.frames.length).to.be.above(1);
// Just knowing a stack is present is enough for this test.
expect(body.data.body.trace.frames.length).to.be.above(1);

done();
done();
} catch (e) {
done(e);
}
}, 1);
} catch (e) {
done(e);
Expand Down Expand Up @@ -1703,24 +1707,30 @@ describe('options.autoInstrument', function() {
.then(function(response) {
try {
rollbar.log('test'); // generate a payload to inspect
server.respond();
setTimeout(function() {
try {
server.respond();

expect(server.requests.length).to.eql(1);
var body = JSON.parse(server.requests[0].requestBody);
expect(server.requests.length).to.eql(1);
var body = JSON.parse(server.requests[0].requestBody);

// Verify request headers capture and case-insensitive scrubbing
expect(body.data.body.telemetry[0].body.request_headers).to.eql({'content-type': 'application/json', secret: '********'});
// Verify request headers capture and case-insensitive scrubbing
expect(body.data.body.telemetry[0].body.request_headers).to.eql({'content-type': 'application/json', secret: '********'});

// Verify response headers capture and case-insensitive scrubbing
expect(body.data.body.telemetry[0].body.response.headers).to.eql({'content-type': 'application/json', password: '********'});
// Verify response headers capture and case-insensitive scrubbing
expect(body.data.body.telemetry[0].body.response.headers).to.eql({'content-type': 'application/json', password: '********'});

// Assert that the original stream reader hasn't been read.
expect(response.bodyUsed).to.eql(false);
// Assert that the original stream reader hasn't been read.
expect(response.bodyUsed).to.eql(false);

rollbar.configure({ autoInstrument: false });
window.fetch.restore();
window.Headers = originalHeaders;
done();
rollbar.configure({ autoInstrument: false });
window.fetch.restore();
window.Headers = originalHeaders;
done();
} catch (e) {
done(e);
}
});
} catch (e) {
done(e);
}
Expand Down