Skip to content

Commit

Permalink
Allow us to run only one test
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Jun 16, 2017
1 parent e37ba78 commit e88bea2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/valid-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ validator.addMetaSchema(metaSchema, "http://json-schema.org/draft-04/schema#");

const basePath: string = "test/valid-data";

function assertSchema(name: string, type: string): void {
it(name, () => {
type Run = (
expectation: string,
callback?: ((this: Mocha.ITestCallbackContext, done: MochaDone) => any) | undefined,
) => Mocha.ITest;

function assertSchema(name: string, type: string, only: boolean = false): void {
const run: Run = only ? it.only : it;
run(name, () => {
const config: Config = {
path: resolve(`${basePath}/${name}/*.ts`),
type: type,
Expand Down Expand Up @@ -95,6 +101,7 @@ describe("valid-data", () => {
assertSchema("type-typeof", "MyType");
assertSchema("type-indexed-access", "MyType");
assertSchema("type-keyof", "MyType");
assertSchema("type-mapped", "MyObject");

assertSchema("generic-simple", "MyObject");
assertSchema("generic-arrays", "MyObject");
Expand Down

0 comments on commit e88bea2

Please sign in to comment.