Skip to content

Commit

Permalink
add option to serve multiple root dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoffer Åström committed Oct 30, 2017
1 parent dab320d commit dac19f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/cdp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ const cdp = {
app.use(instrument(relativeFiles, nyc));
}
app.use(serve(process.cwd()));
app.listen(argv.httpPort);
app.use(...argv.http.root.map(root => serve(path.resolve(process.cwd(), root))));
app.listen(argv.http.port);
}
const runner = new Runner(argv, nyc);
runner.on('exit', (code) => {
Expand Down
11 changes: 8 additions & 3 deletions src/cdp/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ module.exports = {
default: ['--headless', '--disable-gpu', '--allow-file-access-from-files'],
type: 'array',
},
httpPort: {
'http.port': {
description: 'Listen on this http port',
default: 9676,
type: 'number',
},
'http.root': {
description: 'Root folders to serve',
default: ['./'],
type: 'array',
},
coverage: {
description: 'Generate coverage?',
default: false,
Expand All @@ -41,7 +46,7 @@ module.exports = {
},
'nyc.exclude': {
description: 'Exclude glob',
default: ['**/coverage/**', '**/*.(html|css)', '**/*.spec.(js|ts)'],
default: ['**/coverage/**', '**/external/**', '**/autogenerated/**', '**/*.(html|css|json|txt|ttf|woff|svg)', '**/*.spec.(js|ts)'],
type: 'array',
},
'nyc.sourceMap': {
Expand All @@ -61,7 +66,7 @@ module.exports = {
},
'nyc.reporter': {
description: 'Coverage reporter(s) to use',
default: ['text', 'lcov', 'text-summary'],
default: ['lcov', 'text-summary'],
type: 'array',
},
'nyc.reporterDir': {
Expand Down

0 comments on commit dac19f4

Please sign in to comment.