All Projects β†’ mfix22 β†’ Gest

mfix22 / Gest

Licence: mit
πŸ‘¨β€πŸ’» A sensible GraphQL testing tool - test your GraphQL schema locally and in the cloud

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Gest

Javascript Testing Best Practices
πŸ“—πŸŒ 🚒 Comprehensive and exhaustive JavaScript & Node.js testing best practices (August 2021)
Stars: ✭ 13,976 (+12722.02%)
Mutual labels:  jest, test, integration-testing
Cli Prompts Test
Write e2e tests for CLI apps with ease
Stars: ✭ 17 (-84.4%)
Mutual labels:  command-line, test, integration-testing
api-test
🌿 A simple bash script to test JSON API from terminal in a structured and organized way.
Stars: ✭ 53 (-51.38%)
Mutual labels:  test, integration-testing, testing-tools
Aruba
Test command-line applications with Cucumber-Ruby, RSpec or Minitest. The most up to date documentation can be found on Cucumber.Pro (https://app.cucumber.pro/projects/aruba)
Stars: ✭ 900 (+725.69%)
Mutual labels:  cli, command-line, test
puppeteer-screenshot-tester
Small library that allows us to compare screenshots generated by puppeteer in our tests.
Stars: ✭ 50 (-54.13%)
Mutual labels:  jest, test, testing-tools
Graphql Query Test Mock
Easily mock GraphQL queries in your Relay Modern / Apollo / any-other-GraphQL-client tests.
Stars: ✭ 49 (-55.05%)
Mutual labels:  graphql, graphql-client, jest
Cryptocurrency Cli
πŸ’° Cryptocurrency Portfolio On The Command Line πŸ’°
Stars: ✭ 99 (-9.17%)
Mutual labels:  cli, command-line
Ask Cli
Alexa Skills Kit Command Line Interface
Stars: ✭ 100 (-8.26%)
Mutual labels:  cli, command-line
Esbuild Jest
A Jest transformer using esbuild
Stars: ✭ 100 (-8.26%)
Mutual labels:  jest, test
Somafm
πŸ“» Play & record SomaFM radio channels
Stars: ✭ 103 (-5.5%)
Mutual labels:  cli, command-line
Synonym
Find synonyms in 15 different languages directly from your terminal.
Stars: ✭ 95 (-12.84%)
Mutual labels:  cli, command-line
Csv2db
The CSV to database command line loader
Stars: ✭ 102 (-6.42%)
Mutual labels:  cli, command-line
Awesome Cli
A curated list of awesome resources for building immersive CLI experiences.
Stars: ✭ 104 (-4.59%)
Mutual labels:  cli, command-line
Rundeck Cli
CLI tool for Rundeck
Stars: ✭ 98 (-10.09%)
Mutual labels:  cli, command-line
Tooling
Advancing Node.js as a framework for writing great tools
Stars: ✭ 98 (-10.09%)
Mutual labels:  cli, command-line
Gql
Very simple CLI for many GraphQL schemas in the cloud. Provides autocompletion for GraphQL queries
Stars: ✭ 101 (-7.34%)
Mutual labels:  graphql, cli
Terminal layout
The project help you to quickly build layouts in terminal,cross-platform(δΈ€δΈͺθ·¨εΉ³ε°ηš„ε‘½δ»€θ‘ŒuiεΈƒε±€ε·₯ε…·)
Stars: ✭ 98 (-10.09%)
Mutual labels:  cli, command-line
Consolemock
A tool for testing console logs
Stars: ✭ 103 (-5.5%)
Mutual labels:  jest, testing-tools
Simple Console
Add an elegant command-line interface to any page
Stars: ✭ 107 (-1.83%)
Mutual labels:  cli, command-line
Prig
Prig is a lightweight framework for test indirections in .NET Framework.
Stars: ✭ 106 (-2.75%)
Mutual labels:  test, testing-tools

Gest - A sensible GraphQL testing CLI and tool.

A sensible GraphQL testing tool.

PRs welcome tested with jest tested with gest MIT License

Usage

$ npm install -g gest

then send queries with gest (pronounced guest [/Ι‘est/]).

$ gest [options] [query | pathToFileWithQuery]
Examples
$ gest '{ test }'

or

$ gest test.graphql

# with `test.graphql` containing
{
  test
}

or multiple

$ gest test.graphql '{ test }' introspection.graphql
# will run all three queries!

REPL

If you run gest with no arguments, it will open a REPL for you to run queries in:

$ gest

Query: { test }

{
  data: {
    test: "success!"
  }
}

HTTP

If you specify a baseURL in your config, gest will send an POST request with your query correctly encoded in the body. Your baseURL must be a valid URL.

You can specify HTTP headers by using -H key=value flags.

This is especially convenient if you are using a Now workflow.

Example
$ gest -H Authorization=e130294e --baseURL https://test-server-2ae34342.now.sh '{ test }'

Local module

You can use gest as a local module in your unit/integration tests

Examples
const Gest = require('gest')
const schema = require('../src/schema')

const gest = Gest(schema, {
  baseURL: 'test-server.now.sh',
  headers: {
    Authorization: 'Bearer token',
    Accept: 'application/json'
  }
})

describe('GraphQL', () => {
  test('{ test }', () => {
    return gest('{ test }').then(({ data, errors }) => {
      expect(errors).toBeUndefined()
      expect(data).toEqual('success!')
    })
  })
})

or use Global gest with jest.

// will create global `gest()` function
Gest(schema)

// pass a test name and a query
gest(
  'test query',
  `
  {
    test
  }
`
)

Note: Global functionality will be turned on by default if NODE_ENV === test and if global.test or global.it exists

Flags

--all (-A)

Running gest --all will run all files matching *.query, *.graphql, or *.gql and simply print if each query succeeded without errors

--inspect (-I)

For convenience, running gest --inspect or gest -I will pretty print your GraphQL schema

--print (-P)

Pretty print your GraphQL queries (without using GraphiQL!)

$ gest [query | pathToQuery] --print
Example
$ gest '{test}' --print

{
  test
}
--schema (-S)

You can specify the path to your GraphQL schema with gest --schema ./path/to/schema.js

--baseURL (-B)

URL to send GraphQL queries to: gest --baseURL https://test-server.now.sh

--header (-H)

HTTP request headers to send with your queries: gest --header Accept=application/json. Headers will be passed into context as context.headers for every query for local testing.

Convention

The gest CLI will look to resolve your GraphQL schema in the current working directory for schema.js. If you wish to specify a different schema location, do so as schema in your config.

Config

You can configure the gest runtime by adding a gest key to your package.json, or specifying them as flags.

Example
// package.json
{
  "name": "your_package",
  ...
  "gest": {
    "schema": "./path/to/schema",
    "baseURL": "https://your.url.sh"
  }
}

Why gest?

Pros
  • πŸ‘ No restarting your dev server when you make changes
  • πŸ‘ Testing your schema doesn't require a separate window (e.g. Graphiql)
  • πŸ‘ Run queries from files (save the queries you use most often)
  • πŸ‘ Simple unit testing for your schema
  • πŸ‘ Easy regression testing with gest --all.
  • πŸ‘ Simple integration/deployment testing with --baseURL
  • πŸ‘ Handy introspection and pretty printing
  • πŸ‘ Helpful error messages!
Drawbacks
  • πŸ‘Ž No query autocompletion (yet)

Contributing

  1. Fork this repository to your own GitHub account and then clone it locally
  2. Install the dependencies: npm install
  3. Run npm link to link the scripts found in bin for testing terminal commands
  4. Before submitting a pull request, run npm test

Need help?

Running gest help will show you all the gest options. If you have any other concerns, post an issue!

Logo

The official gest logo is designed by @jakedex

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].