diff --git a/packages/gatsby/src/query/__tests__/data-tracking.js b/packages/gatsby/src/query/__tests__/data-tracking.js index 7a210aab0b3d5..0d14f810b6916 100644 --- a/packages/gatsby/src/query/__tests__/data-tracking.js +++ b/packages/gatsby/src/query/__tests__/data-tracking.js @@ -125,8 +125,12 @@ const setup = async ({ restart = isFirstRun, clearCache = false } = {}) => { } jest.doMock(`../query-runner`, () => { - const actualQueryRunner = jest.requireActual(`../query-runner`) - return jest.fn(actualQueryRunner) + const { queryRunner: actualQueryRunner } = jest.requireActual( + `../query-runner` + ) + return { + queryRunner: jest.fn(actualQueryRunner), + } }) jest.doMock(`../../utils/api-runner-node`, () => apiName => { @@ -146,7 +150,8 @@ const setup = async ({ restart = isFirstRun, clearCache = false } = {}) => { const { store, emitter } = require(`../../redux`) const { saveState } = require(`../../db`) const reporter = require(`gatsby-cli/lib/reporter`) - const queryRunner = require(`../query-runner`) + // const queryRunnerMock = require(`../query-runner`) + const { queryRunner } = require(`../query-runner`) const { boundActionCreators } = require(`../../redux/actions`) const doubleBoundActionCreators = Object.keys(boundActionCreators).reduce( (acc, actionName) => { @@ -175,6 +180,8 @@ const setup = async ({ restart = isFirstRun, clearCache = false } = {}) => { } } + // queryRunnerMock.mockClear() + // console.log("=======", queryRunner.mock) queryRunner.mockClear() store.dispatch({ @@ -430,7 +437,7 @@ describe(`query caching between builds`, () => { siteMetadata: { title: `My Site`, description: `Description of site - + --edited edited content #${nodeChangeCounter++} `, @@ -509,7 +516,7 @@ describe(`query caching between builds`, () => { id: `test-2`, slug: `bar`, content: `Dolor sit amet. - + --edited edited content #${nodeChangeCounter++} `, @@ -607,7 +614,7 @@ describe(`query caching between builds`, () => { createNotUsedNode({ id: `not-used`, content: `Content - + --edited edited content #${nodeChangeCounter++}`, }) @@ -679,7 +686,7 @@ describe(`query caching between builds`, () => { id: `test-1`, slug: `foo`, content: `Lorem ipsum. - + --edited edited content #${nodeChangeCounter++}`, }) @@ -838,7 +845,7 @@ describe(`query caching between builds`, () => { siteMetadata: { title: `My Site`, description: `Description of site - + --edited edited content #${nodeChangeCounter++} `, diff --git a/packages/gatsby/src/query/queue.js b/packages/gatsby/src/query/queue.js index aae295132da42..40ab7018eef3e 100644 --- a/packages/gatsby/src/query/queue.js +++ b/packages/gatsby/src/query/queue.js @@ -1,7 +1,7 @@ const Queue = require(`better-queue`) const { store } = require(`../redux`) const FastMemoryStore = require(`../query/better-queue-custom-store`) -const queryRunner = require(`../query/query-runner`) +const { queryRunner } = require(`../query/query-runner`) const websocketManager = require(`../utils/websocket-manager`) const { GraphQLRunner } = require(`./graphql-runner`)