3.1.4 • Published 1 year ago

graphql-validate-fixtures v3.1.4

Weekly downloads
57,599
License
MIT
Repository
github
Last release
1 year ago

graphql-validate-fixtures

Build Status Build Status License: MIT npm version

Validates JSON fixtures for GraphQL responses against the associated operations and schema.

Installation

yarn add graphql-validate-fixtures

Usage

In order to associate a fixture with a GraphQL query or mutation in your app, you must follow one of these conventions:

  • Your fixtures are in a directory with a name matching that of the associated GraphQL operation
  • Your fixtures have a key called @operation at the top level, which has a string value that is the name of the associated operation

Once this is done, you can validate your fixtures using the CLI or Node.js API.

Operation

On startup this tool performs the following actions:

  • Loads all schemas
  • Discovers all operations belonging to each schema
  • Discovers all fixtures and infers operation names as described above
  • Validates fixtures against the operation with a matching name
    • Reports operation not found error if no schema matches
    • Reports ambiguous operation name error if more than one schema matches

Configuration

This tool reads schema information from a .graphqlconfig file in the project root.

CLI

# Must provide a list of fixtures as the first argument
yarn run graphql-validate-fixtures 'src/**/fixtures/**/*.graphql.json'

Node

const {evaluateFixtures} = require('graphql-validate-fixtures');
evaluateFixtures({
  fixturePaths: ['test/fixtures/one.json', 'test/fixtures/two.json'],
}).then((results) => {
  // See the TypeScript definition file for more details on the
  // structure of the `results`
  results.forEach((result) => console.log(result));
});
3.1.3

1 year ago

3.1.4

1 year ago

3.1.2

2 years ago

3.0.0

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

2.1.8

2 years ago

2.1.7

2 years ago

2.1.6

2 years ago

2.1.5

2 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.0.6

3 years ago

2.1.0

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

2.0.0

3 years ago

0.14.5

3 years ago

0.14.4

3 years ago

0.14.3

3 years ago

0.14.1

3 years ago

0.14.2

3 years ago

0.14.0

3 years ago

0.13.0-beta-4

3 years ago

0.13.0-beta-2

3 years ago

0.13.0-beta-3

3 years ago

0.13.0

3 years ago

0.12.2

3 years ago

0.12.1

4 years ago

0.12.0

4 years ago

1.0.0-core-js.1

4 years ago

0.11.4

4 years ago

0.11.3

5 years ago

0.11.2

5 years ago

0.11.1

5 years ago

0.11.0

5 years ago

0.11.0-beta.1

5 years ago

0.10.2

5 years ago

0.10.1

6 years ago

0.10.0

6 years ago

0.9.1

6 years ago

0.9.0-beta.3

6 years ago

0.9.0-beta.2

6 years ago

0.9.0-beta.1

6 years ago

0.8.5

6 years ago

0.8.4

6 years ago

0.8.3

6 years ago

0.8.2

6 years ago

0.8.1

6 years ago

0.7.2

6 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago