Skip to content

Commit

Permalink
refactor: replace dangerouslyRunInProduction error message
Browse files Browse the repository at this point in the history
  • Loading branch information
scr2em committed Nov 18, 2023
1 parent 7afaff6 commit 53b7e2c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions src/browser/setupWorker/glossary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ export interface StartOptions extends SharedOptions {
* of all registered Service Workers on the page.
*/
findWorker?: FindWorker

/**
* A flag to enable MSW in production (NODE_ENV === 'production'), otherwise it will throw an error
*/
dangerouslyRunInProduction?: boolean
}

export type StartReturnType = Promise<ServiceWorkerRegistration | undefined>
Expand Down
2 changes: 1 addition & 1 deletion src/browser/setupWorker/setupWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class SetupWorkerApi
invariant(
!this.context.startOptions.dangerouslyRunInProduction && isProduction(),
devUtils.formatMessage(
'The flag dangerouslyRunInProduction is false but you are in a production environment',
'Failed to call "setupWorker" in a production environment. Please make sure you enable API mocking conditionally so it doesn\'t leak to production.',
),
'https://github.com/mswjs/msw/issues/1703',
)
Expand Down
2 changes: 1 addition & 1 deletion src/node/SetupServerApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class SetupServerApi
invariant(
!this.resolvedOptions.dangerouslyRunInProduction && isProduction(),
devUtils.formatMessage(
'The flag dangerouslyRunInProduction is false but you are in a production environment',
'Failed to call "setupWorker" in a production environment. Please make sure you enable API mocking conditionally so it doesn\'t leak to production.',
),
'https://github.com/mswjs/msw/issues/1703',
)
Expand Down

0 comments on commit 53b7e2c

Please sign in to comment.