RocketChat / RocketChat/EmbeddedChat

fix(react): src/index.test.js fails on develop due to missing swiper/element/bundle module

Open
#1,191 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
165
Forks
381
Avg merge
1d 2h
Merged PRs (30d)
1

Description

Bug Report

Summary

src/index.test.js fails to run on the develop branch and has been broken before any recent changes. This is a pre-existing issue unrelated to any feature work.

Steps to Reproduce
cd packages/react
npx jest src/index.test.js --no-coverage


Cannot find module 'swiper/element/bundle' from 'src/views/ImageGallery/Swiper.js'

Require stack:
  src/views/ImageGallery/Swiper.js
  src/views/ImageGallery/ImageGallery.js
  src/views/AttachmentHandler/ImageAttachment.js
  src/views/AttachmentHandler/Attachment.js
  src/views/AttachmentHandler/Attachments.js
  src/views/AttachmentHandler/index.js
  src/views/Message/Message.js
  src/views/MessageAggregators/common/MessageAggregator.js
  src/views/MessageAggregators/MentionedMessages.js
  src/index.test.js


Root Cause

swiper/element/bundle is not installed in [node_modules](vscode-file://vscode-app/c:/Users/vigne/AppData/Local/Programs/Microsoft%20VS%20Code/61b3d0ab13/resources/app/out/vs/code/electron-browser/workbench/workbench.html) at test time, so Jest cannot resolve it when loading the full component tree through src/index.js. There is also no jest.config.js or moduleNameMapper stub to mock it out during tests.

Expected Behaviour

npx jest --no-coverage should pass without failing due to a missing or unresolvable package.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/react with npx jest src/index.test.js --no-coverage, then trace the require stack from src/index.test.js to src/views/ImageGallery/Swiper.js. Check how the swiper/element/bundle import is resolved during tests and verify that the full test command completes without a missing-module failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.