Skip to content

Commit

Permalink
Fix CI issues (#1044)
Browse files Browse the repository at this point in the history
* test: update node dependencies to fix test failures

* test: update tests for async send
  • Loading branch information
waltjones authored Sep 14, 2022
1 parent 87484fb commit bf56f33
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 21 deletions.
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

0 comments on commit bf56f33

Please sign in to comment.