question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

msw test breaking

See original GitHub issue

@kettanaito, after upgrading msw, we’re getting this test failure:

 FAIL  src/__tests__/index.js
  ● Test suite failed to run

    Error: Failed to restore patched modules: no patches found. Did you forget to run ".apply()"?

      36 |
      37 | beforeAll(() => server.listen(backend))
    > 38 | afterAll(() => server.close())
         |                       ^
      39 | afterEach(() => server.resetHandlers())
      40 |

      at Object.restore (node_modules/@mswjs/interceptors/src/createInterceptor.ts:83:15)
      at Object.close (node_modules/msw/node/lib/index.js:7690:29)
      at Object.<anonymous> (src/setup-tests.tsx:38:23)

I’ve dug a little bit but I’m not sure what’s changed and why this is happening. Any ideas?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kentcdoddscommented, Apr 2, 2021

I figured it out! Sorry to make you spend time on this. It turns out these tests run the same code that runs when the app starts up and that includes calling startWorker 🤦 So we were calling createInterceptor twice which I guess is the issue. Here’s the fix: https://github.com/kentcdodds/react-workshop-app/commit/a204e5d453e9180629f527b7fe74cd175626cd83

Thanks for your help!

1reaction
kentcdoddscommented, Mar 30, 2021

Thanks for looking into it. This should get things reproducing for you:

git clone https://github.com/kentcdodds/react-workshop-app.git
cd ./react-workshop-app
npm run setup
Read more comments on GitHub >

github_iconTop Results From Across the Web

If you fail the exam - Association of Social Work Boards
It breaks down your performance by exam content area and serves as a good resource as you make a study plan. 90-day waiting...
Read more >
Phil in the Gaps – Masters and Clinical Social Work Exam Prep
Watch Phil break down questions and provide insight on how to approach the exam. ... Phillip Luttrell is a LMSW-C clinical social worker...
Read more >
Social Work Test Prep: LMSW, LCSW, ASWB Exams - Agents ...
Prepare for the ASWB Exam with our free tools, study tips, expert advice, and more. ... test-taking tips, and strategies to break down...
Read more >
Secrets for Passing the LMSW Exam - SocialWork.Career
I failed the first time by 4 points and the second time by 1 point. Do you know how frustrating that was for...
Read more >
LCSW Practice Exam - Social Work Test Prep
The Licensed Clinical Social Work (LCSW) exam is administered by Association of Social Work Board (ASWB). ... The Clinical exam breaks down this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found