Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 committed May 29, 2019
1 parent 69c5a68 commit 8295ebd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions bin/gest.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const flags = args.parse(process.argv, {
})

const getQueryString = q =>
checkPath(path.join(process.cwd(), q))
checkPath(path.resolve(process.cwd(), q))
.then(readFile)
.catch(() => q)

Expand All @@ -49,7 +49,7 @@ try {
const options = Object.assign({ schema: 'schema.js' }, getPackageInfo(), flagsToOptions(flags))

try {
schema = require(path.join(process.cwd(), options.schema))
schema = require(path.resolve(process.cwd(), options.schema))
} catch (e) {
// schema is required unless sending over HTTP
if (!options.baseURL) throw e
Expand Down
4 changes: 2 additions & 2 deletions src/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ let packageInfo

try {
// do to GraphQL schema issue [see](https://github.com/graphql/graphiql/issues/58)
GraphQL = require(path.join(process.cwd(), './node_modules/graphql'))
GraphQL = require(path.resolve(process.cwd(), './node_modules/graphql'))
} catch (e) {
// fallback if graphql is not installed locally
GraphQL = require('graphql')
}

try {
packageInfo = require(path.join(process.cwd(), 'package.json')).gest
packageInfo = require(path.resolve(process.cwd(), 'package.json')).gest
} catch (e) {
// pass
}
Expand Down
2 changes: 1 addition & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ or with \`schema.js\` in the current working directory.
}

const checkFileName = (name, regex, file) => {
const newFile = path.join(name, file)
const newFile = path.resolve(name, file)
if (file === 'node_modules' || file === '.git') return
return new Promise((resolve, reject) => {
fs.stat(newFile, (err, stats) => {
Expand Down
6 changes: 4 additions & 2 deletions test/_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ module.exports = new GraphQLSchema({
phone: { type: GraphQLInt },
isValid: { type: GraphQLBoolean }
},
resolve: (root, args) => `success${Object.assign(args).length ? ` with args: ${JSON.stringify(args)}` : ''}!`
resolve: (root, args) =>
`success${Object.assign(args).length ? ` with args: ${JSON.stringify(args)}` : ''}!`
},
setLogLevel: {
type: GraphQLFloat,
args: {
input: { type: new GraphQLNonNull(GraphQLBoolean) }
},
resolve: (root, args) => `success${Object.assign(args).length ? ` with args: ${JSON.stringify(args)}` : ''}!`
resolve: (root, args) =>
`success${Object.assign(args).length ? ` with args: ${JSON.stringify(args)}` : ''}!`
}
}
})
Expand Down
13 changes: 4 additions & 9 deletions test/bin.test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
const path = require('path')
const execa = require('execa')

function run (command) {
return execa.stdout('node', [path.join(__dirname, '..', 'bin', 'gest'), command])
function run(command) {
return execa.stdout('node', [path.resolve(__dirname, '..', 'bin', 'gest'), command])
}

const TEST_CASES = [
'--inspect',
'-I',
'{ test }',
'{ _test }'
]
const TEST_CASES = ['--inspect', '-I', '{ test }', '{ _test }']

TEST_CASES.forEach((flag) => {
TEST_CASES.forEach(flag => {
test(`gest ${flag}`, async () => {
expect(await run(flag)).toMatchSnapshot()
})
Expand Down
7 changes: 5 additions & 2 deletions test/gest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ const util = require('../src/util')
Gest(schema) // sets Global `gest`

describe('GLOBAL', () => {
gest('test global gest', `
gest(
'test global gest',
`
{
test
}
`)
`
)
})

describe('LOCAL', () => {
Expand Down

0 comments on commit 8295ebd

Please sign in to comment.