Skip to content

local Jest testing fails #533

Open
Open
@JohnAlbin

Description

@JohnAlbin

Jest tests for next-drupal fail when run locally.

Expected behavior

The TESTING.md documentation tells a developer how to run the tests and the local tests run successfully.

Steps to reproduce:

  1. git clone this repo.
  2. Run yarn install
  3. Running yarn test fails all tests with:
FAIL  packages/next-drupal/tests/crud.test.ts
  ● Test suite failed to run

    The 'baseUrl' param is required.

      125 |   constructor(baseUrl: BaseUrl, options: DrupalClientOptions = {}) {
      126 |     if (!baseUrl || typeof baseUrl !== "string") {
    > 127 |       throw new Error("The 'baseUrl' param is required.")
          |             ^
      128 |     }

 FAIL  packages/next-drupal/tests/client.test.ts
  ● Test suite failed to run

    The 'baseUrl' param is required.

      125 |   constructor(baseUrl: BaseUrl, options: DrupalClientOptions = {}) {
      126 |     if (!baseUrl || typeof baseUrl !== "string") {
    > 127 |       throw new Error("The 'baseUrl' param is required.")
          |             ^
      128 |     }

Additional context

It's obvious from the Jest failure messages that there are some missing environment variables. It's also clear from looking at the Jest snapshot file, that the Jest tests are being run against a specific live environment, https://tests.next-drupal.org, and are using specific authentication credentials. So we can't allow developers to have those environment variables.

Developers should be able to have local test fixtures to run tests locally.

Metadata

Metadata

Assignees

Labels

area: next-drupalbugSomething isn't workingtoolingtooling changes (CI, tests, etc.); no code changes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions