Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance module not found error #15860

Merged
merged 8 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions test/acceptance/ReactRefreshLogBox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,35 @@ test('unterminated JSX', async () => {
await cleanup()
})

test('Module not found', async () => {
const [session, cleanup] = await sandbox()

await session.patch(
'index.js',
`
import Comp from 'b'

export default () => {
return (
<div>
<Comp>lol</Comp>
</div>
)
}
`
)

expect(await session.hasRedbox(true)).toBe(true)

const source = await session.getRedboxSource()
expect(source).toMatchInlineSnapshot(`
"./index.js
timneutkens marked this conversation as resolved.
Show resolved Hide resolved
Module not found: Can't resolve 'b' in '${session.sandboxDirectory}'"
`)

await cleanup()
})

test('conversion to class component (1)', async () => {
const [session, cleanup] = await sandbox()

Expand Down
1 change: 1 addition & 0 deletions test/acceptance/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export async function sandbox(id = nanoid(), initialFiles = new Map()) {

return [
{
sandboxDirectory,
async write(fileName, content) {
// Update the file on filesystem
const fullFileName = path.join(sandboxDirectory, fileName)
Expand Down