Getting Started (ok)
https://jestjs.io/docs/getting-started
Last updated
Was this helpful?
https://jestjs.io/docs/getting-started
Last updated
Was this helpful?
Install Jest using :
Hãy bắt đầu bằng cách viết một bài kiểm tra cho một hàm giả định cộng hai số. Đầu tiên, tạo tệp sum.js:
Sau đó, tạo một tệp có tên sum.test.js. Điều này sẽ chứa thử nghiệm thực tế của chúng tôi:
Add the following section to your package.json
Finally, run yarn test
or npm run test
and Jest will print this message:
Bạn có thể chạy Jest trực tiếp từ CLI (nếu nó có sẵn trên toàn cầu trong PATH của bạn, ví dụ: bằng fiber global add jest hoặc npm install jest --global) với nhiều tùy chọn hữu ích.
Run all tests (default)
Run all sum.test.js
Based on your project, Jest will ask you a few questions and will create a basic configuration file with a short description for each option:
Configure Babel to target your current version of Node by creating a babel.config.js
file in the root of your project:
If you'd like to learn more about running jest
through the command line, take a look at the page.
To use , install required dependencies via yarn
: