Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add support for custom trace categories #1866

Merged
merged 3 commits into from
Mar 22, 2017
Merged

Conversation

patrickhulce
Copy link
Collaborator

fixes #1663

@patrickhulce patrickhulce changed the title feat(trace-categories): add support for custom trace categories feat(cli): add support for custom trace categories Mar 16, 2017
*/
beginTrace(flags) {
const additionalCategories = flags && flags.traceCategories && flags.traceCategories.split(',');
const traceCategories = new Set(this._traceCategories.concat(additionalCategories || []));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i kinda prefer moving this || [] to the above statement, so we can rely on it as an array.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's just drop in const _uniq = arr => Array.from(new Set(arr)); and use it so we're not tossing this type from Set back to array a few lines later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -78,6 +79,7 @@ const cliFlags = yargs
'save-artifacts': 'Save all gathered artifacts to disk',
'list-all-audits': 'Prints a list of all available audits and exits',
'list-trace-categories': 'Prints a list of all required trace categories and exits',
'trace-categories': 'Additional categories to capture with the trace (comma-delimited).',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about addl-trace-categories ? to clarify that this doesn't overwrite the defaults

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additional- but done :)

/**
* @param {{additionalTraceCategories: string=}=} flags
*/
beginTrace(flags) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could use some fancy default params: flags = {additionalTraceCategories: ''}
then: const additionalCategories = flags.additionalTraceCategories.split(',').filter(String);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, but would still need the additionalTraceCategories check so just gets rid of flags && in favor of = {additionalTraceCategories: ''} gotta save those bytes you know ;)

@paulirish paulirish merged commit 65bec1b into master Mar 22, 2017
@paulirish paulirish deleted the custom_trace branch March 22, 2017 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WPT compat: include additional trace categories
3 participants