Skip to content
File

Blob: src/workerd/api/node/tests/fs-cp-into-subdirectory-test.js

javascript23 lines
1// Copyright (c) 2026 Cloudflare, Inc.
2// Licensed under the Apache 2.0 license found in the LICENSE file or at:
3// https://opensource.org/licenses/Apache-2.0
4import { cpSync, mkdirSync, writeFileSync } from 'node:fs';
5import { throws } from 'node:assert';
6 
7export const FsCpIntoSubdirectory = {
8 test() {
9 mkdirSync(new URL('file:///tmp/src'), { recursive: true });
10 writeFileSync(new URL('file:///tmp/src/file.txt'), 'test');
11 
12 throws(
13 () =>
14 cpSync(new URL('file:///tmp/src'), new URL('file:///tmp/src/dest'), {
15 recursive: true,
16 }),
17 {
18 code: 'ERR_FS_CP_EINVAL',
19 }
20 );
21 },
22};