Skip to content

Commit

Permalink
🏗 Add support for gulp serve --coverage coverage collection endpoint (
Browse files Browse the repository at this point in the history
ampproject#30099)

* add istanbul-middleware dependency

* Add coverage collection endpoint to gulp serve

* Switch middleware to devDependency
  • Loading branch information
rcebulko authored and ed-bird committed Dec 10, 2020
1 parent 26e8b96 commit f82f557
Show file tree
Hide file tree
Showing 4 changed files with 247 additions and 12 deletions.
3 changes: 3 additions & 0 deletions build-system/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ app.use('/amp4test', require('./amp4test').app);
app.use('/analytics', require('./routes/analytics'));
app.use('/list/', require('./routes/list'));
app.use('/test', require('./routes/test'));
if (argv.coverage) {
app.use('/coverage', require('istanbul-middleware').createHandler());
}

// Append ?csp=1 to the URL to turn on the CSP header.
// TODO: shall we turn on CSP all the time?
Expand Down
1 change: 1 addition & 0 deletions build-system/tasks/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,5 @@ serve.flags = {
esm: ' Serve ESM JS (requires the use of --new_server)',
cdn: ' Serve current prod JS',
rtv: ' Serve JS from the RTV provided',
coverage: ' Serve instrumented code to collect coverage info',
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"gulp-watch": "5.0.1",
"gzip-size": "5.1.1",
"html-minifier": "4.0.0",
"istanbul-middleware": "0.2.2",
"jest-dot-reporter": "1.0.12",
"jest-silent-reporter": "0.2.1",
"jison": "0.4.18",
Expand Down

0 comments on commit f82f557

Please sign in to comment.