@liutsing/mock-extend
v0.0.3
Published
A lib to extend mockjs Random's methods
Downloads
4
Readme
A lib to extend mockjs Random's methods
usage
import '@liutsing/mock-extend'
import { Random } from 'mockjs'
// then you can call extended method like Random.unix()
console.log(Random.unix())
Resources
- mockjs, mockjs github
- @mockjs/core, mockjs ts version
test
use babel-test
install dependences
pnpm install --save-dev babel-jest @babel/core @babel/preset-env
# for ts
pnpm install --save-dev @babel/preset-typescript
create babel config file
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript', // ts
],
}
// jest.config.ts
export default {
transform: {
'\\.[jt]sx?$': 'babel-jest',
},
}
use ts-jest
// jest.config.ts
export default {
transform: {
'\\.[jt]sx?$': 'ts-jest',
},
}