doc: improve javascript testing in docker
Some instructions were outdated and/or incorrect. Trying to clean things up. Test Plan: * qa-cr * I tested all these changes but feel free to run the new instructions if you like Change-Id: Iba15c22aff20e2949c19c95a7e2e5b05e6204614 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/311069 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com> Reviewed-by: Jacob DeWar <jacob.dewar@instructure.com> Reviewed-by: Caleb Guanzon <cguanzon@instructure.com> QA-Review: Caleb Guanzon <cguanzon@instructure.com> Product-Review: Caleb Guanzon <cguanzon@instructure.com> Build-Review: Andrea Cirulli <andrea.cirulli@instructure.com>
This commit is contained in:
parent
52f54e84f2
commit
e9910ee742
|
@ -205,16 +205,15 @@ First add `docker-compose/js-tests.override.yml` to your `COMPOSE_FILE` var in
|
|||
`.env`. Then prepare that container with:
|
||||
|
||||
```
|
||||
docker-compose up -d js-tests
|
||||
docker-compose exec js-tests yarn install
|
||||
docker-compose run --rm js-tests yarn install
|
||||
```
|
||||
|
||||
If you run into issues with that command, either during initial setup or after
|
||||
If you run into issues with `yarn install`, either during initial setup or after
|
||||
updating master, try to fix it with a `nuke_node`:
|
||||
|
||||
```
|
||||
docker-compose exec js-tests ./script/nuke_node.sh
|
||||
docker-compose exec js-tests yarn install
|
||||
docker-compose run --rm js-tests ./script/nuke_node.sh
|
||||
docker-compose run --rm js-tests yarn install
|
||||
```
|
||||
|
||||
### QUnit Karma Tests in Headless Chrome
|
||||
|
@ -222,14 +221,21 @@ docker-compose exec js-tests yarn install
|
|||
Run all QUnit tests in watch mode with:
|
||||
|
||||
```
|
||||
docker-compose exec js-tests
|
||||
docker-compose up js-tests
|
||||
```
|
||||
|
||||
Or, if you're iterating on something and want to just run a targeted test file
|
||||
in watch mode, set the `JSPEC_PATH` env var, e.g.:
|
||||
|
||||
```
|
||||
docker-compose exex -e JSPEC_PATH=spec/coffeescripts/util/deparamSpec.js js-tests
|
||||
export JSPEC_PATH=spec/coffeescripts/util/deparamSpec.js
|
||||
docker-compose up js-tests
|
||||
```
|
||||
|
||||
To run a targeted test without watch mode:
|
||||
|
||||
```
|
||||
docker-compose run --rm -e JSPEC_PATH=spec/coffeescripts/util/deparamSpec.js js-tests yarn test:karma:headless
|
||||
```
|
||||
|
||||
### Jest Tests
|
||||
|
@ -237,14 +243,20 @@ docker-compose exex -e JSPEC_PATH=spec/coffeescripts/util/deparamSpec.js js-test
|
|||
Run all Jest tests with:
|
||||
|
||||
```
|
||||
docker-compose exec js-tests yarn test:jest
|
||||
docker-compose run --rm js-tests yarn test:jest
|
||||
```
|
||||
|
||||
Or to run a targeted subset of tests in watch mode, use `test:jest:watch` and
|
||||
Or run a targeted subset of tests:
|
||||
|
||||
```
|
||||
docker-compose run --rm js-tests yarn test:jest ui/features/speed_grader/react/__tests__/CommentArea.test.js
|
||||
```
|
||||
|
||||
To run a targeted subset of tests in watch mode, use `test:jest:watch` and
|
||||
specify the paths to the test files as one or more arguments, e.g.:
|
||||
|
||||
```
|
||||
docker-compose exec js-tests yarn test:jest:watch app/jsx/actAs/__tests__/ActAsModal.test.js
|
||||
docker-compose run --rm js-tests yarn test:jest:watch ui/features/speed_grader/react/__tests__/CommentArea.test.js
|
||||
```
|
||||
|
||||
## Selenium
|
||||
|
|
|
@ -14,6 +14,7 @@ services:
|
|||
- tmp:/usr/src/app/tmp
|
||||
- yarn-cache:/home/docker/.cache/yarn
|
||||
environment:
|
||||
JSPEC_PATH: ${JSPEC_PATH}
|
||||
NODE_ENV: CI
|
||||
command: yarn run test:karma:watch:headless
|
||||
volumes:
|
||||
|
|
Loading…
Reference in New Issue