istanbul-middleware
istanbul-middleware copied to clipboard
Display coverage results by Git commit / id
One big enhancement to this project, would be to allow to HTTP POST coverage objects to the server by ID. The most common ID I think to use would be a Git commit ID.
So the results could be retrieved via:
GET /coverage/<id>
This would allow developers to have a running server that was solely responsible for displaying test coverage results, and we could see the coverage results for each different commit.
Otherwise..we might have to spin up a new server for each commit, and that's just not very seamless.
AFAICT this would be a huge win for this project.
So when POSTing results, it would be something like:
let obj = await driver.executeScript('return window.__coverage__;');
let str = JSON.stringify(obj);
let options = {
port: port,
host: host,
path: `/coverage/client?id=${id}`,
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
};
let req = http.request(options, cb);
To make minimal changes to code base, we could pass the id as a query string parameter.