Skip to content

Commit 7a5e9ff

Browse files
clemgbldfraxken
andauthored
feat(Settings): disable experimental warnings by default (#496)
* feat(Settings): disable experimental warnings by default * refacto(cache): imporve experimental warning filtering Co-authored-by: Thomas.G <[email protected]> * fix(config): fix style --------- Co-authored-by: Thomas.G <[email protected]>
1 parent 73b8313 commit 7a5e9ff

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"@nodesecure/documentation-ui": "^1.3.0",
8383
"@nodesecure/flags": "^3.0.3",
8484
"@nodesecure/i18n": "^4.0.1",
85+
"@nodesecure/js-x-ray": "^8.2.0",
8586
"@nodesecure/licenses-conformance": "^2.1.0",
8687
"@nodesecure/npm-registry-sdk": "^3.0.0",
8788
"@nodesecure/ossf-scorecard-sdk": "^3.2.1",

src/http-server/config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
// Import Third-party Dependencies
2+
import { warnings } from "@nodesecure/js-x-ray";
3+
14
// Import Internal Dependencies
25
import { appCache } from "../cache.js";
36
import { logger } from "../logger.js";
47

8+
const experimentalWarnings = Object.entries(warnings)
9+
.flatMap(([warning, { experimental }]) => (experimental ? [warning] : []));
10+
511
// CONSTANTS
612
const kDefaultConfig = {
713
defaultPackageMenu: "info",
8-
ignore: { flags: [], warnings: [] }
14+
ignore: { flags: [], warnings: experimentalWarnings }
915
};
1016

1117
export async function get() {

test/config.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import assert from "node:assert";
44

55
// Import Third-party Dependencies
66
import cacache from "cacache";
7+
import { warnings } from "@nodesecure/js-x-ray";
78

89
// Import Internal Dependencies
910
import { get, set } from "../src/http-server/config.js";
@@ -29,7 +30,9 @@ describe("config", { concurrency: 1 }, () => {
2930

3031
assert.deepStrictEqual(value, {
3132
defaultPackageMenu: "info",
32-
ignore: { flags: [], warnings: [] }
33+
ignore: { flags: [], warnings: Object.entries(warnings)
34+
.filter(([_, { experimental }]) => experimental)
35+
.map(([warning]) => warning) }
3336
});
3437
});
3538

0 commit comments

Comments
 (0)