mirror of
https://github.com/affaan-m/ECC.git
synced 2026-11-10 18:16:02 +00:00
test: skip symlink tests when the OS refuses symlink creation
Adds a trySymlink helper that logs the existing skip notice and returns false on EPERM/EACCES/ENOSYS, and uses it where tests created symlinks unguarded. Non-admin Windows accounts without Developer Mode now skip these cases instead of failing.
This commit is contained in:
1 parent
25278e7d7b
commit
09de2c247a
12 files changed
+52
-21
No files matched your search
@@ -9,6 +9,7 @@ const { pathToFileURL } = require('url');
|
||||
const { createManifestInstallPlan, applyInstallPlan, previewInstallPlan } = require('../../scripts/lib/install-executor');
|
||||
const { withHookConsent } = require('../../scripts/lib/install/hook-consent');
|
||||
const { repairInstalledStates } = require('../../scripts/lib/install-lifecycle');
|
||||
const { trySymlink } = require('../lib/helpers/symlink-support');
|
||||
const repo = path.resolve(__dirname, '../..');
|
||||
let passed = 0;
|
||||
let failed = 0;
|
||||
@@ -186,7 +187,7 @@ for (const scope of ['package.json', 'lib/package.json']) {
|
||||
test(`symlinked ${scope} refuses before mutation`, f => {
|
||||
const file = path.join(f.scripts, scope); const outside = path.join(f.dir, 'user-package.json');
|
||||
f.write(outside, '{"type":"commonjs"}\n'); fs.mkdirSync(path.dirname(file), { recursive: true });
|
||||
fs.symlinkSync(outside, file); const before = snapshot(f.dir);
|
||||
if (!trySymlink(outside, file)) return; const before = snapshot(f.dir);
|
||||
assert.notStrictEqual(f.install().status, 0); assert.deepStrictEqual(snapshot(f.dir), before);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user