Skip to content

Commit

Permalink
fix: Exclude example flags provided by node (#66)
Browse files Browse the repository at this point in the history
Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
  • Loading branch information
sttk and phated committed Sep 3, 2023
1 parent 00466b1 commit 58f009a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ function getFlags(cb) {

var index = result.indexOf('\nOptions:');
if (index >= 0) {
result = result.slice(index);
var regexp = /^\s\s--[\w-]+/gm;
regexp.lastIndex = index;
var matchedFlags = result.match(regexp);
if (matchedFlags) {
flags = flags.concat(
Expand Down
10 changes: 10 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ describe('v8flags', function () {
done();
});
});

it('does not detect nodejs example flags', function (done) {
eraseHome();
var v8flags = require('../');
v8flags(function (err, flags) {
expect(flags).not.toContain('--flag');
expect(flags).not.toContain('--no-flag');
done();
});
});
});

describe('config-path', function () {
Expand Down

0 comments on commit 58f009a

Please sign in to comment.