Skip to content

API-Client pipeline not failing on broken unit tests #144

Open
@pfwd

Description

@pfwd

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

Activity

self-assigned this
on Oct 8, 2022
added
bugSomething isn't working
api clientAny thing to do with the API Client
apiAnything to do with the API
on Oct 8, 2022
added this to the API setup milestone on Oct 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

apiAnything to do with the APIapi clientAny thing to do with the API ClientbugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @pfwd

      Issue actions

        API-Client pipeline not failing on broken unit tests · Issue #144 · howToCodeWell/code-quiz