This commit is contained in:
Eran Toledano 2020-08-14 11:28:27 -07:00
Родитель 2bae03bdd1
Коммит 912c2c7047
3 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -1,6 +1,6 @@
import fs from "fs";
import { runCheckOverChangedFiles } from "./utils/changedFilesValidator";
import { ExitCode } from "./utils/exitCode";
import fs from "fs";
import * as logger from "./utils/logger";
export async function IsValidJsonFile(filePath: string): Promise<ExitCode> {

Просмотреть файл

@ -1,7 +1,8 @@
import chai, { expect } from "chai";
import chaiAsPromised from "chai-as-promised";
import { IsValidJsonFile } from "../../jsonFileValidator";
import { ExitCode } from "../../utils/exitCode";
import chai from "chai";
import { expect } from "chai";
import chaiAsPromised from "chai-as-promised";
chai.use(chaiAsPromised);
@ -15,6 +16,8 @@ describe("jsonFileValidator", () => {
it("should throw exception when json file is invalid", async () => {
let filePath = ".script/tests/jsonFileValidatorTest/invalidFile.json";
await expect(IsValidJsonFile(filePath)).eventually.rejectedWith(Error).and.have.property("name", "SyntaxError");
await expect(IsValidJsonFile(filePath))
.eventually.rejectedWith(Error)
.and.have.property("name", "SyntaxError");
});
});

Просмотреть файл

@ -36,7 +36,7 @@ async function changedFilesValidator(checkOptions: CheckOptions, fileKinds: stri
}
export function runCheckOverChangedFiles(options: CheckOptions, fileKinds: string[], fileTypeSuffixes?: string[], filePathFolderPrefixes?: string[]) {
changedFilesValidator(options, fileKinds, fileTypeSuffixes, filePathFolderPrefixes).catch((e) => {
changedFilesValidator(options, fileKinds, fileTypeSuffixes, filePathFolderPrefixes).catch(e => {
console.error(e);
logger.logError(`Error. If issue persists - please open an issue`);
process.exit(ExitCode.ERROR);