Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Handle emptymatched files list (fixes #1863) (#1933)
Browse files Browse the repository at this point in the history
  • Loading branch information
IllusionMH authored and nchen63 committed Jan 1, 2017
1 parent 5a85a01 commit 50cb7ec
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class Runner {
// remove single quotes which break matching on Windows when glob is passed in single quotes
.map(Runner.trimSingleQuotes)
.map((file: string) => glob.sync(file, { ignore: ignorePatterns, nodir: true }))
.reduce((a: string[], b: string[]) => a.concat(b));
.reduce((a: string[], b: string[]) => a.concat(b), []);

try {
this.processFiles(onComplete, files, program);
Expand Down
11 changes: 10 additions & 1 deletion test/executable/executableTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ describe("Executable", function (this: Mocha.ISuiteCallbackContext) {
execCli(["-c", "test/config/tslint-extends-package-no-mod.json", "src/test.ts"], (err) => {
assert.isNull(err, "process should exit without an error");
done();
}); });
});
});

it("exits with code 1 if config file is invalid", (done) => {
execCli(["-c", "test/config/tslint-invalid.json", "src/test.ts"], (err, stdout, stderr) => {
Expand Down Expand Up @@ -211,6 +212,14 @@ describe("Executable", function (this: Mocha.ISuiteCallbackContext) {
done();
});
});

it("exits with code 0 if `tsconfig.json` is passed but it includes no ts files", (done) => {
execCli(["-c", "test/files/tsconfig-no-ts-files/tslint.json", "--project", "test/files/tsconfig-no-ts-files/tsconfig.json"],
(err) => {
assert.isNull(err, "process should exit without an error");
done();
});
});
});

describe("--init flag", () => {
Expand Down
Empty file.
5 changes: 5 additions & 0 deletions test/files/tsconfig-no-ts-files/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"include": [
"*"
]
}
5 changes: 5 additions & 0 deletions test/files/tsconfig-no-ts-files/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"tslint:latest"
]
}

0 comments on commit 50cb7ec

Please sign in to comment.