mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Enable node:vfs by default. --no-experimental-vfs disables node:vfs exposure and --vfs-load. Assisted-by: pi Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/66318 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
25 lines
658 B
JavaScript
25 lines
658 B
JavaScript
// Flags: --disable-warning=ExperimentalWarning
|
|
'use strict';
|
|
|
|
// Hard-link error cases: creating a link to a directory or to an
|
|
// already-existing path.
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const vfs = require('node:vfs');
|
|
|
|
// Linking to a directory throws EINVAL
|
|
{
|
|
const myVfs = vfs.create();
|
|
myVfs.mkdirSync('/d');
|
|
assert.throws(() => myVfs.linkSync('/d', '/d-link'), { code: 'EINVAL' });
|
|
}
|
|
|
|
// Linking to an existing target throws EEXIST
|
|
{
|
|
const myVfs = vfs.create();
|
|
myVfs.writeFileSync('/a.txt', 'x');
|
|
myVfs.writeFileSync('/b.txt', 'y');
|
|
assert.throws(() => myVfs.linkSync('/a.txt', '/b.txt'), { code: 'EEXIST' });
|
|
}
|