vercel / next.js

The React Framework
https://nextjs.org
MIT License
124.87k stars 26.66k forks source link

`npm run test` fails with-jest-app using --watch flag. #69236

Open pgibler opened 3 weeks ago

pgibler commented 3 weeks ago

Verify canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2
  Available memory (MB): 64156
  Available CPU cores: 32
Binaries:
  Node: 20.9.0
  npm: 10.2.4
  Yarn: 1.22.22
  pnpm: 9.8.0
Relevant Packages:
  next: 14.2.6 // Latest available version is detected (14.2.6).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.3.3
Next.js Config:
  output: N/A

Which example does this report relate to?

with-jest-app

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

The default with-jest-app example fails to run the tests and produces an error with no message. Example:

Determining test suites to run...

  ● Test suite failed to run

thrown: [Error]

I changed package.json to use a different test command. The default is as follows:

"scripts": {
  "test": "jest --watch",
},

I changed it to two alternative configurations, both which ran the tests successfully:

1.

"scripts": {
  "test": "jest",
},

2.

"scripts": {
  "test": "jest --watchAll",
},

The example should work out of the box, so either the error should be figured out so --watch works, or --watchAll should be used, or the flag should be removed.

Expected Behavior

npm run test

> test
> jest

 PASS  __tests__/index.test.tsx
 PASS  __tests__/snapshot.tsx
 PASS  app/counter.test.tsx
 PASS  app/page.test.tsx
 PASS  app/blog/[slug]/page.test.tsx
 PASS  app/utils/add.test.ts

Test Suites: 6 passed, 6 total
Tests:       6 passed, 6 total
Snapshots:   1 passed, 1 total
Time:        0.924 s, estimated 1 s
Ran all test suites.

To Reproduce

Clone the with-jest-app example project and run npm run test

IshimweJoliePrincesse commented 3 weeks ago
http://localhost:3000

✓ Starting... ⚠ Disabling SWC Minifer will not be an option in the next major version. Please report any issues you may be experiencing to https://github.com/vercel/next.js/issues ⚠ Attempted to load @next/swc-win32-ia32-msvc, but an error occurred: A dynamic link library (DLL) initialization routine failed. \?\C:\Users\user\OneDrive\Desktop\isomo-blog-app\node_modules\@next\swc-win32-ia32-msvc\next-swc.win32-ia32-msvc.node ⨯ Failed to load SWC binary for win32/ia32, see more info here: https://nextjs.org/docs/messages/failed-loading-swc

PS C:\Users\user\OneDrive\Desktop\isomo-blog-app>