Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Node 23 normalizes paths in a way that results in Jest finding no tests #15348

Closed
steveluscher opened this issue Oct 18, 2024 · 5 comments

Comments

@steveluscher
Copy link

steveluscher commented Oct 18, 2024

Version

main branch

Steps to reproduce

yarn jest-jasmine-ci e2e/__tests__/jestChangedFiles.test.ts

Expected behavior

Tests pass.

Actual behavior

includePaths ends up having '../jest-changed-files-test-dir' under Node 23 instead of '.' under Node <=22. This causes git to freak out because the directory is ‘outside the repository.’

/home/sol/src/jest/e2e/__tests__/jestChangedFiles.test.ts

  ● gets changed files for git

    Command failed with exit code 128: git diff --cached --name-only -- nested-dir nested-dir/second-nested-dir ../jest-changed-files-test-dir
    fatal: ../jest-changed-files-test-dir: '../jest-changed-files-test-dir' is outside repository at '/tmp/jest-changed-files-test-dir'

      207 |   ].map(filename => path.resolve(DIR, filename));
      208 |   console.log(roots);
    > 209 |   let {changedFiles: files} = await getChangedFilesForRoots(roots, {});
          |                               ^
      210 |   expect([...files].map(filePath => path.basename(filePath)).sort()).toEqual([
      211 |     'file1.txt',
      212 |     'file2.txt',

      at makeError (node_modules/execa/lib/error.js:60:11)
          at async Promise.all (index 0)
          at async Promise.all (index 0)
      at Object.<anonymous> (e2e/__tests__/jestChangedFiles.test.ts:209:31)

Additional context

This appears to be because of a bug in Node 23, but that's no reason not to try to strip the trailing slash in Jest, defensively. nodejs/node#55448

Environment

System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (64) x64 AMD EPYC 7502P 32-Core Processor
  Binaries:
    Node: 23.0.0 - ~/n/bin/node
    Yarn: 3.8.5 - ~/.local/share/pnpm/yarn
    npm: 10.9.0 - ~/n/bin/npm
  npmPackages:
    jest: workspace:* => 30.0.0-alpha.6
@steveluscher
Copy link
Author

Looks like this has been reverted in Node. nodejs/node#55414

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Nov 17, 2024
Copy link

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

1 similar comment
Copy link

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 17, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 17, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant