diff --git a/DEVELOPER.md b/DEVELOPER.md index c7201fd74c..ccca430233 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -29,7 +29,45 @@ Run `yarn lint --fix` to fix any automatically fixable lint issues and report th ## Running tests -To run unit tests, run `yarn test`. +To run unit tests, run `yarn test`. This will run the full test suite with client side rendering +and server side rendering with and without hydration. +During development it is preferable to run `yarn test:csr`, which will just run the client side +rendering. + +### Debugging with Visual Studio Code + +It is possible to debug tests and/or run them in isolation with Visual Studio Code. +The following code snippet can be placed in `.vscode/launch.json`. +Replace `test:csr` with either `test:ssr:hydrated` or `test:ssr:non-hydrated` to test SSR. +Add the `--debug` param to enable breakpoint debugging and the detailed test report. + +```json + ... + { + "name": "Test", + "request": "launch", + "runtimeArgs": ["test:csr", "${relativeFile}", "--watch"], + "runtimeExecutable": "yarn", + "skipFiles": ["/**"], + "type": "node", + "console": "integratedTerminal" + }, + ... +``` + +### Debugging with IntelliJ + +It is possible to debug tests and/or run them in isolation also with Intellij IDEA. +From the title bar, open the 'Run' menu, then select 'Edit configuration'. +Create and save a new `npm` configuration with the following parameters, +possibly replacing `test:csr` with either `test:ssr:hydrated` or `test:ssr:non-hydrated` to test SSR: + +- Command: `run` +- Scripts: `test:csr` +- Arguments: `**/$FileName$ --watch` + +Finally, open the file you want to test and run the script. +Add the `--debug` param to enable breakpoint debugging and the detailed test report. ## Starting showcase diff --git a/package.json b/package.json index 71f2422648..5e973ee57f 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "start": "storybook dev -p 6006", "test": "wtr --coverage", "test:snapshot": "yarn test --ci --update-snapshots", + "test:csr": "wtr --group default", "test:ssr:hydrated": "wtr --group e2e-ssr-hydrated", "test:ssr:non-hydrated": "wtr --group e2e-ssr-non-hydrated", "prepare": "husky install"