1.1.55 • Published 10 months ago

@amazeelabs/graphql-schema-test v1.1.55

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

GraphQL Schema Test

The package takes a set of .gql files, runs them against each endpoint defined in .graphqlconfig and creates snapshots containing the responses. Jest used as a test runner.

Usage

Add the package to a project:

pnpm add -D @amazeelabs/graphql-schema-test jest

Create a Jest test file:

const {
  listFiles,
  createExecutor,
} = require('@amazeelabs/graphql-schema-test');

execute = createExecutor('path/to/.graphqlconfig/file', myOptionalSerializer);
test.each(listFiles('path/to/queries/dir'))('%s', async (_, path) => {
  await execute(path);
});

function myOptionalSerializer(responses) {
  // serialize data in responses
}

Run tests:

pnpm jest --testMatch '<rootDir>/path/to/my/test/file.js'

For an example, see apps/silverback-drupal/generated/__tests__.

PhpStorm

If you are a PhpStorm user and have the GraphQL plugin installed, you are very lucky :) Because you can easily test your queries against any endpoint:

Run queries in PhpStorm

Usage in CI

For a Drupal based example, see test:integration script in apps/silverback-drupal/package.json.

1.1.55

10 months ago

1.1.54

10 months ago

1.1.53

12 months ago

1.1.52

12 months ago

1.1.51

1 year ago

1.1.50

1 year ago

1.1.49

1 year ago

1.1.48

1 year ago

1.1.47

1 year ago

1.1.46

1 year ago

1.1.45

2 years ago

1.1.44

2 years ago

1.1.43

2 years ago

1.1.34

2 years ago

1.1.33

2 years ago

1.1.38

2 years ago

1.1.37

2 years ago

1.1.36

2 years ago

1.1.35

2 years ago

1.1.39

2 years ago

1.1.41

2 years ago

1.1.40

2 years ago

1.1.42

2 years ago

1.1.29

2 years ago

1.1.28

2 years ago

1.1.30

2 years ago

1.1.32

2 years ago

1.1.31

2 years ago

1.1.27

2 years ago

1.1.26

2 years ago

1.1.25

2 years ago

1.1.23

2 years ago

1.1.24

2 years ago

1.1.22

2 years ago

1.1.21

2 years ago

1.1.19

2 years ago

1.1.18

2 years ago

1.1.20

2 years ago

1.1.16

3 years ago

1.1.15

3 years ago

1.1.14

3 years ago

1.1.17

2 years ago

1.1.13

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago