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

Incorrect result for directories with dot entries #46

Open
mrmlnc opened this issue May 25, 2019 · 2 comments
Open

Incorrect result for directories with dot entries #46

mrmlnc opened this issue May 25, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@mrmlnc
Copy link
Contributor

mrmlnc commented May 25, 2019

Versions

  • Windows 10 (18362)
  • Node.js 12.0.0

Problem

The tiny-glob package returns results without prefer the dot option.

Reproduce steps

directory/
  - .git
  - .editorconfig
  - .gitignore
  - package.json
const tg = require('tiny-glob');

(async () => {
	const entries = await tg('*');

	console.dir(entries, { colors: true });
})();

Actual behaviour

⚠️ The .editorconfig file excluded as expected, but not .git and .gitignore. The dot option with true as value returns .editorconfig as expected.

[
	'.git',
	'.gitignore',
	'package.json'
]

Expected behaviour

[
	'package.json'
]
@mrmlnc
Copy link
Contributor Author

mrmlnc commented May 25, 2019

I don't know why, but if I delete /g for isHidden RegExp, all works correctly. Also related to Node.js 8, 10 and chakracore-nightly/12.0.0-nightly20190516e1c4cc010d/x64.

Wow!

https://stackoverflow.com/questions/11477415/why-does-javascripts-regex-exec-not-always-return-the-same-value

@terkelg
Copy link
Owner

terkelg commented May 31, 2019

Thank you @mrmlnc! I guess we can remove /g from the RegExp

@terkelg terkelg added the bug Something isn't working label May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants