Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jest snapshot format to future v29 default #6910

Merged
merged 2 commits into from Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stale-goats-serve.md
@@ -0,0 +1,5 @@
---
'@apollo/server-integration-testsuite': patch
---

Update snapshot format to future jest v29 default
2 changes: 2 additions & 0 deletions jest.config.base.js
Expand Up @@ -21,4 +21,6 @@ export default {
// Ignore '.js' at the end of imports; part of ESM support.
'^(\\.{1,2}/.*)\\.js$': '$1',
},
// this can be removed with jest v29
snapshotFormat: { escapeString: false, printBasicPrototype: false },
};
100 changes: 50 additions & 50 deletions packages/integration-testsuite/src/apolloServerTests.ts
Expand Up @@ -733,10 +733,10 @@ export function defineIntegrationTestSuiteApolloServerTests(
.send({ query: INTROSPECTION_QUERY });
expect(res.status).toBe(500);
expect(res.body).toMatchInlineSnapshot(`
Object {
"errors": Array [
Object {
"extensions": Object {
{
"errors": [
{
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
},
"message": "Internal server error",
Expand All @@ -758,10 +758,10 @@ export function defineIntegrationTestSuiteApolloServerTests(
.send({ query: TEST_STRING_QUERY });
expect(res.status).toBe(500);
expect(res.body).toMatchInlineSnapshot(`
Object {
"errors": Array [
Object {
"extensions": Object {
{
"errors": [
{
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
},
"message": "Internal server error",
Expand Down Expand Up @@ -1347,11 +1347,11 @@ export function defineIntegrationTestSuiteApolloServerTests(

// The child should maintain the path and message
expect(trace.root!.child![0].error).toMatchInlineSnapshot(`
Array [
Object {
"json": "{\\"message\\":\\"should be unmodified\\",\\"locations\\":[{\\"line\\":1,\\"column\\":2}],\\"path\\":[\\"fieldWhichWillError\\"],\\"extensions\\":{\\"custom\\":\\"extension\\"}}",
"location": Array [
Object {
[
{
"json": "{"message":"should be unmodified","locations":[{"line":1,"column":2}],"path":["fieldWhichWillError"],"extensions":{"custom":"extension"}}",
"location": [
{
"column": 2,
"line": 1,
},
Expand Down Expand Up @@ -1398,11 +1398,11 @@ export function defineIntegrationTestSuiteApolloServerTests(

// The child should maintain the path, but have its message masked
expect(trace.root!.child![0].error).toMatchInlineSnapshot(`
Array [
Object {
"json": "{\\"message\\":\\"<masked>\\",\\"locations\\":[{\\"line\\":1,\\"column\\":2}],\\"path\\":[\\"fieldWhichWillError\\"],\\"extensions\\":{\\"maskedBy\\":\\"ApolloServerPluginUsageReporting\\"}}",
"location": Array [
Object {
[
{
"json": "{"message":"<masked>","locations":[{"line":1,"column":2}],"path":["fieldWhichWillError"],"extensions":{"maskedBy":"ApolloServerPluginUsageReporting"}}",
"location": [
{
"column": 2,
"line": 1,
},
Expand Down Expand Up @@ -1721,18 +1721,18 @@ export function defineIntegrationTestSuiteApolloServerTests(
}),
),
).toMatchInlineSnapshot(`
Object {
"contextCreationDidFailMockCalls": Array [
Array [
Object {
{
"contextCreationDidFailMockCalls": [
[
{
"error": [GraphQLError: valid result],
},
],
],
"result": Object {
"errors": Array [
Object {
"extensions": Object {
"result": {
"errors": [
{
"extensions": {
"code": "SOME_CODE",
"formatErrorCalled": true,
},
Expand All @@ -1749,18 +1749,18 @@ export function defineIntegrationTestSuiteApolloServerTests(
it('GraphQLErrors are formatted, defaulting to INTERNAL_SERVER_ERROR', async () => {
expect(await run(new GraphQLError('some error')))
.toMatchInlineSnapshot(`
Object {
"contextCreationDidFailMockCalls": Array [
Array [
Object {
{
"contextCreationDidFailMockCalls": [
[
{
"error": [GraphQLError: some error],
},
],
],
"result": Object {
"errors": Array [
Object {
"extensions": Object {
"result": {
"errors": [
{
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"formatErrorCalled": true,
},
Expand All @@ -1787,18 +1787,18 @@ export function defineIntegrationTestSuiteApolloServerTests(
}),
),
).toMatchInlineSnapshot(`
Object {
"contextCreationDidFailMockCalls": Array [
Array [
Object {
{
"contextCreationDidFailMockCalls": [
[
{
"error": [GraphQLError: some error],
},
],
],
"result": Object {
"errors": Array [
Object {
"extensions": Object {
"result": {
"errors": [
{
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"formatErrorCalled": true,
},
Expand All @@ -1815,18 +1815,18 @@ export function defineIntegrationTestSuiteApolloServerTests(
it('non-GraphQLErrors are formatted', async () => {
expect(await run(new Error('random error')))
.toMatchInlineSnapshot(`
Object {
"contextCreationDidFailMockCalls": Array [
Array [
Object {
{
"contextCreationDidFailMockCalls": [
[
{
"error": [Error: random error],
},
],
],
"result": Object {
"errors": Array [
Object {
"extensions": Object {
"result": {
"errors": [
{
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"formatErrorCalled": true,
},
Expand Down