Skip to content

Commit

Permalink
Only import ./test when needed (palantir#3079)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajafff authored and adidahiya committed Aug 10, 2017
1 parent 90dd3f4 commit 3ae9eee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
import { FatalError } from "./error";
import { LintResult } from "./index";
import * as Linter from "./linter";
import { consoleTestResultsHandler, runTests } from "./test";
import { arrayify, flatMap } from "./utils";

export interface Options {
Expand Down Expand Up @@ -141,8 +140,9 @@ async function runWorker(options: Options, logger: Logger): Promise<Status> {
}

if (options.test) {
const results = runTests((options.files || []).map(trimSingleQuotes), options.rulesDirectory);
return consoleTestResultsHandler(results) ? Status.Ok : Status.FatalError;
const test = await import("./test");
const results = test.runTests((options.files || []).map(trimSingleQuotes), options.rulesDirectory);
return test.consoleTestResultsHandler(results) ? Status.Ok : Status.FatalError;
}

if (options.config && !fs.existsSync(options.config)) {
Expand Down

0 comments on commit 3ae9eee

Please sign in to comment.