Thanks for reporting a bug you have found in Cursor!
Please add the following info to help us diagnose your issue:
Check the forum to ensure the issue hasn’t been reported already
It hasn’t.
Provide a clear description of the bug
When I try to reference Jest in an initial message for a new chat, I sometimes see Cursor fail to process the request.
Every single time I send a followup request which references Jest, cursor fails to respond. Worth noting that I’m inside of an LWC project when these failures happen. I don’t write Jest outside of the context of LWC so I’m not sure if its reproducible outside of the LWC framework.
Explain how to reproduce the bug (if known)
First, setup your local to run a LWC project (Markdown instructions provided below). Then, reference a snippet of a Jest test within the LWC project in your cursor chat. Send the first message, then send a followup message.
Prerequisites
- Node.js (v14.x or later)
- npm (v6.x or later)
Installation Steps
1. Install Salesforce CLI
The Salesforce CLI (sf) is required to work with Salesforce projects.
npm install -g @salesforce/cli
2. Clone a Sample LWC Project (Optional)
If you don’t have an existing LWC project:
sf project generate --name lwc-test-project --template standard
cd lwc-test-project
3. Set Up Jest Testing Dependencies
Install the required packages:
npm install --save-dev @salesforce/sfdx-lwc-jest
4. Configure Jest
Make sure your project has a proper Jest configuration. Check for a jest.config.js
file in your project root. If it doesn’t exist, create one with:
npx sfdx-lwc-jest --init
5. Verify Installation
Run a test command to verify your setup:
npm run test:unit
Or using the Salesforce CLI:
sf lightning test run
Sample Jest Test Structure
When providing test code to Cursor, use this structure:
import { createElement } from 'lwc';
import MyComponent from 'c/myComponent';
describe('c-my-component', () => {
afterEach(() => {
while (document.body.firstChild) {
document.body.removeChild(document.body.firstChild);
}
});
it('should do something specific', () => {
const element = createElement('c-my-component', {
is: MyComponent
});
document.body.appendChild(element);
// Your assertions here
expect(element.querySelector('div.some-class')).toBeTruthy();
});
});
Attach screenshots or recordings (e.g.,
.jpg
, .png
, .mp4
).
Shows an initial message failing to run until I removed the Jest reference. Also shows the followup message to the same thread failing to work.
Tell us your operating system and your Cursor version (e.g.,
Windows, 0.x.x
).
Apple M2 Pro - 14.6.1 (23G93)
Version: 0.48.8
VSCode Version: 1.96.2
Commit: 7801■■■6824585b7f2721900066bc87c4a09b740
Date: 2025-04-07T19:54:58.315Z
Electron: 34.3.4
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Darwin arm64 23.6.0
Tell us if the issue stops you from using Cursor.
Yes, it completely stops me from using it for frontend testing.