Make testing is intuitional and convenient in comment, markdown, jsdoc @example comment and so on.
const add = (a, b) => a + b
// looseEqual
add(1, 1) // => 2
const a = {}
// strictEqual
a // ==> a
// not looseEqual
;[{}] // != {}
// not strictEqual
;[{ abc: 'abc' }]
/* !== [
{abc: 'abc'}
] */
const addAsync = (a, b) => Promise.resolve(a + b)
// async resolve value
addAsync(1, 1) // => Promise<2>
intuitional-test use babel-preset-intuitional-test
transforming the above syntax as some assertions.
For example:
- Input
const add = (a, b) => a + b
// looseEqual
add(1, 1) // => 2
- Output
const add = (a, b) => a + b
assert.deepEqual(add(1, 1), 2, "looseEqual")
This is a case of transforming, It's different with intuitional-test-babel-jest
.
- Output
const add = (a, b) => a + b
describe('filename ...', () => {
it("looseEqual", () => {
expect(add(1, 1)).toEqual(2)
})
})
So we could run intuitional test in jest
by intuitional-test-babel-jest
transformer or my-runner
by preset.
Even writing intuitional test in markdown and jsdoc.
- Markdown
```javascript namespace=test
1 + 2 // => 3
```
- JSDoc
/**
* @name add
* @example
* add(1, 2) // => 3
*/
const add = (a, b) => a + b
- Fork it!
- Create your new branch:
git checkout -b feature-new
orgit checkout -b fix-which-bug
- Start your magic work now
- Make sure npm test passes
- Commit your changes:
git commit -am 'feat: some description (close #123)'
orgit commit -am 'fix: some description (fix #123)'
- Push to the branch:
git push
- Submit a pull request :)
This library is written and maintained by imcuttle, moyuyc95@gmail.com.
MIT - imcuttle 🐟