0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-permission-fs-write-v8.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

31 lines
652 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');
const v8 = require('v8');
const path = require('path');
{
assert.throws(() => {
v8.writeHeapSnapshot('./secret.txt');
}, common.expectsError({
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
resource: path.toNamespacedPath('./secret.txt'),
}));
}
{
assert.throws(() => {
v8.writeHeapSnapshot();
}, common.expectsError({
code: 'ERR_ACCESS_DENIED',
permission: 'FileSystemWrite',
}));
}