From 3e5f1fabad6625d3798c4210f700f6b79342e4ef Mon Sep 17 00:00:00 2001 From: Joe Skeen Date: Wed, 5 Aug 2020 10:52:49 -0600 Subject: [PATCH] [dev] Add unified {build,test} watch mode, using "concurrently" (#1011) I noticed that the development README suggested using multiple console windows/tabs for a good development experience. Using the package `concurrently`, we can streamline that and require only one window with output for both watch processes: ![image](https://user-images.githubusercontent.com/12286274/88694827-477d9e80-d0be-11ea-898c-ee9a509db4bb.png) Co-authored-by: Ronan Jouchet --- docs/development.md | 8 +++++--- package.json | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/development.md b/docs/development.md index 6376478..eaedbb0 100644 --- a/docs/development.md +++ b/docs/development.md @@ -40,7 +40,8 @@ After doing so, you can run Nativefier with your test parameters: nativefier --your-awesome-new-flag 'https://your-test-site.com' ``` -Then run your nativefier app *through the command line too* (to see logs & errors): +Then run your nativefier app _through the command line too_ (to see logs & errors): + ```bash # Under Linux ./your-test-site-linux-x64/your-test-site @@ -67,5 +68,6 @@ but is painful to do manually. Do yourself a favor and install a - Logging is suppressed by default in tests, to avoid polluting Jest output. To get debug logs, `npm run test:withlog` or set the `LOGLEVEL` env. var. - For a good live experience, open two terminal panes/tabs running code/tests watchers: - 1. Run a TSC watcher: `npm run build:watch` - 2. Run a Jest unit tests watcher: `npm run test:watch` + 1. Run a TSC watcher: `npm run build:watch` + 2. Run a Jest unit tests watcher: `npm run test:watch` +- Alternatively, you can run both test processes in the same terminal by running: `npm run watch` diff --git a/package.json b/package.json index 9fc30bd..a2f905c 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,8 @@ "test:unit": "jest", "test:watch": "jest --watch", "test:withlog": "LOGLEVEL=trace npm run test", - "test": "jest --testRegex '[-.]test\\.js$'" + "test": "jest --testRegex '[-.]test\\.js$'", + "watch": "npx concurrently \"npm:*:watch\"" }, "dependencies": { "@types/cheerio": "0.x",