Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ jobs:
env:
NO_ELM_TOOLING_INSTALL: 1

- name: install glob 8
if: steps.cache-node_modules.outputs.cache-hit != 'true' && (matrix.node-version == '12.x' || matrix.node-version == '14.x')
run: npm install glob@8

- name: install mocha 9
if: steps.cache-node_modules.outputs.cache-hit != 'true' && (matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x')
run: npm install mocha@9
Expand Down
32 changes: 15 additions & 17 deletions lib/FindTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const gracefulFs = require('graceful-fs');
const fs = require('fs');
const glob = require('glob');
const { globSync } = require('tinyglobby');
const path = require('path');
const Parser = require('./Parser');
const Project = require('./Project');
Expand Down Expand Up @@ -74,29 +74,27 @@ function resolveCliArgGlob(
? globRelativeToProjectRoot.replace(/\\/g, '/')
: globRelativeToProjectRoot;

return glob
.sync(pattern, {
cwd: projectRootDir,
nocase: true,
absolute: true,
ignore: ignoredDirsGlobs,
// Match directories as well and mark them with a trailing slash.
nodir: false,
mark: true,
})
.flatMap((filePath) =>
filePath.endsWith('/') ? findAllElmFilesInDir(filePath) : filePath
);
return globSync(pattern, {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note to self: there a big comment above about glob@8 and Windows and backslashes. Try it out on Windows to see how it behaves in tinyglobby, and remove or update the code/comment?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It’s needed: 7814ff7 (#647)

Updated the comment: 46ca4aa (#647)

cwd: projectRootDir,
caseSensitiveMatch: false,
absolute: true,
ignore: ignoredDirsGlobs,
// Match directories as well
onlyFiles: false,
}).flatMap((filePath) =>
// Directories have their path end with `/`
filePath.endsWith('/') ? findAllElmFilesInDir(filePath) : filePath
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note to self: Does it end with a slash on Windows? We don’t seem to have test coverage for this condition being true.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Added test case: 36cdb47 (#647)

Btw, that test was failing on master – see #648. But it passed when installing glob 8 instead of 10. Another breakage by glob 🙈

);
}

// Recursively search for *.elm files.
function findAllElmFilesInDir(dir /*: string */) /*: Array<string> */ {
return glob.sync('**/*.elm', {
return globSync('**/*.elm', {
cwd: dir,
nocase: true,
caseSensitiveMatch: false,
absolute: true,
ignore: ignoredDirsGlobs,
nodir: true,
onlyFiles: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

onlyFiles: true is the default, but I've kept it for explicitness.

});
}

Expand Down
Loading