From 6aaf0533d7b04d9de5567f5ac9d5c4e8cfaa2f98 Mon Sep 17 00:00:00 2001 From: TheThing Date: Thu, 28 Sep 2023 10:02:47 +0000 Subject: [PATCH] Update 'README.md' --- README.md | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) 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: