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 dist/index.js

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions src/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const makeDetailRecord = (detail) => {
browser,
taxonomy
} = detail;
const { file, line, column } = location;
const { file, line, column } = location ?? {};
Comment thread
cenesdeveloper marked this conversation as resolved.
const { timeout } = configuration ?? config ?? {};
const { codeowners } = github ?? {};
const { type, tool } = taxonomy ?? {};
Expand All @@ -175,10 +175,13 @@ const makeDetailRecord = (detail) => {
{ Name: 'status', Value: status, Type: VARCHAR }
];
const dimensions = [
{ Name: 'name', Value: name },
{ Name: 'location_file', Value: file }
{ Name: 'name', Value: name }
];

if (file) {
dimensions.push({ Name: 'location_file', Value: file });
}

if (timeout) {
// kept for backwards compat. Once all dashboards are updated will be removed
dimensions.push({ Name: 'timeout', Value: timeout.toString() });
Expand Down
20 changes: 20 additions & 0 deletions test/report.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,26 @@ describe('report', () => {
});
}

describe('location omitted from detail', () => {
it('does not send location_file dimension', async() => {
const testReportNoLocation = {
...testReportV3Full,
details: [{ ...testReportV3Full.details[0], location: undefined }]
};

stsClientMock.on(AssumeRoleCommand).resolves(testAwsStsCredentials);
timestreamWriteClientMock.on(WriteRecordsCommand).resolves();
sandbox.stub(fs, 'readFileSync').returns(JSON.stringify(testReportNoLocation));

await submit(logger, testContext, testInputsFull, new Report('dummy-report-path'));

const [{ Dimensions }] = timestreamWriteClientMock.calls()
.find(call => call.args[0].input.TableName === 'details').args[0].input.Records;

expect(Dimensions.some(d => d.Name === 'location_file')).to.be.false;
});
});

describe('backwards compatible experience dimension', () => {
const getDetailDimensions = () => {
const calls = timestreamWriteClientMock.calls();
Expand Down