Skip to content

Commit

Permalink
globby@10.0.1 (using fast-glob) with minor updates
Browse files Browse the repository at this point in the history
sort the file paths from globby

and update some snapshots in tests_integration

`\\` pattern workaround for fast-glob on Windows

https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows

Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: Christopher J. Brody <chris@brody.consulting>
  • Loading branch information
Christopher J. Brody and fisker committed Oct 30, 2019
1 parent feb341c commit f945854
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"find-project-root": "1.1.1",
"flow-parser": "0.89.0",
"get-stream": "5.1.0",
"globby": "6.1.0",
"globby": "10.0.1",
"graphql": "14.5.8",
"html-element-attributes": "2.2.0",
"html-styles": "1.0.0",
Expand Down
9 changes: 7 additions & 2 deletions src/cli/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ function createIgnorerFromContextOrDie(context) {
}

function eachFilename(context, patterns, callback) {
// workaround for fast-glob on Windows ref:
// https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows
patterns = patterns.map(path => path.replace(/\\/g, "/"));

// The '!./' globs are due to https://github.com/prettier/prettier/issues/2110
const ignoreNodeModules = context.argv["with-node-modules"] !== true;
if (ignoreNodeModules) {
Expand All @@ -410,8 +414,9 @@ function eachFilename(context, patterns, callback) {

try {
const filePaths = globby
.sync(patterns, { dot: true, nodir: true })
.map(filePath => path.relative(process.cwd(), filePath));
.sync(patterns, { dot: true })
.map(filePath => path.relative(process.cwd(), filePath))
.sort();

if (filePaths.length === 0) {
context.logger.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ function f() {
console.log(
\\"should have no semi\\"
)
console.log(
\\"jest/__best-tests__/file.js should have semi\\"
);
console.log(
\\"jest/Component.js should not have semi\\"
)
console.log(
\\"jest/Component.test.js should have semi\\"
);
console.log(
\\"jest/__best-tests__/file.js should have semi\\"
);
function js() {
console.log(
\\"js/file.js should have tab width 8 (1 if CLI)\\"
Expand Down Expand Up @@ -134,9 +134,9 @@ function f() {
)
}
console.log(\\"should have no semi\\")
console.log(\\"jest/__best-tests__/file.js should have semi\\");
console.log(\\"jest/Component.js should not have semi\\")
console.log(\\"jest/Component.test.js should have semi\\");
console.log(\\"jest/__best-tests__/file.js should have semi\\");
function js() {
console.log(\\"js/file.js should have tab width 8 (1 if CLI)\\");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
exports[`support relative paths (stderr) 1`] = `""`;

exports[`support relative paths (stdout) 1`] = `
"shouldNotBeIgnored.js
level1-glob/level2-glob/level3-glob/shouldNotBeIgnored.scss
"level1-glob/level2-glob/level3-glob/shouldNotBeIgnored.scss
level1-glob/shouldNotBeIgnored.js
shouldNotBeIgnored.js
"
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ function f() {
console.log(
\\"should have no semi\\"
)
console.log(
\\"jest/__best-tests__/file.js should have semi\\"
);
console.log(
\\"jest/Component.js should not have semi\\"
)
console.log(
\\"jest/Component.test.js should have semi\\"
);
console.log(
\\"jest/__best-tests__/file.js should have semi\\"
);
function js() {
console.log(
\\"js/file.js should have tab width 8 (1 if CLI)\\"
Expand Down Expand Up @@ -197,15 +197,15 @@ function f() {
console.log(
\\"should have no semi\\"
)
console.log(
\\"jest/__best-tests__/file.js should have semi\\"
);
console.log(
\\"jest/Component.js should not have semi\\"
)
console.log(
\\"jest/Component.test.js should have semi\\"
);
console.log(
\\"jest/__best-tests__/file.js should have semi\\"
);
function js() {
console.log(
\\"js/file.js should have tab width 8 (1 if CLI)\\"
Expand Down

0 comments on commit f945854

Please sign in to comment.