From 309d206a23a31833759eff32d860eb2f00454495 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Thu, 12 Dec 2024 09:44:43 +0100 Subject: [PATCH] Update all dependencies Signed-off-by: Matteo Collina --- .gitignore | 5 +- .taprc | 5 -- lib/subscription-connection.js | 3 +- package.json | 22 ++++---- tap-snapshots/test/errors.js.test.cjs | 56 +++++++++++++++---- tap-snapshots/test/federation.js.test.cjs | 46 --------------- .../test/gateway/remote-services.js.test.cjs | 14 ----- tap-snapshots/test/routes.js.test.cjs | 22 ++++---- test/app-decorator.js | 2 +- test/errors.js | 4 +- test/subscription.js | 7 ++- 11 files changed, 81 insertions(+), 105 deletions(-) delete mode 100644 .taprc delete mode 100644 tap-snapshots/test/federation.js.test.cjs delete mode 100644 tap-snapshots/test/gateway/remote-services.js.test.cjs diff --git a/.gitignore b/.gitignore index b5d2cfca..e38ac9e4 100644 --- a/.gitignore +++ b/.gitignore @@ -72,4 +72,7 @@ typings/ # lockfiles package-lock.json yarn.lock -pnpm-lock.yaml \ No newline at end of file +pnpm-lock.yaml + +# tap +.tap diff --git a/.taprc b/.taprc deleted file mode 100644 index 611421b0..00000000 --- a/.taprc +++ /dev/null @@ -1,5 +0,0 @@ -ts: false -jsx: false -flow: false -coverage: true -timeout: 120 diff --git a/lib/subscription-connection.js b/lib/subscription-connection.js index 4cb4b019..a035be56 100644 --- a/lib/subscription-connection.js +++ b/lib/subscription-connection.js @@ -56,6 +56,7 @@ module.exports = class SubscriptionConnection { this.fastify.log.error(err) this.handleConnectionClose() } + /* c8 ignore next 3 */ } } @@ -168,7 +169,7 @@ module.exports = class SubscriptionConnection { if (this.keepAlive) { this.sendKeepAlive() - /* istanbul ignore next */ + /* c8 ignore next 3 */ this.keepAliveTimer = setInterval(() => { this.sendKeepAlive() }, this.keepAlive) diff --git a/package.json b/package.json index 19427d49..562b791c 100644 --- a/package.json +++ b/package.json @@ -31,44 +31,44 @@ "@graphql-tools/merge": "^9.0.0", "@graphql-tools/schema": "^10.0.0", "@graphql-tools/utils": "^10.0.0", - "@sinonjs/fake-timers": "^11.0.0", + "@sinonjs/fake-timers": "^14.0.0", "@types/isomorphic-form-data": "^2.0.0", "@types/node": "^22.0.0", "@types/ws": "^8.2.0", - "autocannon": "^7.3.0", - "concurrently": "^8.0.1", + "autocannon": "^8.0.0", + "concurrently": "^9.0.0", "docsify-cli": "^4.4.3", "eslint": "^9.9.1", "fastify": "^5.0.0-alpha.4", "graphql": "^16.0.0", "graphql-tag": "^2.12.6", "graphql-ws": "^5.11.2", - "neostandard": "^0.11.4", + "neostandard": "^0.12.0", "pre-commit": "^1.2.2", "proxyquire": "^2.1.3", "semver": "^7.5.0", - "sinon": "^17.0.0", + "sinon": "^19.0.0", "split2": "^4.0.0", - "tap": "^16.3.0", - "tsd": "^0.30.0", + "tap": "^21.0.0", + "tsd": "^0.31.0", "typescript": "^5.0.2", - "wait-on": "^7.0.1" + "undici": "^7.0.0", + "wait-on": "^8.0.0" }, "dependencies": { "@fastify/error": "^4.0.0", "@fastify/static": "^8.0.0", "@fastify/websocket": "^11.0.0", "fastify-plugin": "^5.0.0", - "graphql-jit": "0.8.6", + "graphql-jit": "0.8.7", "mqemitter": "^6.0.0", "p-map": "^4.0.0", "quick-lru": "^7.0.0", "readable-stream": "^4.0.0", "safe-stable-stringify": "^2.3.0", - "secure-json-parse": "^2.7.0", + "secure-json-parse": "^3.0.0", "single-user-cache": "^1.0.0", "tiny-lru": "^11.0.0", - "undici": "^6.19.8", "ws": "^8.2.2" }, "tsd": { diff --git a/tap-snapshots/test/errors.js.test.cjs b/tap-snapshots/test/errors.js.test.cjs index 71e635a9..dbddffda 100644 --- a/tap-snapshots/test/errors.js.test.cjs +++ b/tap-snapshots/test/errors.js.test.cjs @@ -5,7 +5,51 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports['test/errors.js TAP POST query which throws, with JIT enabled, twice > must match snapshot 1'] = ` +exports['test/errors.js > TAP > app.graphql which throws, with JIT enabled, twice > must match snapshot 1'] = ` +{ + "errors": [ + { + "message": "Bad Resolver", + "locations": [ + { + "line": 3, + "column": 9 + } + ], + "path": [ + "bad" + ] + } + ], + "data": { + "bad": null + } +} +` + +exports['test/errors.js > TAP > app.graphql which throws, with JIT enabled, twice > must match snapshot 2'] = ` +{ + "data": { + "bad": null + }, + "errors": [ + { + "message": "Int cannot represent non-integer value: [function bad]", + "locations": [ + { + "line": 3, + "column": 9 + } + ], + "path": [ + "bad" + ] + } + ] +} +` + +exports['test/errors.js > TAP > POST query which throws, with JIT enabled, twice > must match snapshot 1'] = ` { "data": { "bad": null @@ -27,7 +71,7 @@ exports['test/errors.js TAP POST query which throws, with JIT enabled, twice > m } ` -exports['test/errors.js TAP POST query which throws, with JIT enabled, twice > must match snapshot 2'] = ` +exports['test/errors.js > TAP > POST query which throws, with JIT enabled, twice > must match snapshot 2'] = ` { "data": { "bad": null @@ -48,11 +92,3 @@ exports['test/errors.js TAP POST query which throws, with JIT enabled, twice > m ] } ` - -exports['test/errors.js TAP app.graphql which throws, with JIT enabled, twice > must match snapshot 1'] = ` -{"errors":[{"message":"Bad Resolver","locations":[{"line":3,"column":9}],"path":["bad"]}],"data":{"bad":null}} -` - -exports['test/errors.js TAP app.graphql which throws, with JIT enabled, twice > must match snapshot 2'] = ` -{"data":{"bad":null},"errors":[{"message":"Int cannot represent non-integer value: [function bad]","locations":[{"line":3,"column":9}],"path":["bad"]}]} -` diff --git a/tap-snapshots/test/federation.js.test.cjs b/tap-snapshots/test/federation.js.test.cjs deleted file mode 100644 index 5a562ef2..00000000 --- a/tap-snapshots/test/federation.js.test.cjs +++ /dev/null @@ -1,46 +0,0 @@ -/* IMPORTANT - * This snapshot file is auto-generated, but designed for humans. - * It should be checked into source control and tracked carefully. - * Re-generate by setting TAP_SNAPSHOT=1 and running tests. - * Make sure to inspect the output below. Do not ignore changes! - */ -'use strict' -exports['test/federation.js TAP buildFederationSchema function adds stub types > must match snapshot 1'] = ` -directive @external on FIELD_DEFINITION - -directive @requires(fields: _FieldSet!) on FIELD_DEFINITION - -directive @provides(fields: _FieldSet!) on FIELD_DEFINITION - -directive @key(fields: _FieldSet!) on OBJECT | INTERFACE - -directive @extends on OBJECT | INTERFACE - -directive @customdir on FIELD_DEFINITION - -scalar _Any - -scalar _FieldSet - -type _Service { - sdl: String -} - -type Query { - me: User - _entities(representations: [_Any!]!): [_Entity]! - _service: _Service! -} - -type Product { - sku: String -} - -type User { - id: ID! - name: String - username: String -} - -union _Entity = Product | User -` diff --git a/tap-snapshots/test/gateway/remote-services.js.test.cjs b/tap-snapshots/test/gateway/remote-services.js.test.cjs deleted file mode 100644 index 4237fc17..00000000 --- a/tap-snapshots/test/gateway/remote-services.js.test.cjs +++ /dev/null @@ -1,14 +0,0 @@ -/* IMPORTANT - * This snapshot file is auto-generated, but designed for humans. - * It should be checked into source control and tracked carefully. - * Re-generate by setting TAP_SNAPSHOT=1 and running tests. - * Make sure to inspect the output below. Do not ignore changes! - */ -'use strict' -exports['test/gateway/remote-services.js TAP Does not error if at least one service schema is valid > must match snapshot 1'] = ` -Initializing service "not-working" failed with message: "Unknown type "World"." -` - -exports['test/gateway/remote-services.js TAP Does not error if at least one service schema is valid > must match snapshot 2'] = ` -Initializing service "not-working" failed with message: "Unknown type "World"." -` diff --git a/tap-snapshots/test/routes.js.test.cjs b/tap-snapshots/test/routes.js.test.cjs index 90cce741..c615a05a 100644 --- a/tap-snapshots/test/routes.js.test.cjs +++ b/tap-snapshots/test/routes.js.test.cjs @@ -5,7 +5,7 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports['test/routes.js TAP GET return 200 on resolver error > must match snapshot 1'] = ` +exports['test/routes.js > TAP > GET return 200 on resolver error > must match snapshot 1'] = ` { "data": { "add": null @@ -27,7 +27,7 @@ exports['test/routes.js TAP GET return 200 on resolver error > must match snapsh } ` -exports['test/routes.js TAP HTTP mutation with GET errors > must match snapshot 1'] = ` +exports['test/routes.js > TAP > HTTP mutation with GET errors > must match snapshot 1'] = ` { "data": null, "errors": [ @@ -38,7 +38,12 @@ exports['test/routes.js TAP HTTP mutation with GET errors > must match snapshot } ` -exports['test/routes.js TAP POST return 200 on resolver error > must match snapshot 1'] = ` +exports['test/routes.js > TAP > if ide is graphiql, serve config.js with the correct endpoint > must match snapshot 1'] = ` +window.GRAPHQL_ENDPOINT = '/app/graphql'; +window.GRAPHIQL_PLUGIN_LIST = [] +` + +exports['test/routes.js > TAP > POST return 200 on resolver error > must match snapshot 1'] = ` { "data": { "add": null @@ -60,7 +65,7 @@ exports['test/routes.js TAP POST return 200 on resolver error > must match snaps } ` -exports['test/routes.js TAP POST return 400 on error > must match snapshot 1'] = ` +exports['test/routes.js > TAP > POST return 400 on error > must match snapshot 1'] = ` { "data": null, "errors": [ @@ -77,12 +82,7 @@ exports['test/routes.js TAP POST return 400 on error > must match snapshot 1'] = } ` -exports['test/routes.js TAP if ide is graphiql, serve config.js with the correct endpoint > must match snapshot 1'] = ` -window.GRAPHQL_ENDPOINT = '/app/graphql'; -window.GRAPHIQL_PLUGIN_LIST = [] -` - -exports['test/routes.js TAP server should return 200 on graphql errors (if field can be null) > must match snapshot 1'] = ` +exports['test/routes.js > TAP > server should return 200 on graphql errors (if field can be null) > must match snapshot 1'] = ` { "data": { "hello": null @@ -104,7 +104,7 @@ exports['test/routes.js TAP server should return 200 on graphql errors (if field } ` -exports['test/routes.js TAP server should return 200 on graphql errors (if field can not be null) > must match snapshot 1'] = ` +exports['test/routes.js > TAP > server should return 200 on graphql errors (if field can not be null) > must match snapshot 1'] = ` { "data": null, "errors": [ diff --git a/test/app-decorator.js b/test/app-decorator.js index 8e9e197b..cf204a1e 100644 --- a/test/app-decorator.js +++ b/test/app-decorator.js @@ -628,7 +628,7 @@ test('scalar should be supported', async (t) => { return value }, serialize (value) { - t.pass(value, 4) + t.equal(value, 4) return value }, parseLiteral (ast) { diff --git a/test/errors.js b/test/errors.js index 818b0c89..d2ff9998 100644 --- a/test/errors.js +++ b/test/errors.js @@ -775,11 +775,11 @@ test('app.graphql which throws, with JIT enabled, twice', async (t) => { let res = await app.graphql(query, null, { x: 1 }) - t.matchSnapshot(JSON.stringify(res), null, 2) + t.matchSnapshot(JSON.stringify(res, null, 2)) res = await app.graphql(query, null, { x: 1 }) - t.matchSnapshot(JSON.stringify(res), null, 2) + t.matchSnapshot(JSON.stringify(res, null, 2)) lines.end() diff --git a/test/subscription.js b/test/subscription.js index 0edc92e6..085e1d7b 100644 --- a/test/subscription.js +++ b/test/subscription.js @@ -17,7 +17,8 @@ t.beforeEach(({ context }) => { context.clock = FakeTimers.install({ shouldClearNativeTimers: true, shouldAdvanceTime: true, - advanceTimeDelta: 40 + advanceTimeDelta: 40, + toFake: ['setTimeout', 'clearTimeout', 'setImmediate', 'clearImmediate', 'setInterval', 'clearInterval', 'Date', 'hrtime', 'performance'] }) }) @@ -1200,7 +1201,7 @@ test('subscription server sends correct error if there\'s a graphql error', t => payload: { query: ` subscription { - notificationAdded { + notificationAdded {, id message } @@ -1245,7 +1246,7 @@ test('subscription server sends correct error if there\'s a graphql error', t => }) }) -test('subscription server exposes pubsub', t => { +test('subscription server exposes pubsub', { only: true }, t => { const app = Fastify() t.teardown(() => app.close())