利用 TypeScript 4.1 递归条件类型改进 Jest-each 表驱动测试类型
利用 TypeScript 4.1 中的递归条件类型,jest-each-improved-types
改进了表驱动 Jest 每次测试的类型系统。安装此包:npm install -D @wistudent/jest-each-improved-types
。并在 tsconfig.json
中添加:{ "files": ["node_modules/@wistudent/jest-each-improved-types/index.d.ts"] }
。使用示例:
type Variables = [ [ 'note' , string ] , [ 'given' , string ] , [ 'expected' , boolean ] ]
test . each < Variables> ` note | given | expected ${ 'true' } | ${ 'ok' }
jest-each-improved-types-master.zip
预估大小:13个文件
jest-each-improved-types-master
文件夹
.gitignore
13B
package.json
877B
example.test.ts
339B
package-lock.json
432KB
jest.config.js
6KB
tsconfig.json
6KB
.github
文件夹
workflows
文件夹
build-test-publish-on-version-tag copy.yml
515B
74.47KB
文件大小:
评论区