Skip to content

Commit

Permalink
add missing @tapjs/mock service key polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Sep 15, 2023
1 parent 6622dca commit 47a2289
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mock/src/service-key-cjs.cts
@@ -0,0 +1,8 @@
import { randomBytes } from 'crypto'
const kServiceKey = Symbol.for('@tapjs/mock.' + __filename)
const g = globalThis as typeof globalThis & {
[kServiceKey]: string
}

export const serviceKey = (g[kServiceKey] =
g[kServiceKey] ?? randomBytes(8).toString('hex'))

0 comments on commit 47a2289

Please sign in to comment.