-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check fragment hashes in babel-plugin-relay
Summary: This validates that the product engineer has run the Relay build and is not using outdated GraphQL fragments. Optionally this can be turned off in the babel plugin settings. Reviewed By: leebyron Differential Revision: D6229469 fbshipit-source-id: 4615cf9db39017beb91e57d5089e88aedc79076e
- Loading branch information
1 parent
b45baa4
commit a628637
Showing
5 changed files
with
159 additions
and
16 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
37 changes: 37 additions & 0 deletions
37
packages/babel-plugin-relay/__tests__/__snapshots__/BabelPluginRelay-test.js.snap
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,37 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`BabelPluginRelay \`development\` option does not test the hash when \`development\` is not set 1`] = ` | ||
"({ | ||
data: function () { | ||
return require(\\"./__generated__/TestFrag.graphql\\"); | ||
} | ||
});" | ||
`; | ||
|
||
exports[`BabelPluginRelay \`development\` option tests the hash when \`development\` is set 1`] = ` | ||
"({ | ||
data: function () { | ||
const node = require(\\"./__generated__/TestFrag.graphql\\"); | ||
if (node.hash && node.hash !== \\"0bb6b7b29bc3e910921551c4ff5b6757\\") { | ||
console.error(\\"The definition of 'TestFrag' appears to have changed. Run \`relay-compiler\` to update the generated files to receive the expected data.\\"); | ||
} | ||
return node; | ||
} | ||
});" | ||
`; | ||
|
||
exports[`BabelPluginRelay \`development\` option uses a custom build command in message 1`] = ` | ||
"({ | ||
data: function () { | ||
const node = require(\\"./__generated__/TestFrag.graphql\\"); | ||
if (node.hash && node.hash !== \\"0bb6b7b29bc3e910921551c4ff5b6757\\") { | ||
console.error(\\"The definition of 'TestFrag' appears to have changed. Run \`relay-build\` to update the generated files to receive the expected data.\\"); | ||
} | ||
return node; | ||
} | ||
});" | ||
`; |
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