diff --git a/README.md b/README.md index 93b55d1..2b1fdfe 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,49 @@ $ npm test 1 passing (3ms) ``` -# Assertions +# Watch + +You can also run eltro in watch mode. Update your package.json and add the following: + +```json +{ + /* ... */ + "scripts": { + "test": "eltro", + "test:watch": "eltro --watch my_watch_name", + }, + "watch": { + "my_watch_name": { + "patterns": [ "src", "test" ], + "extensions": "js,mjs" + } + }, + /* ... */ +} +``` + +Then add `--watch my_watch_name` to your eltro command (as seen in the above example) and you're good to go: + +```bash +$ npm test:watch + + + test/test.mjs + √ Array #indexOf() should return -1 when value is not present + + + 1 passing (3ms) + +[my_watch_name] 09:49:38: Ran successfully. Waiting for file changes before running again... +``` + +You can also run your own npm command while using the eltro file watcher like so: + +```bash +$ eltro --watch my_watch_name --npm build +``` + +# Assertions Not only does eltro allow you to use any assertion library of your own choosing, it also comes with it's own assertion library based on node's default [assert](https://nodejs.org/api/assert.html) with a few extra methods: