Skip to content

Commit

Permalink
fix atomic writes
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet committed Aug 25, 2021
1 parent ab8cf86 commit 250720f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/gatsby/src/utils/worker/__tests__/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import * as path from "path"

let worker: GatsbyTestWorkerPool | undefined

jest.mock(`gatsby-telemetry`, () => {
return {
decorateEvent: jest.fn(),
trackCli: jest.fn(),
}
})

beforeEach(() => {
store.dispatch({ type: `DELETE_CACHE` })
})
Expand Down
10 changes: 10 additions & 0 deletions packages/gatsby/src/utils/worker/__tests__/datastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ import { store } from "../../../redux"
import { actions } from "../../../redux/actions"
import { getDataStore } from "../../../datastore"

jest.mock(`gatsby-telemetry`, () => {
return {
decorateEvent: jest.fn(),
}
})

jest.mock(`gatsby-cli/lib/reporter`, () => {
return {}
})

let worker: GatsbyTestWorkerPool | undefined

beforeEach(() => {
Expand Down
9 changes: 9 additions & 0 deletions packages/gatsby/src/utils/worker/__tests__/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ import { waitUntilAllJobsComplete } from "../../jobs/manager"
import type { MessagesFromChild, MessagesFromParent } from "../messaging"
import { getReduxJobs, getJobsMeta } from "./test-helpers/child-for-tests"

jest.mock(`gatsby-telemetry`, () => {
return {
decorateEvent: jest.fn(),
trackCli: jest.fn(),
}
})

// jest.mock(`gatsby-cli/lib/reporter`, () => jest.fn())

let worker: GatsbyTestWorkerPool | undefined

describe(`worker (jobs)`, () => {
Expand Down
8 changes: 8 additions & 0 deletions packages/gatsby/src/utils/worker/__tests__/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ jest.mock(`chokidar`, () => {
return chokidar
})

jest.mock(`gatsby-telemetry`, () => {
return {
decorateEvent: jest.fn(),
trackError: jest.fn(),
trackCli: jest.fn(),
}
})

const dummyKeys = `a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z`.split(
`,`
)
Expand Down
8 changes: 8 additions & 0 deletions packages/gatsby/src/utils/worker/__tests__/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ jest.mock(`chokidar`, () => {
return chokidar
})

jest.mock(`gatsby-telemetry`, () => {
return {
decorateEvent: jest.fn(),
trackError: jest.fn(),
trackCli: jest.fn(),
}
})

describeWhenLMDB(`worker (schema)`, () => {
let stateFromWorker: CombinedState<IGatsbyState>

Expand Down
8 changes: 8 additions & 0 deletions packages/gatsby/src/utils/worker/__tests__/share-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ import {
} from "../../../redux"
import { GatsbyStateKeys } from "../../../redux/types"

jest.mock(`gatsby-telemetry`, () => {
return {
decorateEvent: jest.fn(),
trackError: jest.fn(),
trackCli: jest.fn(),
}
})

let worker: GatsbyTestWorkerPool | undefined

const dummyPagePayload = {
Expand Down

0 comments on commit 250720f

Please sign in to comment.