Skip to content

Commit

Permalink
fix(jest): Include RWJS_DEBUG_ENV in jest web env (#9065)
Browse files Browse the repository at this point in the history
Fixes the issue described here:
https://community.redwoodjs.com/t/redwood-v6-0-0-upgrade-guide/5044/70

Note that I'm unable to reproduce the actual failure, but it looks like
a legitimate error to me (and I understand why).
  • Loading branch information
dac09 authored Sep 2, 2023
1 parent a0ec0d2 commit e90ae0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/testing/config/jest/web/jest-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ module.exports = {
RWJS_API_GRAPHQL_URL: '/',
__REDWOOD__APP_TITLE: 'Redwood App',
},
RWJS_DEBUG_ENV: {
RWJS_SRC_ROOT: rwjsPaths.web.src,
},
},
collectCoverageFrom: [
'**/*.{js,jsx,ts,tsx}',
Expand Down
7 changes: 5 additions & 2 deletions packages/web/src/components/DevFatalErrorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import { useState } from 'react'

import StackTracey from 'stacktracey'

// RWJS_SRC_ROOT is defined and defaulted in webpack to the base path
const srcRoot = globalThis.RWJS_DEBUG_ENV?.RWJS_SRC_ROOT || ''
// RWJS_SRC_ROOT is defined and defaulted in webpack+vite to the base path
let srcRoot = ''
if (typeof RWJS_DEBUG_ENV !== 'undefined') {
srcRoot = RWJS_DEBUG_ENV?.RWJS_SRC_ROOT
}

let appRoot: string

Expand Down

0 comments on commit e90ae0c

Please sign in to comment.