Skip to content

Commit b8e8a4c

Browse files
authored
chore(testing): Add options object to be able to pass in other glob options (#264)
1 parent 8934a2c commit b8e8a4c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/testing/src/utils/getExports.example.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Signature:
22

3-
- `getExports({ globPath: string, cwd: string, fileMapper: function })`
3+
- `getExports({ globPath: string, cwd: string, options: object, fileMapper: function })`
44

55
```jsx static
66
import { getExports } from '@zendeskgarden/react-testing';
77
import * as rootIndex from './';
88

99
describe('Index', () => {
1010
it('exports all components and utilities', async () => {
11-
const exports = await getExports({ cwd: __dirname });
11+
const exports = await getExports({ cwd: __dirname, options: { ignore: 'a/**' } });
1212

1313
expect(Object.keys(rootIndex).sort()).toEqual(exports);
1414
});

packages/testing/src/utils/getExports.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ function defaultFileMapper(files) {
2929
function getExports({
3030
globPath = '**/!(index|*.spec).js',
3131
cwd,
32+
options = {},
3233
fileMapper = defaultFileMapper
3334
} = {}) {
3435
return new Promise((resolve, reject) => {
35-
glob(globPath, { cwd }, (error, files) => {
36+
glob(globPath, { ...options, cwd }, (error, files) => {
3637
if (error) {
3738
reject(error);
3839
}

0 commit comments

Comments
 (0)