Skip to content

test: split test-fs-cp.js#59408

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
joyeecheung:split-fs
Aug 10, 2025
Merged

test: split test-fs-cp.js#59408
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
joyeecheung:split-fs

Conversation

@joyeecheung
Copy link
Copy Markdown
Member

@joyeecheung joyeecheung commented Aug 8, 2025

This test previously squeezed 70+ test cases into one single file and has been constantly crashing on Windows with exit code 3221226505 and no stack trace. As it is already marked as flaky there is no way to understand which test case is failing and the Windows CI was constantly orange. This patch splits the test cases into different files so it's easier to find out which case is exactly failing and to be skipped.

Refs: #56794

This test previously squeezed 70+ test cases into one single file
and has been constantly crashing on Windows with exit code
3221226505 and no stack trace. As it is already marked as flaky
there is no way to understand which test case is failing and
the Windows CI was constantly orange. This patch splits the
test cases into different files so it's easier to find out
which case is exactly failing and to be skipped.
@joyeecheung joyeecheung marked this pull request as ready for review August 8, 2025 16:01
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Aug 8, 2025
@joyeecheung
Copy link
Copy Markdown
Member Author

Windows CI to figure out who is crashing: https://ci.nodejs.org/job/node-test-commit-windows-fanned/72339/

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.90%. Comparing base (f3adc11) to head (83d3b6b).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59408      +/-   ##
==========================================
+ Coverage   89.79%   89.90%   +0.11%     
==========================================
  Files         653      655       +2     
  Lines      192394   192829     +435     
  Branches    37650    37793     +143     
==========================================
+ Hits       172753   173369     +616     
+ Misses      12270    12013     -257     
- Partials     7371     7447      +76     

see 59 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@himself65 himself65 added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 9, 2025
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 9, 2025
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@joyeecheung
Copy link
Copy Markdown
Member Author

joyeecheung commented Aug 9, 2025

7 split test cases have failed on Windows. I noticed that there have been quite a lot of changes to fs.cpSync even after the test has been marked as flaky #56799 - for the purpose of this PR, I will just mark them as flaky. But it deserves more investigation because the tests could've already been broken by the recent changes and they were just ignored due to the flaky status. cc @dario-piotrowicz

See failures
not ok 339 parallel/test-fs-cp-sync-error-on-exist
  ---
  duration_ms: 267.00200
  severity: fail
  exitcode: 1
  stack: |-
    node:internal/modules/run_main:107
        triggerUncaughtException(
        ^
    
    AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
    + actual - expected
    
      Comparison {
    +   code: ''
    -   code: 'ERR_FS_CP_EEXIST'
      }
    
        at file:///c:/workspace/node-test-binary-windows-js-suites/node/test/parallel/test-fs-cp-sync-error-on-exist.mjs:14:8
        at ModuleJob.run (node:internal/modules/esm/module_job:371:25)
        at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:669:26)
        at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
      generatedMessage: true,
      code: 'ERR_ASSERTION',
      actual: Error: , The file exists. '\\?\c:\workspace\node-test-binary-windows-js-suites\node\test\.tmp.339\copy_%1\a\b'
          at copyDir (node:internal/fs/cp/cp-sync:145:22)
          at onDir (node:internal/fs/cp/cp-sync:137:10)
          at getStats (node:internal/fs/cp/cp-sync:68:12)
          at cpSyncFn (node:internal/fs/cp/cp-sync:58:10)
          at cpSync (node:fs:3123:3)
          at assert.throws.code (file:///c:/workspace/node-test-binary-windows-js-suites/node/test/parallel/test-fs-cp-sync-error-on-exist.mjs:15:9)
          at getActual (node:assert:584:5)
          at ok.throws (node:assert:732:24)
          at file:///c:/workspace/node-test-binary-windows-js-suites/node/test/parallel/test-fs-cp-sync-error-on-exist.mjs:14:8
          at ModuleJob.run (node:internal/modules/esm/module_job:371:25) {
        errno: 80,
        code: '',
        path: '\\\\?\\c:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.339\\copy_%1\\a\\b',
        syscall: 'cp'
      },
      expected: { code: 'ERR_FS_CP_EEXIST' },
      operator: 'throws',
      diff: 'simple'
    }
    
    Node.js v25.0.0-pre
  ...

not ok 337 parallel/test-fs-cp-sync-copy-symlink-not-pointing-to-folder
  ---
  duration_ms: 154.00100
  severity: fail
  exitcode: 1
  stack: |-
    node:internal/modules/run_main:107
        triggerUncaughtException(
        ^
    
    AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
    + actual - expected
    
    + 'C:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.337\\copy_%1'
    - 'c:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.337\\copy_%1'
    
        at file:///c:/workspace/node-test-binary-windows-js-suites/node/test/parallel/test-fs-cp-sync-copy-symlink-not-pointing-to-folder.mjs:19:8
        at ModuleJob.run (node:internal/modules/esm/module_job:371:25)
        at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:669:26)
        at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
      generatedMessage: true,
      code: 'ERR_ASSERTION',
      actual: 'C:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.337\\copy_%1',
      expected: 'c:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.337\\copy_%1',
      operator: 'strictEqual',
      diff: 'simple'
    }
    
    Node.js v25.0.0-pre
  ...

not ok 343 parallel/test-fs-cp-sync-symlink-points-to-dest-error
  ---
  duration_ms: 172.00200
  severity: fail
  exitcode: 1
  stack: |-
    node:internal/modules/run_main:107
        triggerUncaughtException(
        ^
    
    AssertionError [ERR_ASSERTION]: Missing expected exception.
        at file:///c:/workspace/node-test-binary-windows-js-suites/node/test/parallel/test-fs-cp-sync-symlink-points-to-dest-error.mjs:17:8
        at ModuleJob.run (node:internal/modules/esm/module_job:371:25)
        at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:669:26)
        at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
      generatedMessage: false,
      code: 'ERR_ASSERTION',
      actual: undefined,
      expected: { code: 'ERR_FS_CP_EINVAL' },
      operator: 'throws',
      diff: 'simple'
    }
    
    Node.js v25.0.0-pre
  ...

not ok 344 parallel/test-fs-cp-sync-resolve-relative-symlinks-false
  ---
  duration_ms: 184.00600
  severity: fail
  exitcode: 1
  stack: |-
    node:internal/modules/run_main:107
        triggerUncaughtException(
        ^
    
    AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
    + actual - expected
    
    + 'C:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.343\\copy_%1\\foo.js'
    - 'c:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.343\\copy_%1\\foo.js'
    
        at file:///c:/workspace/node-test-binary-windows-js-suites/node/test/parallel/test-fs-cp-sync-resolve-relative-symlinks-false.mjs:21:8
        at ModuleJob.run (node:internal/modules/esm/module_job:371:25)
        at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:669:26)
        at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
      generatedMessage: true,
      code: 'ERR_ASSERTION',
      actual: 'C:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.343\\copy_%1\\foo.js',
      expected: 'c:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.343\\copy_%1\\foo.js',
      operator: 'strictEqual',
      diff: 'simple'
    }
    
    Node.js v25.0.0-pre
  ...

not ok 335 parallel/test-fs-cp-async-symlink-points-to-dest
  ---
  duration_ms: 197.00000
  severity: fail
  exitcode: 1
  stack: |-
    file:///c:/workspace/node-test-binary-windows-js-suites/node/test/parallel/test-fs-cp-async-symlink-points-to-dest.mjs:19
      assert.strictEqual(err.code, 'ERR_FS_CP_EINVAL');
                             ^
    
    TypeError: Cannot read properties of null (reading 'code')
        at file:///c:/workspace/node-test-binary-windows-js-suites/node/test/parallel/test-fs-cp-async-symlink-points-to-dest.mjs:19:26
        at c:\workspace\node-test-binary-windows-js-suites\node\test\common\index.js:437:15
        at node:fs:180:23
        at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
    
    Node.js v25.0.0-pre
  ...

not ok 346 parallel/test-fs-cp-sync-unicode-folder-names
  ---
  duration_ms: 271.00300
  severity: fail
  exitcode: 3221226505
  stack: |-
  ...

not ok 343 parallel/test-fs-cp-sync-resolve-relative-symlinks-default
  ---
  duration_ms: 173.00700
  severity: fail
  exitcode: 1
  stack: |-
    node:internal/modules/run_main:107
        triggerUncaughtException(
        ^
    
    AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
    + actual - expected
    
    + 'C:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.342\\copy_%1\\foo.js'
    - 'c:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.342\\copy_%1\\foo.js'
    
        at file:///c:/workspace/node-test-binary-windows-js-suites/node/test/parallel/test-fs-cp-sync-resolve-relative-symlinks-default.mjs:21:8
        at ModuleJob.run (node:internal/modules/esm/module_job:371:25)
        at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:669:26)
        at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
      generatedMessage: true,
      code: 'ERR_ASSERTION',
      actual: 'C:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.342\\copy_%1\\foo.js',
      expected: 'c:\\workspace\\node-test-binary-windows-js-suites\\node\\test\\.tmp.342\\copy_%1\\foo.js',
      operator: 'strictEqual',
      diff: 'simple'
    }
    
    Node.js v25.0.0-pre
  ...

Details

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@joyeecheung
Copy link
Copy Markdown
Member Author

joyeecheung commented Aug 9, 2025

FWIW in the 7 failed test cases, I can reproduce the 3 involving errors locally, I think they are just test cases being broken by recent changes without being noticed. The ones related to readlinkSync not returning an expected result (drive letters with different case) might have been breakages from readlink and specific to the setup of the CI machines. I don't know what's going on with the crashes with exist code 3221226505 but I cannot reproduce them.

@jasnell
Copy link
Copy Markdown
Member

jasnell commented Aug 9, 2025

Thank you for doing this!!! Sorely needed and it's been on my todo list for a while but just hadn't been able to find time. One suggestion that hopefully might make this easier... let's split this into two PRs... One PR containing all of the separated out tests that are not problematic at all, that we can hopefully get landed easily, and another PR that just separates the tests that are known to be problematic. That should (hopefully) make it at least a little bit easier to focus on just the tests that highlight problems.

@jasnell
Copy link
Copy Markdown
Member

jasnell commented Aug 9, 2025

@joyeecheung ... one thing to point out on some of the cp-sync errors. I noticed that in manual testing that at least a couple of the error messages themselves were incorrect due to argument order on the error construction being reversed but the tests were missing it entirely because the tests weren't looking at the error messages, only the codes. It was specifically cpSync that I saw this on but, again, due to just pure lack of available time, I haven't had a moment to correct it yet.

@joyeecheung
Copy link
Copy Markdown
Member Author

joyeecheung commented Aug 9, 2025

One PR containing all of the separated out tests that are not problematic at all, that we can hopefully get landed easily, and another PR that just separates the tests that are known to be problematic.

Are you referring to one PR or one file? I don't think it's wise to continue keeping them in one file, that just repeats the mistake of keeping them in a monolith. This PR just splits all of them and marked the ones that have failed as flaky, if it's good enough for the Windows CI to not be red we can just go from there - people who have time to fix the individual flakes can just start fixing them in follow up PRs. If there are any more failures we can just mark individual test cases as flaky without disabling others. But if we keep them in one file, there will be a lot more churn than just adding an entry to the status file if there are still flakes in the monolith.

@nodejs-github-bot
Copy link