Skip to content

Commit

Permalink
add test to verify config options
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Jan 14, 2021
1 parent e109089 commit 256b48d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions packages/cli/__tests__/config.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { globalOptions } from "@auto-it/core/dist/types";
import { camelCase } from "change-case";
import { commands } from "../src/parse-args";

test.each(commands.map((c) => [c.name, c] as const))(
"%s has correct config options",
(name, command) => {
const configOptions = globalOptions.props[name]?.props || {};

expect.assertions(command.options?.filter((o) => o.config).length ?? 0);

Object.keys(configOptions).forEach((option) => {
expect(command.options.some((o) => camelCase(o.name) === option)).toBe(
true
);
});
}
);
2 changes: 1 addition & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const logOptions = t.partial({

export type LogOptions = t.TypeOf<typeof logOptions>;

const globalOptions = t.partial({
export const globalOptions = t.partial({
/** Another auto configuration to extend */
extends: t.string,
/** Labels that power auto */
Expand Down

0 comments on commit 256b48d

Please sign in to comment.