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

test: fix test-cli-node-options on Windows #16709

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/parallel/test-cli-node-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if (common.hasCrypto) {
expect('--abort_on-uncaught_exception', 'B\n');
expect('--max-old-space-size=0', 'B\n');
expect('--stack-trace-limit=100',
/(\s*at f \(\[eval\]:1:\d*\)\n){100}/,
/(\s*at f \(\[eval\]:1:\d*\)\r?\n){100}/,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe worth making it a non-capturing group:

-        /(\s*at f \(\[eval\]:1:\d*\)\r?\n){100}/, 
+        /(\s*at f \(?:\[eval\]:1:\d*\)\r?\n){100}/, 

Copy link
Contributor

@vsemozhetbyt vsemozhetbyt Nov 3, 2017

Choose a reason for hiding this comment

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

Or rather

-        /(\s*at f \(\[eval\]:1:\d*\)\r?\n){100}/, 
+        /(?:\s*at f \(\[eval\]:1:\d*\)\r?\n){100}/, 

Copy link
Member Author

Choose a reason for hiding this comment

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

Since this is a test file, I’d go with clarity over performance? I know it took me a while to get the hang of what ?: means when learning regexes and seeing that in the wild…

Copy link
Member

Choose a reason for hiding this comment

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

Interesting, I find not using non-capturing groups more confusing, as for me a group is for capturing (I think using it for capturing is more common than using it to repeat with (){x}).

The reason I suggested it was because my first thought was "why does the test need to capture 100 different groups", and the fact that the regex gets passed through a custom function makes it harder to track. Performance is a secondary concern.

'(function f() { f(); })();',
true);

Expand Down