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

fix: loadFiles path resolving issue #1542

Merged
merged 3 commits into from May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/load-files/src/index.ts
Expand Up @@ -194,10 +194,12 @@ export async function loadFiles(
): Promise<any[]> {
const execOptions = { ...LoadFilesDefaultOptions, ...options };
const relevantPaths = await scanForFiles(
asArray(pattern).map(path =>
isDirectory(path)
? buildGlob(unixify(path), execOptions.extensions, execOptions.ignoredExtensions, execOptions.recursive)
: unixify(path)
await Promise.all(
asArray(pattern).map(async path =>
(await isDirectory(path))
? buildGlob(unixify(path), execOptions.extensions, execOptions.ignoredExtensions, execOptions.recursive)
: unixify(path)
)
),
options.globOptions
);
Expand Down
10 changes: 10 additions & 0 deletions packages/load-files/tests/file-scanner.spec.ts
Expand Up @@ -140,6 +140,11 @@ describe('file scanner', function() {
note: 'should include index by default',
extensions: ['graphql'],
});
testSchemaDir({
path: './test-assets/1/*.graphql',
expected: [schemaContent],
note: 'non-directory pattern',
});
});

describe('resolvers', () => {
Expand Down Expand Up @@ -205,5 +210,10 @@ describe('file scanner', function() {
compareValue: true,
ignoreIndex: true,
});
testResolversDir({
path: './test-assets/6/*.resolvers.js',
expected: [{ MyType: { f: 1 } }],
note: 'non-directory pattern',
});
});
});