Skip to content

Commit

Permalink
Fix tests using loadConfigStep to parse flags
Browse files Browse the repository at this point in the history
loadConfigStep pulls the queries value from the flags passed to the
command, so there is no need to use a custom parsing function. Though
the name of the function requires an in-depth look at the
implementation.
  • Loading branch information
evans committed Aug 31, 2018
1 parent 5bff6e8 commit 15d1d97
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
13 changes: 1 addition & 12 deletions packages/apollo/src/commands/queries/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import { table, styledJSON } from "heroku-cli-util";
import * as Listr from "listr";
import { toPromise, execute } from "apollo-link";
import { print, GraphQLError, DocumentNode } from "graphql";
import * as fg from "glob";

import {
loadQueryDocuments,
extractOperationsAndFragments,
combineOperationsAndFragments
} from "apollo-codegen-core/lib/loading";
import { withGlobalFS } from "apollo-codegen-core/lib/localfs";

import { engineFlags } from "../../engine-cli";
import { engineLink, getIdFromKey } from "../../engine";
Expand Down Expand Up @@ -65,16 +63,7 @@ export default class CheckQueries extends Command {
title: "Scanning for GraphQL queries",
task: async (ctx, task) => {
ctx.queryDocuments = loadQueryDocuments(
typeof flags.queries === "string"
? [
withGlobalFS(() =>
fg.sync(flags.queries!, {
cwd: ctx.config.projectFolder,
absolute: true
})
)
]
: ctx.documentSets[0].documentPaths,
ctx.documentSets[0].documentPaths,
flags.tagName
);
task.title = `Scanning for GraphQL queries (${
Expand Down
13 changes: 1 addition & 12 deletions packages/apollo/src/commands/queries/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import {
printWithReducedWhitespace,
sortAST
} from "apollo-engine-reporting";
import * as fg from "glob";

import { withGlobalFS } from "apollo-codegen-core/lib/localfs";
import {
loadQueryDocuments,
extractOperationsAndFragments,
Expand Down Expand Up @@ -72,16 +70,7 @@ export default class ExtractQueries extends Command {
title: "Scanning for GraphQL queries",
task: async (ctx, task) => {
ctx.queryDocuments = loadQueryDocuments(
typeof flags.queries === "string"
? [
withGlobalFS(() =>
fg.sync(flags.queries!, {
cwd: ctx.config.projectFolder,
absolute: true
})
)
]
: ctx.documentSets[0].documentPaths,
ctx.documentSets[0].documentPaths,
flags.tagName
);
task.title = `Scanning for GraphQL queries (${
Expand Down

0 comments on commit 15d1d97

Please sign in to comment.