Skip to content

Commit

Permalink
Enable msw file server for DoesItAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatGuySam committed Aug 12, 2023
1 parent 81340c5 commit 361350e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions helpers/api/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@
import axios from 'axios'

import { getApiUrl } from '~/helpers/url.js'
import { mswServer } from '~/test/msw/server.js'


const mswEnabled = process.env.NODE_ENV && [ 'development', 'test' ].includes( process.env.NODE_ENV )

// Inspired by https://github.com/wwdrew/examples/blob/react-native/examples/react-native/index.js
if ( mswEnabled ) {
// const { native } = require( '~/test/msw/native' )
// const { mswServer } = await import( '~/test/msw/server' )

// console.log({ mswServer })

mswServer.listen( {
// Fixes issue with MSW capturing POST http://192.168.1.90:19000/symbolicate
onUnhandledRequest: 'bypass',
} )
}

// const defaultFetchMethod = (...args) => console.log(...args) // mock

Expand Down

0 comments on commit 361350e

Please sign in to comment.