Skip to content

Commit

Permalink
Remove karma container from docker-compose.override.yml
Browse files Browse the repository at this point in the history
Test plan:

- Add docker-compose/js-tests.override.yml to COMPOSE_FILE in .env
- docker-compose build js-tests
- docker-compose run --rm js-tests

Change-Id: I6d43cb2da47c1b6985a9fefd9cc23262e5f56233
Reviewed-on: https://gerrit.instructure.com/123284
Tested-by: Jenkins
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Omar Khan <okhan@instructure.com>
  • Loading branch information
Omar Khan committed Aug 18, 2017
1 parent 92a4f9e commit 0fdd64e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
5 changes: 3 additions & 2 deletions doc/docker/developing_with_docker.md
Expand Up @@ -139,10 +139,11 @@ $ docker-compose run --rm web bundle exec rspec spec

## Running javascript tests

To run tests in headless Chrome:
To run tests in headless Chrome, add the `docker-compose/js-tests.override.yml`
to the `COMPOSE_FILE` environment variable in your .env, and run:

```
$ docker-compose run --rm karma yarn run test-headless
$ docker-compose run --rm js-tests
```

### Selenium
Expand Down
17 changes: 17 additions & 0 deletions doc/testing_javascript.md
Expand Up @@ -3,6 +3,23 @@
The process of testing JavaScript sometimes confuses people. This document's goal
is to alleviate that confusion and establish how to run JavaScript tests.

## With Docker and headless Chrome

This is probably the easiest way to run tests, especially for developers that
don't work with Canvas on a regular basis.

Create a `.env` file in the repository root, containing:

```
COMPOSE_FILE=docker-compose.yml:docker-compose.override.yml:docker-compose/js-tests.override.yml
```

Then run:

```
docker-compose run --rm js-tests
```

## With Docker and Webpack

This is becoming the go to standard for running Canvas and compiling your not-JavaScript
Expand Down
6 changes: 0 additions & 6 deletions docker-compose.override.yml
Expand Up @@ -35,12 +35,6 @@ services:
<<: *BASE-ENV
VIRTUAL_HOST: .canvas.docker

karma:
<<: *BASE
build:
context: .
dockerfile: docker-compose/karma/Dockerfile

postgres:
volumes:
- pg_data:/var/lib/postgresql/data
Expand Down
20 changes: 13 additions & 7 deletions docker-compose/js-tests.override.yml
Expand Up @@ -6,12 +6,18 @@ services:
js-tests:
build: ./docker-compose/karma
volumes:
- .:/app
- generated_1:/app/public/javascripts/client_apps
- generated_2:/app/public/dist
- i18nliner_node_modules:/app/gems/canvas_i18nliner/node_modules
- node_modules:/app/node_modules
- quizzes_node_modules:/app/client_apps/canvas_quizzes/node_modules
- selinimum_node_modules:/app/gems/selinimum/node_modules
- .:/usr/src/app
- brandable_css_brands:/usr/src/app/app/stylesheets/brandable_css_brands
- generated_1:/usr/src/app/public/javascripts/client_apps
- generated_2:/usr/src/app/public/dist
- generated_3:/usr/src/app/public/javascripts/compiled
- i18nliner_node_modules:/usr/src/app/gems/canvas_i18nliner/node_modules
- log:/usr/src/app/log
- node_modules:/usr/src/app/node_modules
- quizzes_node_modules:/usr/src/app/client_apps/canvas_quizzes/node_modules
- selinimum_node_modules:/usr/src/app/gems/selinimum/node_modules
- tmp:/usr/src/app/tmp
- yarn-cache:/home/docker/.cache/yarn
environment:
NODE_ENV: CI
command: yarn run test-watch-headless
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -139,6 +139,7 @@
"test": "karma start --single-run",
"test-headless": "karma start --single-run --browsers ChromeHeadlessNoSandbox",
"test-watch": "karma start",
"test-watch-headless": "karma start --browsers ChromeHeadlessNoSandbox",
"preinstall": "script/gem_npm install",
"preupdate": "script/gem_npm update",
"build": "yarn run build:css && yarn run build:js",
Expand Down

0 comments on commit 0fdd64e

Please sign in to comment.