Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 747 Bytes

File metadata and controls

42 lines (29 loc) · 747 Bytes

1. Environment

  • Node v25.9.0
  • PNPM 10.30.3

2. JEST install for Unit Test

2-1. Build a Node.js project

$ pnpm init

You will be asked some questions, but just keep tapping "Enter" key.

2-2. Install required packages

$ pnpm install --save-dev jest babel-jest babel-core @babel/core @babel/preset-env

2-3. Install a plugin with babel to convert JEST to CommonJS

$ pnpm install --save-dev jest babel-jest

2-4. Run a unittest

To execute all unit tests, run npx jest.

$ pnpm jest
 PASS  __tests__/hello.test.js (24.047 s)
  ✓ Hello (3 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        48.781 s
Ran all test suites.