According to line 310, `resultsPath` can be undefined, so change this to:
```
    if (resultsPath && resultsPath.substr(-5) === ".json") {
```