@sgohlke/stryker-log-ignorer 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs +3 -2
- package/build/index.cjs.map +1 -1
- package/build/index.d.cts +3 -45
- package/build/index.d.mts +2 -44
- package/build/index.mjs +2 -1
- package/build/index.mjs.map +1 -1
- package/package.json +13 -13
package/build/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
//#endregion
|
|
29
29
|
let _stryker_mutator_api_plugin = require("@stryker-mutator/api/plugin");
|
|
30
30
|
let node_fs = require("node:fs");
|
|
31
|
-
node_fs = __toESM(node_fs);
|
|
31
|
+
node_fs = __toESM(node_fs, 1);
|
|
32
32
|
|
|
33
33
|
//#region src/index.ts
|
|
34
34
|
var LogIgnorer = class {
|
|
@@ -39,7 +39,8 @@ var LogIgnorer = class {
|
|
|
39
39
|
}
|
|
40
40
|
shouldIgnore(path) {
|
|
41
41
|
const loggerObjectNames = this.options?.objectNames ?? ["console"];
|
|
42
|
-
|
|
42
|
+
const { node } = path;
|
|
43
|
+
if (node.type === "ExpressionStatement" && node.expression.type === "CallExpression" && node.expression.callee.type === "MemberExpression" && node.expression.callee.object.type === "Identifier" && loggerObjectNames.includes(node.expression.callee.object.name)) return `We are not interested in testing ${loggerObjectNames} statements.`;
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
46
|
logIgnorerFactory.inject = (0, _stryker_mutator_api_plugin.tokens)(_stryker_mutator_api_plugin.commonTokens.injector);
|
package/build/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["commonTokens","PluginKind","fs"],"sources":["../src/index.ts"],"sourcesContent":["import type { StrykerOptions } from '@stryker-mutator/api/core'\nimport type { Ignorer, NodePath } from '@stryker-mutator/api/ignore'\nimport type { Injector, PluginContext } from '@stryker-mutator/api/plugin'\nimport { PluginKind, commonTokens, declareFactoryPlugin, tokens } from '@stryker-mutator/api/plugin' // eslint-disable-line @typescript-eslint/no-duplicate-imports\n\nimport fs from 'node:fs'\n\n/**\n * Configuration for @sgohlke/stryker-log-ignorer\n */\ninterface IgnorerOptions {\n /**\n * Specify the object names of the logger objects to be ignored. Defaults to [\"console\"]\n */\n objectNames?: string[]\n}\n\ninterface LogIgnorerOptions extends StrykerOptions {\n logignore?: IgnorerOptions\n}\n\n/*\n * LogIgnorer provides functionality to ignore log calls for provided logger object names.\n */\nclass LogIgnorer implements Ignorer {\n public static inject = [commonTokens.options] as const\n protected readonly options?: IgnorerOptions\n\n constructor(options?: Partial<LogIgnorerOptions>) {\n this.options = options?.logignore\n }\n\n shouldIgnore(path: NodePath): string | undefined {\n const loggerObjectNames = this.options?.objectNames ?? ['console']\n if (\n
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["commonTokens","PluginKind","fs"],"sources":["../src/index.ts"],"sourcesContent":["import type { StrykerOptions } from '@stryker-mutator/api/core'\nimport type { Ignorer, NodePath } from '@stryker-mutator/api/ignore'\nimport type { Injector, PluginContext } from '@stryker-mutator/api/plugin'\nimport { PluginKind, commonTokens, declareFactoryPlugin, tokens } from '@stryker-mutator/api/plugin' // eslint-disable-line @typescript-eslint/no-duplicate-imports\n\nimport fs from 'node:fs'\n\n/**\n * Configuration for @sgohlke/stryker-log-ignorer\n */\ninterface IgnorerOptions {\n /**\n * Specify the object names of the logger objects to be ignored. Defaults to [\"console\"]\n */\n objectNames?: string[]\n}\n\ninterface LogIgnorerOptions extends StrykerOptions {\n logignore?: IgnorerOptions\n}\n\n/*\n * LogIgnorer provides functionality to ignore log calls for provided logger object names.\n */\nclass LogIgnorer implements Ignorer {\n public static inject = [commonTokens.options] as const\n protected readonly options?: IgnorerOptions\n\n constructor(options?: Partial<LogIgnorerOptions>) {\n this.options = options?.logignore\n }\n\n shouldIgnore(path: NodePath): string | undefined {\n const loggerObjectNames = this.options?.objectNames ?? ['console']\n const { node } = path\n if (\n node.type === 'ExpressionStatement' &&\n node.expression.type === 'CallExpression' &&\n node.expression.callee.type === 'MemberExpression' &&\n node.expression.callee.object.type === 'Identifier' &&\n loggerObjectNames.includes(node.expression.callee.object.name)\n ) {\n return `We are not interested in testing ${loggerObjectNames} statements.`\n }\n }\n}\n\nlogIgnorerFactory.inject = tokens(commonTokens.injector)\n\nfunction logIgnorerFactory(injector: Injector<PluginContext>): LogIgnorer {\n return injector.injectClass(LogIgnorer)\n}\n\nfunction createLogIgnorerFactory(): {\n (injector: Injector<PluginContext>): LogIgnorer\n inject: ['$injector']\n} {\n return logIgnorerFactory\n}\n\nconst strykerPlugins = [\n declareFactoryPlugin(PluginKind.Ignore, 'log-ignore', createLogIgnorerFactory()),\n]\n\nconst strykerValidationSchema: Record<string, unknown> = JSON.parse(\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n fs.readFileSync(new URL('../schema/log-ignorer-options.json', import.meta.url), 'utf8'),\n)\n\nexport {\n LogIgnorer,\n createLogIgnorerFactory,\n logIgnorerFactory,\n strykerPlugins,\n strykerValidationSchema,\n}\nexport type { IgnorerOptions, LogIgnorerOptions }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,aAAN,MAAoC;CAClC,OAAc,SAAS,CAACA,yCAAa,OAAO;CAC5C,AAAmB;CAEnB,YAAY,SAAsC;EAChD,KAAK,UAAU,SAAS;CAC1B;CAEA,aAAa,MAAoC;EAC/C,MAAM,oBAAoB,KAAK,SAAS,eAAe,CAAC,SAAS;EACjE,MAAM,EAAE,SAAS;EACjB,IACE,KAAK,SAAS,yBACd,KAAK,WAAW,SAAS,oBACzB,KAAK,WAAW,OAAO,SAAS,sBAChC,KAAK,WAAW,OAAO,OAAO,SAAS,gBACvC,kBAAkB,SAAS,KAAK,WAAW,OAAO,OAAO,IAAI,GAE7D,OAAO,oCAAoC,kBAAkB;CAEjE;AACF;AAEA,kBAAkB,iDAAgBA,yCAAa,QAAQ;AAEvD,SAAS,kBAAkB,UAA+C;CACxE,OAAO,SAAS,YAAY,UAAU;AACxC;AAEA,SAAS,0BAGP;CACA,OAAO;AACT;AAEA,MAAM,iBAAiB,uDACAC,uCAAW,QAAQ,cAAc,wBAAwB,CAAC,CACjF;AAEA,MAAM,0BAAmD,KAAK,MAE5DC,gBAAG,aAAa,IAAI,IAAI,mFAAqD,GAAG,MAAM,CACxF"}
|
package/build/index.d.cts
CHANGED
|
@@ -1,48 +1,6 @@
|
|
|
1
|
-
import * as _$_stryker_mutator_api_plugin0 from "@stryker-mutator/api/plugin";
|
|
2
|
-
import { Injector, PluginContext, PluginKind } from "@stryker-mutator/api/plugin";
|
|
3
1
|
import { StrykerOptions } from "@stryker-mutator/api/core";
|
|
4
2
|
import { Ignorer, NodePath } from "@stryker-mutator/api/ignore";
|
|
5
|
-
|
|
6
|
-
//#region \0rolldown/runtime.js
|
|
7
|
-
declare namespace log_ignorer_options_json_d_exports {
|
|
8
|
-
export { $schema, additionalProperties, __json_default_export as default, properties, title, type };
|
|
9
|
-
}
|
|
10
|
-
declare let $schema: string;
|
|
11
|
-
declare let type: string;
|
|
12
|
-
declare let title: string;
|
|
13
|
-
declare let additionalProperties: boolean;
|
|
14
|
-
declare namespace properties {
|
|
15
|
-
namespace logignore {
|
|
16
|
-
export let description: string;
|
|
17
|
-
let title_1: string;
|
|
18
|
-
export { title_1 as title };
|
|
19
|
-
let additionalProperties_1: boolean;
|
|
20
|
-
export { additionalProperties_1 as additionalProperties };
|
|
21
|
-
let type_1: string;
|
|
22
|
-
export { type_1 as type };
|
|
23
|
-
let _default: {};
|
|
24
|
-
export { _default as default };
|
|
25
|
-
export namespace properties_1 {
|
|
26
|
-
namespace objectNames {
|
|
27
|
-
let description_1: string;
|
|
28
|
-
export { description_1 as description };
|
|
29
|
-
let type_2: string;
|
|
30
|
-
export { type_2 as type };
|
|
31
|
-
export namespace items {
|
|
32
|
-
let type_3: string;
|
|
33
|
-
export { type_3 as type };
|
|
34
|
-
}
|
|
35
|
-
let _default_1: string[];
|
|
36
|
-
export { _default_1 as default };
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
export { properties_1 as properties };
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
declare namespace __json_default_export {
|
|
43
|
-
export { $schema, type, title, additionalProperties, properties };
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
3
|
+
import { Injector, PluginContext, PluginKind } from "@stryker-mutator/api/plugin";
|
|
46
4
|
//#region src/index.d.ts
|
|
47
5
|
/**
|
|
48
6
|
* Configuration for @sgohlke/stryker-log-ignorer
|
|
@@ -70,8 +28,8 @@ declare function createLogIgnorerFactory(): {
|
|
|
70
28
|
(injector: Injector<PluginContext>): LogIgnorer;
|
|
71
29
|
inject: ['$injector'];
|
|
72
30
|
};
|
|
73
|
-
declare const strykerPlugins:
|
|
74
|
-
declare const strykerValidationSchema:
|
|
31
|
+
declare const strykerPlugins: import("@stryker-mutator/api/plugin").FactoryPlugin<PluginKind.Ignore, ["$injector"]>[];
|
|
32
|
+
declare const strykerValidationSchema: Record<string, unknown>;
|
|
75
33
|
//#endregion
|
|
76
34
|
export { type IgnorerOptions, LogIgnorer, type LogIgnorerOptions, createLogIgnorerFactory, logIgnorerFactory, strykerPlugins, strykerValidationSchema };
|
|
77
35
|
//# sourceMappingURL=index.d.cts.map
|
package/build/index.d.mts
CHANGED
|
@@ -1,48 +1,6 @@
|
|
|
1
|
-
import * as _$_stryker_mutator_api_plugin0 from "@stryker-mutator/api/plugin";
|
|
2
1
|
import { Injector, PluginContext, PluginKind } from "@stryker-mutator/api/plugin";
|
|
3
2
|
import { StrykerOptions } from "@stryker-mutator/api/core";
|
|
4
3
|
import { Ignorer, NodePath } from "@stryker-mutator/api/ignore";
|
|
5
|
-
|
|
6
|
-
//#region \0rolldown/runtime.js
|
|
7
|
-
declare namespace log_ignorer_options_json_d_exports {
|
|
8
|
-
export { $schema, additionalProperties, __json_default_export as default, properties, title, type };
|
|
9
|
-
}
|
|
10
|
-
declare let $schema: string;
|
|
11
|
-
declare let type: string;
|
|
12
|
-
declare let title: string;
|
|
13
|
-
declare let additionalProperties: boolean;
|
|
14
|
-
declare namespace properties {
|
|
15
|
-
namespace logignore {
|
|
16
|
-
export let description: string;
|
|
17
|
-
let title_1: string;
|
|
18
|
-
export { title_1 as title };
|
|
19
|
-
let additionalProperties_1: boolean;
|
|
20
|
-
export { additionalProperties_1 as additionalProperties };
|
|
21
|
-
let type_1: string;
|
|
22
|
-
export { type_1 as type };
|
|
23
|
-
let _default: {};
|
|
24
|
-
export { _default as default };
|
|
25
|
-
export namespace properties_1 {
|
|
26
|
-
namespace objectNames {
|
|
27
|
-
let description_1: string;
|
|
28
|
-
export { description_1 as description };
|
|
29
|
-
let type_2: string;
|
|
30
|
-
export { type_2 as type };
|
|
31
|
-
export namespace items {
|
|
32
|
-
let type_3: string;
|
|
33
|
-
export { type_3 as type };
|
|
34
|
-
}
|
|
35
|
-
let _default_1: string[];
|
|
36
|
-
export { _default_1 as default };
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
export { properties_1 as properties };
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
declare namespace __json_default_export {
|
|
43
|
-
export { $schema, type, title, additionalProperties, properties };
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
4
|
//#region src/index.d.ts
|
|
47
5
|
/**
|
|
48
6
|
* Configuration for @sgohlke/stryker-log-ignorer
|
|
@@ -70,8 +28,8 @@ declare function createLogIgnorerFactory(): {
|
|
|
70
28
|
(injector: Injector<PluginContext>): LogIgnorer;
|
|
71
29
|
inject: ['$injector'];
|
|
72
30
|
};
|
|
73
|
-
declare const strykerPlugins:
|
|
74
|
-
declare const strykerValidationSchema:
|
|
31
|
+
declare const strykerPlugins: import("@stryker-mutator/api/plugin").FactoryPlugin<PluginKind.Ignore, ["$injector"]>[];
|
|
32
|
+
declare const strykerValidationSchema: Record<string, unknown>;
|
|
75
33
|
//#endregion
|
|
76
34
|
export { type IgnorerOptions, LogIgnorer, type LogIgnorerOptions, createLogIgnorerFactory, logIgnorerFactory, strykerPlugins, strykerValidationSchema };
|
|
77
35
|
//# sourceMappingURL=index.d.mts.map
|
package/build/index.mjs
CHANGED
|
@@ -10,7 +10,8 @@ var LogIgnorer = class {
|
|
|
10
10
|
}
|
|
11
11
|
shouldIgnore(path) {
|
|
12
12
|
const loggerObjectNames = this.options?.objectNames ?? ["console"];
|
|
13
|
-
|
|
13
|
+
const { node } = path;
|
|
14
|
+
if (node.type === "ExpressionStatement" && node.expression.type === "CallExpression" && node.expression.callee.type === "MemberExpression" && node.expression.callee.object.type === "Identifier" && loggerObjectNames.includes(node.expression.callee.object.name)) return `We are not interested in testing ${loggerObjectNames} statements.`;
|
|
14
15
|
}
|
|
15
16
|
};
|
|
16
17
|
logIgnorerFactory.inject = tokens(commonTokens.injector);
|
package/build/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { StrykerOptions } from '@stryker-mutator/api/core'\nimport type { Ignorer, NodePath } from '@stryker-mutator/api/ignore'\nimport type { Injector, PluginContext } from '@stryker-mutator/api/plugin'\nimport { PluginKind, commonTokens, declareFactoryPlugin, tokens } from '@stryker-mutator/api/plugin' // eslint-disable-line @typescript-eslint/no-duplicate-imports\n\nimport fs from 'node:fs'\n\n/**\n * Configuration for @sgohlke/stryker-log-ignorer\n */\ninterface IgnorerOptions {\n /**\n * Specify the object names of the logger objects to be ignored. Defaults to [\"console\"]\n */\n objectNames?: string[]\n}\n\ninterface LogIgnorerOptions extends StrykerOptions {\n logignore?: IgnorerOptions\n}\n\n/*\n * LogIgnorer provides functionality to ignore log calls for provided logger object names.\n */\nclass LogIgnorer implements Ignorer {\n public static inject = [commonTokens.options] as const\n protected readonly options?: IgnorerOptions\n\n constructor(options?: Partial<LogIgnorerOptions>) {\n this.options = options?.logignore\n }\n\n shouldIgnore(path: NodePath): string | undefined {\n const loggerObjectNames = this.options?.objectNames ?? ['console']\n if (\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { StrykerOptions } from '@stryker-mutator/api/core'\nimport type { Ignorer, NodePath } from '@stryker-mutator/api/ignore'\nimport type { Injector, PluginContext } from '@stryker-mutator/api/plugin'\nimport { PluginKind, commonTokens, declareFactoryPlugin, tokens } from '@stryker-mutator/api/plugin' // eslint-disable-line @typescript-eslint/no-duplicate-imports\n\nimport fs from 'node:fs'\n\n/**\n * Configuration for @sgohlke/stryker-log-ignorer\n */\ninterface IgnorerOptions {\n /**\n * Specify the object names of the logger objects to be ignored. Defaults to [\"console\"]\n */\n objectNames?: string[]\n}\n\ninterface LogIgnorerOptions extends StrykerOptions {\n logignore?: IgnorerOptions\n}\n\n/*\n * LogIgnorer provides functionality to ignore log calls for provided logger object names.\n */\nclass LogIgnorer implements Ignorer {\n public static inject = [commonTokens.options] as const\n protected readonly options?: IgnorerOptions\n\n constructor(options?: Partial<LogIgnorerOptions>) {\n this.options = options?.logignore\n }\n\n shouldIgnore(path: NodePath): string | undefined {\n const loggerObjectNames = this.options?.objectNames ?? ['console']\n const { node } = path\n if (\n node.type === 'ExpressionStatement' &&\n node.expression.type === 'CallExpression' &&\n node.expression.callee.type === 'MemberExpression' &&\n node.expression.callee.object.type === 'Identifier' &&\n loggerObjectNames.includes(node.expression.callee.object.name)\n ) {\n return `We are not interested in testing ${loggerObjectNames} statements.`\n }\n }\n}\n\nlogIgnorerFactory.inject = tokens(commonTokens.injector)\n\nfunction logIgnorerFactory(injector: Injector<PluginContext>): LogIgnorer {\n return injector.injectClass(LogIgnorer)\n}\n\nfunction createLogIgnorerFactory(): {\n (injector: Injector<PluginContext>): LogIgnorer\n inject: ['$injector']\n} {\n return logIgnorerFactory\n}\n\nconst strykerPlugins = [\n declareFactoryPlugin(PluginKind.Ignore, 'log-ignore', createLogIgnorerFactory()),\n]\n\nconst strykerValidationSchema: Record<string, unknown> = JSON.parse(\n // eslint-disable-next-line security/detect-non-literal-fs-filename\n fs.readFileSync(new URL('../schema/log-ignorer-options.json', import.meta.url), 'utf8'),\n)\n\nexport {\n LogIgnorer,\n createLogIgnorerFactory,\n logIgnorerFactory,\n strykerPlugins,\n strykerValidationSchema,\n}\nexport type { IgnorerOptions, LogIgnorerOptions }\n"],"mappings":";;;;AAwBA,IAAM,aAAN,MAAoC;CAClC,OAAc,SAAS,CAAC,aAAa,OAAO;CAC5C,AAAmB;CAEnB,YAAY,SAAsC;EAChD,KAAK,UAAU,SAAS;CAC1B;CAEA,aAAa,MAAoC;EAC/C,MAAM,oBAAoB,KAAK,SAAS,eAAe,CAAC,SAAS;EACjE,MAAM,EAAE,SAAS;EACjB,IACE,KAAK,SAAS,yBACd,KAAK,WAAW,SAAS,oBACzB,KAAK,WAAW,OAAO,SAAS,sBAChC,KAAK,WAAW,OAAO,OAAO,SAAS,gBACvC,kBAAkB,SAAS,KAAK,WAAW,OAAO,OAAO,IAAI,GAE7D,OAAO,oCAAoC,kBAAkB;CAEjE;AACF;AAEA,kBAAkB,SAAS,OAAO,aAAa,QAAQ;AAEvD,SAAS,kBAAkB,UAA+C;CACxE,OAAO,SAAS,YAAY,UAAU;AACxC;AAEA,SAAS,0BAGP;CACA,OAAO;AACT;AAEA,MAAM,iBAAiB,CACrB,qBAAqB,WAAW,QAAQ,cAAc,wBAAwB,CAAC,CACjF;AAEA,MAAM,0BAAmD,KAAK,MAE5D,GAAG,aAAa,IAAI,IAAI,sCAAsC,OAAO,KAAK,GAAG,GAAG,MAAM,CACxF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sgohlke/stryker-log-ignorer",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Log Ignorer for Stryker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Log Ignorer",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"test": "vitest run --coverage"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@stryker-mutator/api": "9.6.
|
|
44
|
+
"@stryker-mutator/api": "9.6.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/parser": "
|
|
48
|
-
"@babel/traverse": "
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@types/node": "
|
|
52
|
-
"@vitest/coverage-v8": "4.1.
|
|
53
|
-
"oxfmt": "0.
|
|
54
|
-
"oxlint": "1.
|
|
55
|
-
"tsdown": "0.
|
|
56
|
-
"typescript": "
|
|
57
|
-
"vitest": "4.1.
|
|
47
|
+
"@babel/parser": "8.0.4",
|
|
48
|
+
"@babel/traverse": "8.0.4",
|
|
49
|
+
"@babel/types": "8.0.4",
|
|
50
|
+
"@swc/core": "1.15.43",
|
|
51
|
+
"@types/node": "26.1.1",
|
|
52
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
53
|
+
"oxfmt": "0.58.0",
|
|
54
|
+
"oxlint": "1.73.0",
|
|
55
|
+
"tsdown": "0.22.5",
|
|
56
|
+
"typescript": "7.0.2",
|
|
57
|
+
"vitest": "4.1.10"
|
|
58
58
|
}
|
|
59
59
|
}
|