Skip to content

Malformed payload #100

@maxjacobson

Description

@maxjacobson

We've received a report of a user struggling to set up php test coverage, and with their permission, took a look at the payload being sent by the php-test-reporter. Here's a little node.js script showing some characteristics of the payload we're receiving:

var fs = require('fs');
var data = JSON.parse(fs.readFileSync("./payload.json", "utf8"));

console.log(typeof data.coverage_data.source_files);
// object

console.log(Object.keys(data.coverage_data.source_files).slice(0, 2));
//[ '/opt/atlassian/pipelines/agent/build/src/Api.php',
//  '/opt/atlassian/pipelines/agent/build/src/ApiHandler.php' ]

console.log(data.coverage_data.source_files['/opt/atlassian/pipelines/agent/build/src/Api.php']);
// { name: 'src/Api.php',
//  coverage: '[null,null,null,null,null,null,null,null,null,null,null,null]',
//  blob_id: 'f4d95e0cb279952a0569e6f734cb0a2bc22ad864' }

You can see that data.coverage_data.source_files is an object, but that's malformed -- it should be an array. We don't need the keys in that object at all, we just want the values.

I'm not sure why this is happening, or if it's affecting many users or just this one. Is it possible that a user is getting different dependency versions or using a different version of php, and that could lead to this issue?

It looks like this repo doesn't have very many tests, so I think we ought to add some that exercise the format of the payload, to help smoke out if there is a bug there.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions