-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**New Features** * Supports TypeScript out of the box * Supports `import` syntax out of the box * Better assert failure messages * Stack traces point to the line in readme with the failing assert * exits with code 1 when no tests found **BREAKING CHANGES** * Dropped support for Node < 8 * Code blocks must be tagged with `test`, see readme for examples. To get the old behavior add `--auto` argument * Does not read babelrc file by default. Add `--babel` flag to enable it.
- Loading branch information
Showing
69 changed files
with
15,819 additions
and
1,813 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
language: node_js | ||
before_script: | ||
- "npm run lint" | ||
node_js: | ||
- "10" | ||
- "8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = num => Math.pow(num, 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"private": true, | ||
"name": "@laat/auto", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"scripts": { | ||
"test": "readme-assert --auto" | ||
}, | ||
"devDependencies": { | ||
"readme-assert": "^5.0.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# auto discover test blocks | ||
|
||
The default behavior is to detect code blocks tagged with `test`: | ||
|
||
```` | ||
```js test | ||
1 + 1 // => 1 | ||
``` | ||
```` | ||
|
||
We can also try to infer the tests to run with the `--auto` flag, which tries tries to find magic comments `//=>` in the documentation. | ||
|
||
```` | ||
```js | ||
1 + 1 // => 1 | ||
``` | ||
```` | ||
|
||
### Command | ||
|
||
``` | ||
readme-assert --auto | ||
``` | ||
|
||
```` | ||
```js | ||
const pow2 = require("@laat/auto"); | ||
pow2(2); //=> 4 | ||
pow2(4); //=> 16 | ||
``` | ||
```` | ||
|
||
```js | ||
const pow2 = require("@laat/auto"); | ||
pow2(2); //=> 4 | ||
pow2(4); //=> 16 | ||
``` |
Oops, something went wrong.