-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow graphql@16 as peer dependency (#305)
Co-authored-by: Pieter Van der Haegen <[email protected]>
- Loading branch information
Showing
12 changed files
with
287 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const graphlExtension = '.graphql_' + (process.env.GRAPHQL_VERSION ? process.env.GRAPHQL_VERSION : '16') | ||
const snapshotFolder = '/__snapshots__' | ||
|
||
// resolves from test to snapshot path | ||
const resolveSnapshotPath = (testPath, snapshotExtension) => { | ||
const indexOfLatestSlash = testPath.lastIndexOf('/') | ||
return ( | ||
testPath.substring(0, indexOfLatestSlash) + | ||
snapshotFolder + | ||
testPath.substring(indexOfLatestSlash) + | ||
graphlExtension + | ||
snapshotExtension | ||
) | ||
} | ||
|
||
// resolves from snapshot to test path | ||
const resolveTestPath = (snapshotFilePath, snapshotExtension) => | ||
snapshotFilePath.replace(snapshotFolder, '').slice(0, -snapshotExtension.length - graphlExtension.length) | ||
|
||
module.exports = { | ||
resolveSnapshotPath, | ||
resolveTestPath, | ||
|
||
// Example test path, used for preflight consistency check of the implementation above | ||
testPathForConsistencyCheck: 'tests/gql.test.ts', | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`accepts graphql DocumentNode as alternative to raw string 1`] = ` | ||
Object { | ||
"requests": Array [ | ||
Object { | ||
"body": Object { | ||
"query": "{ | ||
query { | ||
users | ||
} | ||
} | ||
", | ||
}, | ||
"headers": Object { | ||
"accept": "*/*", | ||
"accept-encoding": "gzip,deflate", | ||
"connection": "close", | ||
"content-length": "45", | ||
"content-type": "application/json", | ||
"host": "DYNAMIC", | ||
"user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)", | ||
}, | ||
"method": "POST", | ||
}, | ||
], | ||
"spec": Object { | ||
"body": Object { | ||
"data": Object { | ||
"foo": 1, | ||
}, | ||
}, | ||
}, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`accepts graphql DocumentNode as alternative to raw string 1`] = ` | ||
Object { | ||
"requests": Array [ | ||
Object { | ||
"body": Object { | ||
"query": "{ | ||
query { | ||
users | ||
} | ||
}", | ||
}, | ||
"headers": Object { | ||
"accept": "*/*", | ||
"accept-encoding": "gzip,deflate", | ||
"connection": "close", | ||
"content-length": "43", | ||
"content-type": "application/json", | ||
"host": "DYNAMIC", | ||
"user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)", | ||
}, | ||
"method": "POST", | ||
}, | ||
], | ||
"spec": Object { | ||
"body": Object { | ||
"data": Object { | ||
"foo": 1, | ||
}, | ||
}, | ||
}, | ||
} | ||
`; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`gql passthrough allowing benefits of tooling for gql template tag 1`] = ` | ||
Object { | ||
"requests": Array [ | ||
Object { | ||
"body": Object { | ||
"operationName": "allUsers", | ||
"query": "query allUsers { | ||
users | ||
} | ||
", | ||
}, | ||
"headers": Object { | ||
"accept": "*/*", | ||
"accept-encoding": "gzip,deflate", | ||
"connection": "close", | ||
"content-length": "69", | ||
"content-type": "application/json", | ||
"host": "DYNAMIC", | ||
"user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)", | ||
}, | ||
"method": "POST", | ||
}, | ||
], | ||
"spec": Object { | ||
"body": Object { | ||
"data": Object { | ||
"foo": 1, | ||
}, | ||
}, | ||
}, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`gql passthrough allowing benefits of tooling for gql template tag 1`] = ` | ||
Object { | ||
"requests": Array [ | ||
Object { | ||
"body": Object { | ||
"operationName": "allUsers", | ||
"query": "query allUsers { | ||
users | ||
}", | ||
}, | ||
"headers": Object { | ||
"accept": "*/*", | ||
"accept-encoding": "gzip,deflate", | ||
"connection": "close", | ||
"content-length": "67", | ||
"content-type": "application/json", | ||
"host": "DYNAMIC", | ||
"user-agent": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)", | ||
}, | ||
"method": "POST", | ||
}, | ||
], | ||
"spec": Object { | ||
"body": Object { | ||
"data": Object { | ||
"foo": 1, | ||
}, | ||
}, | ||
}, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
install_and_test() | ||
{ | ||
yarn add graphql@"$((GRAPHQL_VERSION))" --dev | ||
yarn test | ||
} | ||
|
||
export GRAPHQL_VERSION=14 | ||
install_and_test | ||
|
||
export GRAPHQL_VERSION=15 | ||
install_and_test | ||
|
||
export GRAPHQL_VERSION=16 | ||
install_and_test |
Oops, something went wrong.