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

Add glob test case #648

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
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
11 changes: 5 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
matrix:
# macOS-13 is the latest macOS version that is x86.
# Node.js 12, 14 and 16 aren’t support on the arm64 runners.
os: [ubuntu-latest, macOS-13, windows-latest]
node-version: [12.x, 14.x, 16.x, 18.x, 20.x, 22.x]
os: [windows-latest]
node-version: [22.x]
# Also have a test on macOS arm64.
include:
- os: macOS-latest
node-version: 22.x
# include:
# - os: macOS-latest
# node-version: 22.x

env:
ELM_HOME: '${{ github.workspace }}/elm-stuff/elm-home'
Expand Down Expand Up @@ -51,7 +51,6 @@ jobs:
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
Expand Down
9 changes: 5 additions & 4 deletions lib/FindTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function resolveCliArgGlob(
// https://github.com/isaacs/minimatch/commit/9104d8d175bdd8843338103be1401f80774d2a10#diff-f41746899d033115e03bebe4fbde76acf2de4bf261bfb221744808f4c8a286cf
const pattern =
process.platform === 'win32'
? globRelativeToProjectRoot.replace(/\\/g, '/')
? globRelativeToProjectRoot //.replace(/\\/g, '/')
: globRelativeToProjectRoot;

return glob
Expand All @@ -84,9 +84,10 @@ function resolveCliArgGlob(
nodir: false,
mark: true,
})
.flatMap((filePath) =>
filePath.endsWith('/') ? findAllElmFilesInDir(filePath) : filePath
);
.flatMap((filePath) => {
console.log('### filePath', filePath);
return filePath.endsWith('/') ? findAllElmFilesInDir(filePath) : filePath;
});
}

// Recursively search for *.elm files.
Expand Down
7 changes: 7 additions & 0 deletions tests/flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,13 @@ describe('flags', () => {
]);
assert.strictEqual(runResult.status, 0);
}).timeout(60000);

it('Should find all Elm files inside the directory that a glob resolves to', () => {
// This is nice if two globs accidentally intersect.
const runResult = execElmTest(['tests/Pass*']);
console.log(runResult);
assert.strictEqual(runResult.status, 0);
}).timeout(60000);
});

describe('unknown flags', () => {
Expand Down
Loading