Skip to content

Jest execution is not exiting on npx run without package.json file #120

Open
@benophilipmathew

Description

@benophilipmathew

Hi Guys,

Recently I was setting up azure release pipeline for my jest tests and found that the task execution is not exiting while running jest through npx. Later I found jest-junit reporter is causing this issue.

However, the interesting part is npx run with an empty package.json file will work as expected

Note - This is only happening with jest-junit package if we run without jest-junit it will run fine

How to reproduce-

step 1 - git clone https://[email protected]/benophilipmathew_dl/jest-junit-issue.git
step 2 - npm i jest jest-junit
step 3 - npx jest --maxWorkers=1 --forceExit

I am using node - 13.3.0 but I guess, it's the same with all other versions

expected result - test execution should stop after a successful run
actual result - test execution will never stop

How I fixed this - added an empty (i.e. {}) package.json in the working folder and it started working as expected

Any idea why the empty package.json file is doing this magic?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions