Skip to content

Commit

Permalink
tests: add schema tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evenstensberg committed Sep 5, 2019
1 parent 4275fd5 commit 70bf934
Show file tree
Hide file tree
Showing 8 changed files with 4,555 additions and 36,437 deletions.
8,817 changes: 763 additions & 8,054 deletions packages/generate-loader/package-lock.json

Large diffs are not rendered by default.

8,817 changes: 763 additions & 8,054 deletions packages/generate-plugin/package-lock.json

Large diffs are not rendered by default.

8,130 changes: 2,221 additions & 5,909 deletions packages/generators/package-lock.json

Large diffs are not rendered by default.

6,885 changes: 79 additions & 6,806 deletions packages/init/package-lock.json

Large diffs are not rendered by default.

1,696 changes: 516 additions & 1,180 deletions packages/migrate/package-lock.json

Large diffs are not rendered by default.

6,627 changes: 193 additions & 6,434 deletions packages/serve/package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions test/binCases/errors/v5-schema-validation/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
entry: "hey"
};
17 changes: 17 additions & 0 deletions test/binCases/errors/v5-schema-validation/validation.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use strict";

const validation = require("../../../../bin/utils/validate-options");
const { run } = require("../../../testUtils");

test("validation", () => {
const mockExit = jest.spyOn(process, "exit").mockImplementation(() => {});
validation(null);
expect(mockExit).toHaveBeenCalledWith(-1);
mockExit.mockRestore();
});

test("validation-success", () => {
const { stdout, code } = run(__dirname, ["--config", "./options.js"]);
expect(stdout).toContain("Can't resolve 'hey'");
expect(code).toBe(2);
});

0 comments on commit 70bf934

Please sign in to comment.