howToCodeWell/code-quiz

API-Client pipeline not failing on broken unit tests

Opened this issue · 0 comments

pfwd commented

Describe the bug

API-Client pipeline is not failing correctly when generated openapi spec doesn't exist

This pipeline passed when it failed

yarn run v1.22.19
$ jest
FAIL tests/unit/MockData/htmlAnswers.test.ts
  ● Test suite failed to run

    src/mockData/htmlQuiz/htmlAnswers.ts:1:22 - error TS230[7](https://github.com/howToCodeWell/code-quiz/actions/runs/3211121002/jobs/5249066403#step:6:8): Cannot find module '../../generated/openapi/src' or its corresponding type declarations.

    1 import {Answer} from "../../generated/openapi/src"
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PASS tests/unit/api/apiClient.test.ts
  API Client headers
    ✓ Should have a content type of application/json (2 ms)
    ✓ Should have a accept header with the value application/json
  API Client options
    ✓ Should have the base url of http://localhost:3000

FAIL tests/integration/api/requestHandlers/quizRequest.test.ts
  ● Test suite failed to run

    src/mockData/quiz.ts:1:20 - error TS2307: Cannot find module '../generated/openapi/src' or its corresponding type declarations.

    1 import {Quiz} from "../generated/openapi/src"
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~

FAIL tests/integration/server.test.ts
  ● Test suite failed to run

    src/mockData/quiz.ts:1:[20](https://github.com/howToCodeWell/code-quiz/actions/runs/3211121002/jobs/5249066403#step:6:21) - error TS[23](https://github.com/howToCodeWell/code-quiz/actions/runs/3211121002/jobs/5249066403#step:6:24)07: Cannot find module '../generated/openapi/src' or its corresponding type declarations.

    1 import {Quiz} from "../generated/openapi/src"

Steps to reproduce

  1. Don't generate OpenAPI spec file
  2. Run the unit tests

Expected behavior

Pipeline should of failed

Screenshots and recordings

See https://github.com/howToCodeWell/code-quiz/actions/runs/3211121002/jobs/5249066403

OS / Linux distribution

MacOS

Additional context

No response