Setting up Karma + RSPEC parallelism

Im putting this out there since it took me a while to figure out.

If you run both rspec test and npm tests (like karma) you can use

  test:
    override:
      - case $CIRCLE_NODE_INDEX in 0) karma start --single-run --browsers Chrome ;; 1) karma start --single-run --browsers Firefox;; esac:
          parallel: true
      - bundle exec rspec --format RspecJunitFormatter --out $CIRCLE_TEST_REPORTS/rspec.xml:
          parallel: true
          files:
            - spec/**/*_spec.rb

for rspec to be run similar to how circle ci would infer its run. and karma to run Chrome in one container and Firefox in the other.

replace karma start --single-run --browsers Chrome with another command if wanted.

4 Likes

Thanks so much for sharing this!