zooniverse / front-end-monorepo

A rebuild of the front-end for zooniverse.org
https://www.zooniverse.org
Apache License 2.0
104 stars 30 forks source link

Tests are broken in Docker #2356

Open eatyourgreens opened 3 years ago

eatyourgreens commented 3 years ago

Package

all

Describe the bug

yarn test fails, for any package, in a local dev Docker image (front-end-monorepo_dev) because the webpack build environment and Panoptes API environment (NODE_ENV and PANOPTES_ENV) are both set to production.

To Reproduce

Steps to reproduce the behavior:

  1. Build fresh images to get the latest changes: docker compose build.
  2. Run a shell in a container with the development image: docker compose run --rm shell
  3. Run the tests and watch them fail because the tests expect a test environment: yarn test or yarn test:ci.
  4. Exit the shell and shut down: docker compose down.

Expected behavior

Tests should pass.

eatyourgreens commented 3 years ago

Setting PANOPTES_ENV to staging in the container environment fixes the tests for app-project and lib-classifier but the tests for lib-panoptes-js assume that PANOPTES_ENV is undefined. See https://github.com/zooniverse/front-end-monorepo/issues/1915