https://github.com/imcuttle/intuitional-test
Make testing is intuitional and convenient in comment, markdown, and so on.
https://github.com/imcuttle/intuitional-test
Last synced: 5 months ago
JSON representation
Make testing is intuitional and convenient in comment, markdown, and so on.
- Host: GitHub
- URL: https://github.com/imcuttle/intuitional-test
- Owner: imcuttle
- License: mit
- Created: 2019-05-14T13:47:21.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T21:47:36.000Z (over 3 years ago)
- Last Synced: 2025-11-27T09:17:38.625Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 2.75 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: License
Awesome Lists containing this project
README
# intuitional-test
[](https://travis-ci.org/imcuttle/intuitional-test)
[](https://codecov.io/github/imcuttle/intuitional-test?branch=master)
[](https://lernajs.io/)
[](https://prettier.io/)
[](https://conventionalcommits.org)
> Make testing is intuitional and convenient in comment, markdown, jsdoc @example comment and so on.
## Syntax
```javascript ns=syntax-definition
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>
```
## How it works?
intuitional-test use [`babel-preset-intuitional-test`](./packages/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`](./packages/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`](./packages/intuitional-test-babel-jest) transformer or [`my-runner`](https://github.com/imcuttle/my-runner) by [preset](./packages/my-runner-preset-intuitional-test).
Even writing intuitional test in markdown and jsdoc.
- Markdown
````markdown
```javascript namespace=test
1 + 2 // => 3
```
````
- JSDoc
```javascript
/**
* @name add
* @example
* add(1, 2) // => 3
*/
const add = (a, b) => a + b
```
## Contributing
- Fork it!
- Create your new branch:
`git checkout -b feature-new` or `git 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)'` or `git commit -am 'fix: some description (fix #123)'`
- Push to the branch: `git push`
- Submit a pull request :)
## Authors
This library is written and maintained by imcuttle, moyuyc95@gmail.com.
## License
MIT - [imcuttle](https://github.com/imcuttle) 🐟