Skip to content

[Bug]: Jest cannot run tests in Sapling repos with invalid JSON backups #13673

Closed

Description

Version

41bf230 (main)

Steps to reproduce

sl clone git@github.com:facebook/jest.git # or git clone git@github.com:facebook/jest.git
cd jest
yarn
cd examples/getting-started
yarn
mkdir -pv .sl/origbackups/
echo "aoeu}{" > .sl/origbackups/package.json
node ../../packages/jest-cli/bin/jest.js

Expected behavior

expected: tests pass successfully

Actual behavior

actual:

❯ node ../../packages/jest-cli/bin/jest.js                                                                           ─╯
Error: Cannot parse /Users/m0c0j7y/workspace/github.com/facebook/jest/examples/getting-started/.sl/origbackups/package.json as JSON: Unexpected token 'a', "aoeu}{
" is not valid JSON
    at Object.worker (/Users/m0c0j7y/workspace/github.com/facebook/jest/packages/jest-haste-map/build/worker.js:128:13)
    at execFunction (/Users/m0c0j7y/workspace/github.com/facebook/jest/packages/jest-worker/build/workers/processChild.js:130:17)
    at execHelper (/Users/m0c0j7y/workspace/github.com/facebook/jest/packages/jest-worker/build/workers/processChild.js:
118:5)
    at execMethod (/Users/m0c0j7y/workspace/github.com/facebook/jest/packages/jest-worker/build/workers/processChild.js:121:5)
    at process.messageListener (/Users/m0c0j7y/workspace/github.com/facebook/jest/packages/jest-worker/build/workers/processChild.js:44:7)
    at process.emit (node:events:513:28)
    at emit (node:internal/child_process:944:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Additional context

I have tested this on multiple versions of jest

Environment

❯ npx envinfo --preset jest                                                                                          ─╯

  System:
    OS: macOS 12.6.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Binaries:
    Node: 19.2.0 - /usr/local/bin/node
    Yarn: 3.3.0 - /usr/local/bin/yarn
    npm: 9.2.0 - /usr/local/bin/npm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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