node/test/parallel/test-permission-fs-write-report.js
Rafael Gonzaga 15456e4e57
src,permission: resolve path on fs_permission
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
PR-URL: https://github.com/nodejs/node/pull/52761
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2024-05-03 03:40:49 +00:00

30 lines
614 B
JavaScript

// Flags: --experimental-permission --allow-fs-read=*
'use strict';
const common = require('../common');
common.skipIfWorker();
if (!common.hasCrypto)
common.skip('no crypto');
const assert = require('assert');
{
assert.throws(() => {
process.report.writeReport('./secret.txt');
}, common.expectsError({
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
resource: './secret.txt',
}));
}
{
assert.throws(() => {
process.report.writeReport();
}, common.expectsError({
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
resource: process.cwd(),
}));
}