JEST

碎碎念

虽然一直很看好 TDD 的开发流程,但以此作为实践实在有些难。

Jest 目录

作为一个初学者,最令人困惑的莫过于 “我怎么知道要测试些什么”、“我可以测试些什么”,而抄一遍 jest 目录可以帮助缓解一下困惑:

.
├── Introduction
│   ├── Getting started
│   ├── Using Matchers
│   ├── Testing Asyncronous Code
│   ├── Setup and Teardown
│   ├── Mock Function
│   ├── Jest Platform
│   ├── Jest Community
│   └── More Resources
├── Guides
│   ├── Snapshot Testing
│   ├── An Async Example
│   ├── Timer Mocks
│   ├── Manual Mocks
│   ├── ES6 Class Mocks
│   ├── Bypassing module mocks
│   ├── ECMAScript Modules
│   ├── Using with webpack
│   ├── Using with puppeteer
│   ├── Using with MongoDB
│   ├── Using with DynamoDB
│   ├── DOM Mnaipulation
│   ├── Watch Plugins
│   ├── Migrating to Jest
│   ├── Troubleshooting
│   └── Architecture
├── Framework Guides
│   ├── Testing React Apps
│   ├── Testing React Native Apps
│   └── Testing Web Frameworks
└── API Reference
    ├── Globals
    ├── Expect
    ├── Mock Functions
    ├── The Jest Object
    ├── Configuring Jest
    ├── Jest Cli Options
    └── Environment Variables

参考资料

  1. jestjs.ioopen in new window
  2. Vue Test Utilsopen in new window
  3. ts-jestopen in new window
  4. javascript-testing-best-practicesopen in new window