Skip to content

Commit

Permalink
fix(packages/sui-mock): Fix error in Pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosvillu committed Feb 7, 2024
1 parent 47f6786 commit f87b73b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/sui-mock/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global __MOCKS_API_PATH__ */
// /* global __MOCKS_API_PATH__ */
import {rest} from 'msw'

import {getBrowserMocker} from './browser.js'
Expand Down Expand Up @@ -44,13 +44,14 @@ const generateHandlerFromContext = requester => {

const setupMocker = legacyHandlers => {
const mocker = isNode ? getServerMocker : getBrowserMocker
let apiContextRequest
try {
apiContextRequest = require.context(__MOCKS_API_PATH__, true, /index\.js$/)
} catch (err) {
console.error(`[sui-mock] Not found route folder in ${__MOCKS_API_PATH__} autoload of msw handlers disabled`)
apiContextRequest = false
}
// TODO: Review error in Pipeline https://github.mpi-internal.com/scmspain/frontend-cf--web-app/actions/runs/3804318/job/12053812#step:5:238
const apiContextRequest = false
// try {
// apiContextRequest = require.context(__MOCKS_API_PATH__, true, /index\.js$/)
// } catch (err) {
// console.error(`[sui-mock] Not found route folder in ${__MOCKS_API_PATH__} autoload of msw handlers disabled`)
// apiContextRequest = false
// }

return mocker([...legacyHandlers, ...(apiContextRequest && generateHandlerFromContext(apiContextRequest))])
}
Expand Down

0 comments on commit f87b73b

Please sign in to comment.