Skip to content

Commit

Permalink
Add more logs to metro config
Browse files Browse the repository at this point in the history
  • Loading branch information
ospfranco committed Oct 20, 2023
1 parent 809355f commit fb4b503
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ require('dotenv').config();
const defaultConfig = getDefaultConfig(__dirname);

const isUsingMockAPI = process.env.E2E_TESTING === 'true';
// eslint-disable-next-line no-console
console.log(typeof process.env.E2E_TESTING);
// eslint-disable-next-line no-console
console.log(process.env.E2E_TESTING);
if (isUsingMockAPI) {
// eslint-disable-next-line no-console
console.log('⚠️ Using mock API');
Expand All @@ -24,10 +28,13 @@ const config = {
sourceExts: [...defaultSourceExts, 'jsx', 'svg'],
resolveRequest: (context, moduleName, platform) => {
const resolution = context.resolveRequest(context, moduleName, platform);
// eslint-disable-next-line no-console
console.log(`🟠 resolving module name ${moduleName} original path: ${resolution.filePath}`);
if (isUsingMockAPI && moduleName.includes('/API')) {
const originalPath = resolution.filePath;
const mockPath = originalPath.replace('src/libs/API.ts', 'src/libs/E2E/API.mock.js').replace('/src/libs/API.js/', 'src/libs/E2E/API.mock.js');
console.debug('> Replace', originalPath, ' => ', mockPath);
// eslint-disable-next-line no-console
console.log('🔴 Replace', originalPath, ' => ', mockPath);

return {
...resolution,
Expand Down

0 comments on commit fb4b503

Please sign in to comment.