Skip to content

[rush] Jest watch mode doesn't work #2440

Open

Description

Summary

I was trying to use jest's --watch mode but the tasks exits as soon as it starts.

Repro steps

Add a jest autoinstaller and install jest

Add a test somewhere

Add this to config/rush/command-line.json

{
  "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/command-line.schema.json",
  "commands": [
    {
      "name": "test",
      "commandKind": "global",
      "summary": "Jest tests.",
      "autoinstallerName": "rush-jest",
      "shellCommand": "jest"
    },
    {
      "name": "test:watch",
      "commandKind": "global",
      "summary": "Watch Jest tests.",
      "autoinstallerName": "rush-jest",
      "shellCommand": "jest --watch"
    }
  ]
}

Run rush jest:watch

Expected result: Jest to enter watch mode and run the tests

Actual result: <Command fails

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.36.1
rushVersion from rush.json? 5.36.1
useWorkspaces from rush.json? No
Operating system? Mac
Would you consider contributing a PR? Yes
Node.js version (node -v)? 12.19.0

Activity

  1. octogonz commented on Jan 18, 2021

    @octogonz
    Collaborator

    Please provide more information. (For example, instead of <Command fails, maybe you can share an error message?)

    The best way to get issues investigated quickly is to provide a GitHub branch with instructions for reproducing an error.

  2. octogonz commented on Mar 9, 2021

    @octogonz
    Collaborator

    Tom Sherman (@tom-sherman) Were you able to prepare a branch that repros this issue? If not, we should close this.

  3. rulliva commented on Aug 19, 2021

    @rulliva

    I suspect that is failing due to calling "rush jest", as the name given is "test", running "rush test" / "rush test:watch" should be fine, i was quickly trying and is working. At that point you should have a root jest.config or it will not run.

    I think it should be better to just build upon heft lib to implement that, calling the start.js from node_modules heft lib in the scope, so you have all the transformations done by heft to execute tests where you need

  4. moved this to Waiting for Author in Bug Triageon Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infoWe can't proceed because we need a better repro or an answer to a question

    Type

    No type

    Projects

    • Status
      Waiting for Author

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions