mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

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. PR-URL: https://github.com/nodejs/node/pull/59408 Refs: https://github.com/nodejs/node/issues/56794 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
// This tests that fs.promises.cp() copies a nested folder structure with mode flags.
|
|
// This test is based on fs.promises.copyFile() with `COPYFILE_FICLONE_FORCE`.
|
|
|
|
import { mustNotMutateObjectDeep } from '../common/index.mjs';
|
|
import assert from 'node:assert';
|
|
import { promises as fs, constants } from 'node:fs';
|
|
import { assertDirEquivalent, nextdir } from '../common/fs.js';
|
|
import tmpdir from '../common/tmpdir.js';
|
|
import fixtures from '../common/fixtures.js';
|
|
|
|
tmpdir.refresh();
|
|
|
|
const src = fixtures.path('copy/kitchen-sink');
|
|
const dest = nextdir();
|
|
let p = null;
|
|
let successFiClone = false;
|
|
try {
|
|
p = await fs.cp(src, dest, mustNotMutateObjectDeep({
|
|
recursive: true,
|
|
mode: constants.COPYFILE_FICLONE_FORCE,
|
|
}));
|
|
successFiClone = true;
|
|
} catch (err) {
|
|
// If the platform does not support `COPYFILE_FICLONE_FORCE` operation,
|
|
// it should enter this path.
|
|
assert.strictEqual(err.syscall, 'copyfile');
|
|
assert(err.code === 'ENOTSUP' || err.code === 'ENOTTY' ||
|
|
err.code === 'ENOSYS' || err.code === 'EXDEV');
|
|
}
|
|
|
|
if (successFiClone) {
|
|
// If the platform support `COPYFILE_FICLONE_FORCE` operation,
|
|
// it should reach to here.
|
|
assert.strictEqual(p, undefined);
|
|
assertDirEquivalent(src, dest);
|
|
}
|