mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
policy: fix message for invalid manifest specifier
Add test for invalid manifest specifier and fix the error message
which is missing a space ("singletrailing" instead of
"single trailing").
PR-URL: https://github.com/nodejs/node/pull/40574
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
1 parent
075cfbf941
commit
b320387c83
3 files changed
+36
-3
No files matched your search
@@ -136,9 +136,8 @@ class DependencyMapperInstance {
|
||||
if (!target) {
|
||||
throw new ERR_MANIFEST_INVALID_SPECIFIER(
|
||||
this.href,
|
||||
target +
|
||||
', pattern needs to have a single' +
|
||||
'trailing "*" in target');
|
||||
`${target}, pattern needs to have a single trailing "*" in target`
|
||||
);
|
||||
}
|
||||
const prefix = target[1];
|
||||
const suffix = target[2];
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"resources": {
|
||||
"./fhqwhgads.js": {
|
||||
"dependencies": {
|
||||
"**": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
common.requireNoPackageJSONAbove();
|
||||
|
||||
const assert = require('assert');
|
||||
const { spawnSync } = require('child_process');
|
||||
const fixtures = require('../common/fixtures.js');
|
||||
|
||||
const policyFilepath = fixtures.path('policy-manifest', 'invalid.json');
|
||||
|
||||
const result = spawnSync(process.execPath, [
|
||||
'--experimental-policy',
|
||||
policyFilepath,
|
||||
'./fhqwhgads.js',
|
||||
]);
|
||||
|
||||
assert.notStrictEqual(result.status, 0);
|
||||
const stderr = result.stderr.toString();
|
||||
assert.match(stderr, /ERR_MANIFEST_INVALID_SPECIFIER/);
|
||||
assert.match(stderr, /pattern needs to have a single trailing "\*"/);
|
||||
Reference in new issue
Block a user