Skip to content
This repository was archived by the owner on Sep 2, 2020. It is now read-only.

Commit 6e31f5e

Browse files
committed
Check type of statCache entries
Fixes #227
1 parent 93d1595 commit 6e31f5e

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

packages/server/src/GraphQLCache.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,17 @@ export class GraphQLCache implements GraphQLCacheInterface {
276276
);
277277
globResult.on('end', () => {
278278
resolve(
279-
Object.keys(globResult.statCache).map(filePath => ({
280-
filePath,
281-
mtime: Math.trunc(
282-
globResult.statCache[filePath].mtime.getTime() / 1000,
283-
),
284-
size: globResult.statCache[filePath].size,
285-
})),
279+
Object.keys(globResult.statCache)
280+
.filter(
281+
filePath => typeof globResult.statCache[filePath] === 'object',
282+
)
283+
.map(filePath => ({
284+
filePath,
285+
mtime: Math.trunc(
286+
globResult.statCache[filePath].mtime.getTime() / 1000,
287+
),
288+
size: globResult.statCache[filePath].size,
289+
})),
286290
);
287291
});
288292
});

packages/server/src/__tests__/MessageProcessor-test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {beforeEach, describe, it} from 'mocha';
1515
import {MessageProcessor} from '../MessageProcessor';
1616
import MockWatchmanClient from '../__mocks__/MockWatchmanClient';
1717
import {GraphQLConfig} from 'graphql-config';
18-
import {GraphQLCache} from '../GraphQLCache';
1918

2019
describe('MessageProcessor', () => {
2120
const mockWatchmanClient = new MockWatchmanClient();

0 commit comments

Comments
 (0)