-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Expand file tree
/
Copy pathtest-fs-cp-filter.js
More file actions
34 lines (27 loc) · 943 Bytes
/
test-fs-cp-filter.js
File metadata and controls
34 lines (27 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';
// This test will fail because the the implementation does not properly
// handle the case when the `src` or `dest` is a Buffer and the `filter`
// function is utilized when recursively copying directories.
// Refs: https://github.com/nodejs/node/issues/58634
// Refs: https://github.com/nodejs/node/issues/58869
const common = require('../common');
const {
cpSync,
mkdirSync,
} = require('fs');
const {
join,
} = require('path');
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
const pathA = join(tmpdir.path, 'a');
const pathAC = join(pathA, 'c');
const pathB = join(tmpdir.path, 'b');
mkdirSync(pathAC, { recursive: true });
cpSync(Buffer.from(pathA), Buffer.from(pathB), {
recursive: true,
// This should be called multiple times, once for each file/directory,
// but it's only called once in this test because we're expecting this
// to fail.
filter: common.mustCall(() => true, 1),
});