@xylabs/jest-helpers 2.12.21 → 2.12.23

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.
Files changed (77) hide show
  1. package/package.json +3 -3
  2. package/dist/browser/describeIf.cjs +0 -27
  3. package/dist/browser/describeIf.cjs.map +0 -1
  4. package/dist/browser/describeIf.js +0 -6
  5. package/dist/browser/describeIf.js.map +0 -1
  6. package/dist/browser/itIf.cjs +0 -27
  7. package/dist/browser/itIf.cjs.map +0 -1
  8. package/dist/browser/itIf.js +0 -6
  9. package/dist/browser/itIf.js.map +0 -1
  10. package/dist/browser/tags/config.cjs +0 -33
  11. package/dist/browser/tags/config.cjs.map +0 -1
  12. package/dist/browser/tags/config.js +0 -12
  13. package/dist/browser/tags/config.js.map +0 -1
  14. package/dist/browser/tags/filter.cjs +0 -72
  15. package/dist/browser/tags/filter.cjs.map +0 -1
  16. package/dist/browser/tags/filter.js +0 -49
  17. package/dist/browser/tags/filter.js.map +0 -1
  18. package/dist/browser/tags/index.cjs +0 -102
  19. package/dist/browser/tags/index.cjs.map +0 -1
  20. package/dist/browser/tags/index.js +0 -79
  21. package/dist/browser/tags/index.js.map +0 -1
  22. package/dist/browser/tags/regexps.cjs +0 -44
  23. package/dist/browser/tags/regexps.cjs.map +0 -1
  24. package/dist/browser/tags/regexps.js +0 -21
  25. package/dist/browser/tags/regexps.js.map +0 -1
  26. package/dist/browser/tags/utils.cjs +0 -36
  27. package/dist/browser/tags/utils.cjs.map +0 -1
  28. package/dist/browser/tags/utils.d.cts +0 -2
  29. package/dist/browser/tags/utils.d.cts.map +0 -1
  30. package/dist/browser/tags/utils.d.mts +0 -2
  31. package/dist/browser/tags/utils.d.mts.map +0 -1
  32. package/dist/browser/tags/utils.d.ts +0 -2
  33. package/dist/browser/tags/utils.d.ts.map +0 -1
  34. package/dist/browser/tags/utils.js +0 -13
  35. package/dist/browser/tags/utils.js.map +0 -1
  36. package/dist/browser/testIf.cjs +0 -27
  37. package/dist/browser/testIf.cjs.map +0 -1
  38. package/dist/browser/testIf.js +0 -6
  39. package/dist/browser/testIf.js.map +0 -1
  40. package/dist/node/describeIf.cjs +0 -31
  41. package/dist/node/describeIf.cjs.map +0 -1
  42. package/dist/node/describeIf.js +0 -6
  43. package/dist/node/describeIf.js.map +0 -1
  44. package/dist/node/itIf.cjs +0 -31
  45. package/dist/node/itIf.cjs.map +0 -1
  46. package/dist/node/itIf.js +0 -6
  47. package/dist/node/itIf.js.map +0 -1
  48. package/dist/node/tags/config.cjs +0 -40
  49. package/dist/node/tags/config.cjs.map +0 -1
  50. package/dist/node/tags/config.js +0 -12
  51. package/dist/node/tags/config.js.map +0 -1
  52. package/dist/node/tags/filter.cjs +0 -76
  53. package/dist/node/tags/filter.cjs.map +0 -1
  54. package/dist/node/tags/filter.js +0 -49
  55. package/dist/node/tags/filter.js.map +0 -1
  56. package/dist/node/tags/index.cjs +0 -106
  57. package/dist/node/tags/index.cjs.map +0 -1
  58. package/dist/node/tags/index.js +0 -79
  59. package/dist/node/tags/index.js.map +0 -1
  60. package/dist/node/tags/regexps.cjs +0 -53
  61. package/dist/node/tags/regexps.cjs.map +0 -1
  62. package/dist/node/tags/regexps.js +0 -21
  63. package/dist/node/tags/regexps.js.map +0 -1
  64. package/dist/node/tags/utils.cjs +0 -40
  65. package/dist/node/tags/utils.cjs.map +0 -1
  66. package/dist/node/tags/utils.d.cts +0 -2
  67. package/dist/node/tags/utils.d.cts.map +0 -1
  68. package/dist/node/tags/utils.d.mts +0 -2
  69. package/dist/node/tags/utils.d.mts.map +0 -1
  70. package/dist/node/tags/utils.d.ts +0 -2
  71. package/dist/node/tags/utils.d.ts.map +0 -1
  72. package/dist/node/tags/utils.js +0 -13
  73. package/dist/node/tags/utils.js.map +0 -1
  74. package/dist/node/testIf.cjs +0 -31
  75. package/dist/node/testIf.cjs.map +0 -1
  76. package/dist/node/testIf.js +0 -6
  77. package/dist/node/testIf.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/tags/utils.ts","../../../src/tags/config.ts"],"sourcesContent":["import { RESERVED_COMMANDS } from './config'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const getJestPassedParams = (argv: any) => {\n return [...argv, '-i'].filter((prop) => {\n return prop.startsWith('-') && RESERVED_COMMANDS.every((command) => command !== prop)\n })\n}\n","export const NOT_SYMBOL = '!'\n\nexport const AND_SYMBOL = '&&'\n\nexport const OR_SYMBOL = '||'\n\nexport const RESERVED_COMMANDS = ['--tags']\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMO,IAAM,oBAAoB,CAAC,QAAQ;;;ADHnC,IAAM,sBAAsB,CAAC,SAAc;AAChD,SAAO,CAAC,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC,SAAS;AACtC,WAAO,KAAK,WAAW,GAAG,KAAK,kBAAkB,MAAM,CAAC,YAAY,YAAY,IAAI;AAAA,EACtF,CAAC;AACH;","names":[]}
@@ -1,2 +0,0 @@
1
- export declare const getJestPassedParams: (argv: any) => any[];
2
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tags/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,SAAU,GAAG,UAI5C,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const getJestPassedParams: (argv: any) => any[];
2
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tags/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,SAAU,GAAG,UAI5C,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const getJestPassedParams: (argv: any) => any[];
2
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tags/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,SAAU,GAAG,UAI5C,CAAA"}
@@ -1,13 +0,0 @@
1
- // src/tags/config.ts
2
- var RESERVED_COMMANDS = ["--tags"];
3
-
4
- // src/tags/utils.ts
5
- var getJestPassedParams = (argv) => {
6
- return [...argv, "-i"].filter((prop) => {
7
- return prop.startsWith("-") && RESERVED_COMMANDS.every((command) => command !== prop);
8
- });
9
- };
10
- export {
11
- getJestPassedParams
12
- };
13
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/tags/config.ts","../../../src/tags/utils.ts"],"sourcesContent":["export const NOT_SYMBOL = '!'\n\nexport const AND_SYMBOL = '&&'\n\nexport const OR_SYMBOL = '||'\n\nexport const RESERVED_COMMANDS = ['--tags']\n","import { RESERVED_COMMANDS } from './config'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const getJestPassedParams = (argv: any) => {\n return [...argv, '-i'].filter((prop) => {\n return prop.startsWith('-') && RESERVED_COMMANDS.every((command) => command !== prop)\n })\n}\n"],"mappings":";AAMO,IAAM,oBAAoB,CAAC,QAAQ;;;ACHnC,IAAM,sBAAsB,CAAC,SAAc;AAChD,SAAO,CAAC,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC,SAAS;AACtC,WAAO,KAAK,WAAW,GAAG,KAAK,kBAAkB,MAAM,CAAC,YAAY,YAAY,IAAI;AAAA,EACtF,CAAC;AACH;","names":[]}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/testIf.ts
21
- var testIf_exports = {};
22
- __export(testIf_exports, {
23
- testIf: () => testIf
24
- });
25
- module.exports = __toCommonJS(testIf_exports);
26
- var testIf = (expr) => expr ? test : test.skip;
27
- //# sourceMappingURL=testIf.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/testIf.ts"],"sourcesContent":["/**\n * Conditionally runs or skips the test\n * @param expr The condition to evaluate\n * @returns If the condition is true, test, otherwise skips\n */\nexport const testIf = <T>(expr?: T | null) => (expr ? test : test.skip)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAM,SAAS,CAAI,SAAqB,OAAO,OAAO,KAAK;","names":[]}
@@ -1,6 +0,0 @@
1
- // src/testIf.ts
2
- var testIf = (expr) => expr ? test : test.skip;
3
- export {
4
- testIf
5
- };
6
- //# sourceMappingURL=testIf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/testIf.ts"],"sourcesContent":["/**\n * Conditionally runs or skips the test\n * @param expr The condition to evaluate\n * @returns If the condition is true, test, otherwise skips\n */\nexport const testIf = <T>(expr?: T | null) => (expr ? test : test.skip)\n"],"mappings":";AAKO,IAAM,SAAS,CAAI,SAAqB,OAAO,OAAO,KAAK;","names":[]}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/describeIf.ts
21
- var describeIf_exports = {};
22
- __export(describeIf_exports, {
23
- describeIf: () => describeIf
24
- });
25
- module.exports = __toCommonJS(describeIf_exports);
26
- var describeIf = (expr) => expr ? describe : describe.skip;
27
- // Annotate the CommonJS export names for ESM import in node:
28
- 0 && (module.exports = {
29
- describeIf
30
- });
31
- //# sourceMappingURL=describeIf.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/describeIf.ts"],"sourcesContent":["/**\n * Conditionally runs or skips the describe\n * @param expr The condition to evaluate\n * @returns If the condition is true, describe, otherwise skips\n */\nexport const describeIf = <T>(expr?: T | null) => (expr ? describe : describe.skip)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAM,aAAa,CAAI,SAAqB,OAAO,WAAW,SAAS;","names":[]}
@@ -1,6 +0,0 @@
1
- // src/describeIf.ts
2
- var describeIf = (expr) => expr ? describe : describe.skip;
3
- export {
4
- describeIf
5
- };
6
- //# sourceMappingURL=describeIf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/describeIf.ts"],"sourcesContent":["/**\n * Conditionally runs or skips the describe\n * @param expr The condition to evaluate\n * @returns If the condition is true, describe, otherwise skips\n */\nexport const describeIf = <T>(expr?: T | null) => (expr ? describe : describe.skip)\n"],"mappings":";AAKO,IAAM,aAAa,CAAI,SAAqB,OAAO,WAAW,SAAS;","names":[]}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/itIf.ts
21
- var itIf_exports = {};
22
- __export(itIf_exports, {
23
- itIf: () => itIf
24
- });
25
- module.exports = __toCommonJS(itIf_exports);
26
- var itIf = (expr) => expr ? it : it.skip;
27
- // Annotate the CommonJS export names for ESM import in node:
28
- 0 && (module.exports = {
29
- itIf
30
- });
31
- //# sourceMappingURL=itIf.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/itIf.ts"],"sourcesContent":["/**\n * Conditionally runs or skips the it\n * @param expr The condition to evaluate\n * @returns If the condition is true, it, otherwise skips\n */\nexport const itIf = <T>(expr?: T | null) => (expr ? it : it.skip)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAM,OAAO,CAAI,SAAqB,OAAO,KAAK,GAAG;","names":[]}
package/dist/node/itIf.js DELETED
@@ -1,6 +0,0 @@
1
- // src/itIf.ts
2
- var itIf = (expr) => expr ? it : it.skip;
3
- export {
4
- itIf
5
- };
6
- //# sourceMappingURL=itIf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/itIf.ts"],"sourcesContent":["/**\n * Conditionally runs or skips the it\n * @param expr The condition to evaluate\n * @returns If the condition is true, it, otherwise skips\n */\nexport const itIf = <T>(expr?: T | null) => (expr ? it : it.skip)\n"],"mappings":";AAKO,IAAM,OAAO,CAAI,SAAqB,OAAO,KAAK,GAAG;","names":[]}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/tags/config.ts
21
- var config_exports = {};
22
- __export(config_exports, {
23
- AND_SYMBOL: () => AND_SYMBOL,
24
- NOT_SYMBOL: () => NOT_SYMBOL,
25
- OR_SYMBOL: () => OR_SYMBOL,
26
- RESERVED_COMMANDS: () => RESERVED_COMMANDS
27
- });
28
- module.exports = __toCommonJS(config_exports);
29
- var NOT_SYMBOL = "!";
30
- var AND_SYMBOL = "&&";
31
- var OR_SYMBOL = "||";
32
- var RESERVED_COMMANDS = ["--tags"];
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- AND_SYMBOL,
36
- NOT_SYMBOL,
37
- OR_SYMBOL,
38
- RESERVED_COMMANDS
39
- });
40
- //# sourceMappingURL=config.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/tags/config.ts"],"sourcesContent":["export const NOT_SYMBOL = '!'\n\nexport const AND_SYMBOL = '&&'\n\nexport const OR_SYMBOL = '||'\n\nexport const RESERVED_COMMANDS = ['--tags']\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,aAAa;AAEnB,IAAM,aAAa;AAEnB,IAAM,YAAY;AAElB,IAAM,oBAAoB,CAAC,QAAQ;","names":[]}
@@ -1,12 +0,0 @@
1
- // src/tags/config.ts
2
- var NOT_SYMBOL = "!";
3
- var AND_SYMBOL = "&&";
4
- var OR_SYMBOL = "||";
5
- var RESERVED_COMMANDS = ["--tags"];
6
- export {
7
- AND_SYMBOL,
8
- NOT_SYMBOL,
9
- OR_SYMBOL,
10
- RESERVED_COMMANDS
11
- };
12
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/tags/config.ts"],"sourcesContent":["export const NOT_SYMBOL = '!'\n\nexport const AND_SYMBOL = '&&'\n\nexport const OR_SYMBOL = '||'\n\nexport const RESERVED_COMMANDS = ['--tags']\n"],"mappings":";AAAO,IAAM,aAAa;AAEnB,IAAM,aAAa;AAEnB,IAAM,YAAY;AAElB,IAAM,oBAAoB,CAAC,QAAQ;","names":[]}
@@ -1,76 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/tags/filter.ts
21
- var filter_exports = {};
22
- __export(filter_exports, {
23
- matchFilter: () => matchFilter
24
- });
25
- module.exports = __toCommonJS(filter_exports);
26
-
27
- // src/tags/config.ts
28
- var NOT_SYMBOL = "!";
29
- var AND_SYMBOL = "&&";
30
- var OR_SYMBOL = "||";
31
-
32
- // src/tags/regexps.ts
33
- var escape = (str) => str.split("").map((symbol) => `\\${symbol}`).join("");
34
- var AND_REGX = new RegExp(`\\s*${escape(AND_SYMBOL)}\\s*`);
35
- var OR_REGX = new RegExp(`\\s*${escape(OR_SYMBOL)}\\s*`);
36
- var PLAIN_REGX = new RegExp("\\s+");
37
- var BAD_REGX = new RegExp(`^${escape(NOT_SYMBOL)}.*$`);
38
- var GOOD_REGX = new RegExp(`^[^${escape(NOT_SYMBOL)}].*$`);
39
-
40
- // src/tags/filter.ts
41
- var matchFilter = (strParam = "") => (tags) => {
42
- const str = strParam.trim();
43
- if (typeof tags === "string") {
44
- tags = [tags];
45
- }
46
- if (str.includes(OR_SYMBOL)) {
47
- const include2 = goodTags(str.split(OR_REGX));
48
- const exclude2 = badTags(str.split(OR_REGX));
49
- if (exclude2.length === 0) {
50
- return include2.length === 0 || include2.some((s) => tags.includes(s));
51
- }
52
- if (include2.length === 0 && exclude2.length !== 0) {
53
- return exclude2.some((s) => !tags.includes(s));
54
- }
55
- return include2.length === 0 || include2.some((s) => tags.includes(s)) || exclude2.some((s) => !tags.includes(s));
56
- }
57
- if (str.includes(AND_SYMBOL)) {
58
- const include2 = goodTags(str.split(AND_REGX));
59
- const exclude2 = badTags(str.split(AND_REGX));
60
- return (include2.length === 0 || include2.every((s) => tags.includes(s))) && !exclude2.some((s) => tags.includes(s));
61
- }
62
- const include = goodTags(str.split(PLAIN_REGX));
63
- const exclude = badTags(str.split(PLAIN_REGX));
64
- return (include.length === 0 || include.some((s) => tags.includes(s))) && !exclude.some((s) => tags.includes(s));
65
- };
66
- var goodTags = (arr) => {
67
- return arr.filter((s) => s.match(GOOD_REGX));
68
- };
69
- var badTags = (arr) => {
70
- return arr.filter((s) => s.match(BAD_REGX)).map((s) => s.replace(NOT_SYMBOL, ""));
71
- };
72
- // Annotate the CommonJS export names for ESM import in node:
73
- 0 && (module.exports = {
74
- matchFilter
75
- });
76
- //# sourceMappingURL=filter.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/tags/filter.ts","../../../src/tags/config.ts","../../../src/tags/regexps.ts"],"sourcesContent":["import { AND_SYMBOL, NOT_SYMBOL, OR_SYMBOL } from './config'\nimport { AND_REGX, BAD_REGX, GOOD_REGX, OR_REGX, PLAIN_REGX } from './regexps'\n\n// f.e. tag1 !tag2\n// tag1 && tag2 && !tag3\n// tag1 || tag2 || !tag3\n\n//ATTENTION!!: cases with () not handled: f.e. (tag1 && tag2) || tag3 won`t work\n\nexport const matchFilter =\n (strParam = '') =>\n (tags: string[]) => {\n const str = strParam.trim()\n if (typeof tags === 'string') {\n tags = [tags]\n }\n if (str.includes(OR_SYMBOL)) {\n const include = goodTags(str.split(OR_REGX))\n const exclude = badTags(str.split(OR_REGX))\n if (exclude.length === 0) {\n return include.length === 0 || include.some((s) => tags.includes(s))\n }\n if (include.length === 0 && exclude.length !== 0) {\n return exclude.some((s) => !tags.includes(s))\n }\n return include.length === 0 || include.some((s) => tags.includes(s)) || exclude.some((s) => !tags.includes(s))\n }\n if (str.includes(AND_SYMBOL)) {\n const include = goodTags(str.split(AND_REGX))\n const exclude = badTags(str.split(AND_REGX))\n\n return (include.length === 0 || include.every((s) => tags.includes(s))) && !exclude.some((s) => tags.includes(s))\n }\n const include = goodTags(str.split(PLAIN_REGX))\n const exclude = badTags(str.split(PLAIN_REGX))\n\n return (include.length === 0 || include.some((s) => tags.includes(s))) && !exclude.some((s) => tags.includes(s))\n }\n\nconst goodTags = (arr: string[]) => {\n return arr.filter((s) => s.match(GOOD_REGX))\n}\n\nconst badTags = (arr: string[]) => {\n return arr.filter((s) => s.match(BAD_REGX)).map((s) => s.replace(NOT_SYMBOL, ''))\n}\n","export const NOT_SYMBOL = '!'\n\nexport const AND_SYMBOL = '&&'\n\nexport const OR_SYMBOL = '||'\n\nexport const RESERVED_COMMANDS = ['--tags']\n","import { AND_SYMBOL, NOT_SYMBOL, OR_SYMBOL } from './config'\n\nexport const escape = (str: string) =>\n str\n .split('')\n .map((symbol) => `\\\\${symbol}`)\n .join('')\n\nexport const AND_REGX = new RegExp(`\\\\s*${escape(AND_SYMBOL)}\\\\s*`)\n\nexport const OR_REGX = new RegExp(`\\\\s*${escape(OR_SYMBOL)}\\\\s*`)\n\nexport const PLAIN_REGX = new RegExp('\\\\s+')\n\nexport const BAD_REGX = new RegExp(`^${escape(NOT_SYMBOL)}.*$`)\n\nexport const GOOD_REGX = new RegExp(`^[^${escape(NOT_SYMBOL)}].*$`)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,aAAa;AAEnB,IAAM,aAAa;AAEnB,IAAM,YAAY;;;ACFlB,IAAM,SAAS,CAAC,QACrB,IACG,MAAM,EAAE,EACR,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE,EAC7B,KAAK,EAAE;AAEL,IAAM,WAAW,IAAI,OAAO,OAAO,OAAO,UAAU,CAAC,MAAM;AAE3D,IAAM,UAAU,IAAI,OAAO,OAAO,OAAO,SAAS,CAAC,MAAM;AAEzD,IAAM,aAAa,IAAI,OAAO,MAAM;AAEpC,IAAM,WAAW,IAAI,OAAO,IAAI,OAAO,UAAU,CAAC,KAAK;AAEvD,IAAM,YAAY,IAAI,OAAO,MAAM,OAAO,UAAU,CAAC,MAAM;;;AFP3D,IAAM,cACX,CAAC,WAAW,OACZ,CAAC,SAAmB;AAClB,QAAM,MAAM,SAAS,KAAK;AAC1B,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,CAAC,IAAI;AAAA,EACd;AACA,MAAI,IAAI,SAAS,SAAS,GAAG;AAC3B,UAAMA,WAAU,SAAS,IAAI,MAAM,OAAO,CAAC;AAC3C,UAAMC,WAAU,QAAQ,IAAI,MAAM,OAAO,CAAC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}
@@ -1,49 +0,0 @@
1
- // src/tags/config.ts
2
- var NOT_SYMBOL = "!";
3
- var AND_SYMBOL = "&&";
4
- var OR_SYMBOL = "||";
5
-
6
- // src/tags/regexps.ts
7
- var escape = (str) => str.split("").map((symbol) => `\\${symbol}`).join("");
8
- var AND_REGX = new RegExp(`\\s*${escape(AND_SYMBOL)}\\s*`);
9
- var OR_REGX = new RegExp(`\\s*${escape(OR_SYMBOL)}\\s*`);
10
- var PLAIN_REGX = new RegExp("\\s+");
11
- var BAD_REGX = new RegExp(`^${escape(NOT_SYMBOL)}.*$`);
12
- var GOOD_REGX = new RegExp(`^[^${escape(NOT_SYMBOL)}].*$`);
13
-
14
- // src/tags/filter.ts
15
- var matchFilter = (strParam = "") => (tags) => {
16
- const str = strParam.trim();
17
- if (typeof tags === "string") {
18
- tags = [tags];
19
- }
20
- if (str.includes(OR_SYMBOL)) {
21
- const include2 = goodTags(str.split(OR_REGX));
22
- const exclude2 = badTags(str.split(OR_REGX));
23
- if (exclude2.length === 0) {
24
- return include2.length === 0 || include2.some((s) => tags.includes(s));
25
- }
26
- if (include2.length === 0 && exclude2.length !== 0) {
27
- return exclude2.some((s) => !tags.includes(s));
28
- }
29
- return include2.length === 0 || include2.some((s) => tags.includes(s)) || exclude2.some((s) => !tags.includes(s));
30
- }
31
- if (str.includes(AND_SYMBOL)) {
32
- const include2 = goodTags(str.split(AND_REGX));
33
- const exclude2 = badTags(str.split(AND_REGX));
34
- return (include2.length === 0 || include2.every((s) => tags.includes(s))) && !exclude2.some((s) => tags.includes(s));
35
- }
36
- const include = goodTags(str.split(PLAIN_REGX));
37
- const exclude = badTags(str.split(PLAIN_REGX));
38
- return (include.length === 0 || include.some((s) => tags.includes(s))) && !exclude.some((s) => tags.includes(s));
39
- };
40
- var goodTags = (arr) => {
41
- return arr.filter((s) => s.match(GOOD_REGX));
42
- };
43
- var badTags = (arr) => {
44
- return arr.filter((s) => s.match(BAD_REGX)).map((s) => s.replace(NOT_SYMBOL, ""));
45
- };
46
- export {
47
- matchFilter
48
- };
49
- //# sourceMappingURL=filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/tags/config.ts","../../../src/tags/regexps.ts","../../../src/tags/filter.ts"],"sourcesContent":["export const NOT_SYMBOL = '!'\n\nexport const AND_SYMBOL = '&&'\n\nexport const OR_SYMBOL = '||'\n\nexport const RESERVED_COMMANDS = ['--tags']\n","import { AND_SYMBOL, NOT_SYMBOL, OR_SYMBOL } from './config'\n\nexport const escape = (str: string) =>\n str\n .split('')\n .map((symbol) => `\\\\${symbol}`)\n .join('')\n\nexport const AND_REGX = new RegExp(`\\\\s*${escape(AND_SYMBOL)}\\\\s*`)\n\nexport const OR_REGX = new RegExp(`\\\\s*${escape(OR_SYMBOL)}\\\\s*`)\n\nexport const PLAIN_REGX = new RegExp('\\\\s+')\n\nexport const BAD_REGX = new RegExp(`^${escape(NOT_SYMBOL)}.*$`)\n\nexport const GOOD_REGX = new RegExp(`^[^${escape(NOT_SYMBOL)}].*$`)\n","import { AND_SYMBOL, NOT_SYMBOL, OR_SYMBOL } from './config'\nimport { AND_REGX, BAD_REGX, GOOD_REGX, OR_REGX, PLAIN_REGX } from './regexps'\n\n// f.e. tag1 !tag2\n// tag1 && tag2 && !tag3\n// tag1 || tag2 || !tag3\n\n//ATTENTION!!: cases with () not handled: f.e. (tag1 && tag2) || tag3 won`t work\n\nexport const matchFilter =\n (strParam = '') =>\n (tags: string[]) => {\n const str = strParam.trim()\n if (typeof tags === 'string') {\n tags = [tags]\n }\n if (str.includes(OR_SYMBOL)) {\n const include = goodTags(str.split(OR_REGX))\n const exclude = badTags(str.split(OR_REGX))\n if (exclude.length === 0) {\n return include.length === 0 || include.some((s) => tags.includes(s))\n }\n if (include.length === 0 && exclude.length !== 0) {\n return exclude.some((s) => !tags.includes(s))\n }\n return include.length === 0 || include.some((s) => tags.includes(s)) || exclude.some((s) => !tags.includes(s))\n }\n if (str.includes(AND_SYMBOL)) {\n const include = goodTags(str.split(AND_REGX))\n const exclude = badTags(str.split(AND_REGX))\n\n return (include.length === 0 || include.every((s) => tags.includes(s))) && !exclude.some((s) => tags.includes(s))\n }\n const include = goodTags(str.split(PLAIN_REGX))\n const exclude = badTags(str.split(PLAIN_REGX))\n\n return (include.length === 0 || include.some((s) => tags.includes(s))) && !exclude.some((s) => tags.includes(s))\n }\n\nconst goodTags = (arr: string[]) => {\n return arr.filter((s) => s.match(GOOD_REGX))\n}\n\nconst badTags = (arr: string[]) => {\n return arr.filter((s) => s.match(BAD_REGX)).map((s) => s.replace(NOT_SYMBOL, ''))\n}\n"],"mappings":";AAAO,IAAM,aAAa;AAEnB,IAAM,aAAa;AAEnB,IAAM,YAAY;;;ACFlB,IAAM,SAAS,CAAC,QACrB,IACG,MAAM,EAAE,EACR,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE,EAC7B,KAAK,EAAE;AAEL,IAAM,WAAW,IAAI,OAAO,OAAO,OAAO,UAAU,CAAC,MAAM;AAE3D,IAAM,UAAU,IAAI,OAAO,OAAO,OAAO,SAAS,CAAC,MAAM;AAEzD,IAAM,aAAa,IAAI,OAAO,MAAM;AAEpC,IAAM,WAAW,IAAI,OAAO,IAAI,OAAO,UAAU,CAAC,KAAK;AAEvD,IAAM,YAAY,IAAI,OAAO,MAAM,OAAO,UAAU,CAAC,MAAM;;;ACP3D,IAAM,cACX,CAAC,WAAW,OACZ,CAAC,SAAmB;AAClB,QAAM,MAAM,SAAS,KAAK;AAC1B,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,CAAC,IAAI;AAAA,EACd;AACA,MAAI,IAAI,SAAS,SAAS,GAAG;AAC3B,UAAMA,WAAU,SAAS,IAAI,MAAM,OAAO,CAAC;AAC3C,UAAMC,WAAU,QAAQ,IAAI,MAAM,OAAO,CAAC;AAC1C,QAAIA,SAAQ,WAAW,GAAG;AACxB,aAAOD,SAAQ,WAAW,KAAKA,SAAQ,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;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wnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/tags/index.ts
21
- var tags_exports = {};
22
- __export(tags_exports, {
23
- tags: () => tags
24
- });
25
- module.exports = __toCommonJS(tags_exports);
26
-
27
- // src/describeIf.ts
28
- var describeIf = (expr) => expr ? describe : describe.skip;
29
-
30
- // src/itIf.ts
31
- var itIf = (expr) => expr ? it : it.skip;
32
-
33
- // src/testIf.ts
34
- var testIf = (expr) => expr ? test : test.skip;
35
-
36
- // src/tags/config.ts
37
- var NOT_SYMBOL = "!";
38
- var AND_SYMBOL = "&&";
39
- var OR_SYMBOL = "||";
40
-
41
- // src/tags/regexps.ts
42
- var escape = (str) => str.split("").map((symbol) => `\\${symbol}`).join("");
43
- var AND_REGX = new RegExp(`\\s*${escape(AND_SYMBOL)}\\s*`);
44
- var OR_REGX = new RegExp(`\\s*${escape(OR_SYMBOL)}\\s*`);
45
- var PLAIN_REGX = new RegExp("\\s+");
46
- var BAD_REGX = new RegExp(`^${escape(NOT_SYMBOL)}.*$`);
47
- var GOOD_REGX = new RegExp(`^[^${escape(NOT_SYMBOL)}].*$`);
48
-
49
- // src/tags/filter.ts
50
- var matchFilter = (strParam = "") => (tags2) => {
51
- const str = strParam.trim();
52
- if (typeof tags2 === "string") {
53
- tags2 = [tags2];
54
- }
55
- if (str.includes(OR_SYMBOL)) {
56
- const include2 = goodTags(str.split(OR_REGX));
57
- const exclude2 = badTags(str.split(OR_REGX));
58
- if (exclude2.length === 0) {
59
- return include2.length === 0 || include2.some((s) => tags2.includes(s));
60
- }
61
- if (include2.length === 0 && exclude2.length !== 0) {
62
- return exclude2.some((s) => !tags2.includes(s));
63
- }
64
- return include2.length === 0 || include2.some((s) => tags2.includes(s)) || exclude2.some((s) => !tags2.includes(s));
65
- }
66
- if (str.includes(AND_SYMBOL)) {
67
- const include2 = goodTags(str.split(AND_REGX));
68
- const exclude2 = badTags(str.split(AND_REGX));
69
- return (include2.length === 0 || include2.every((s) => tags2.includes(s))) && !exclude2.some((s) => tags2.includes(s));
70
- }
71
- const include = goodTags(str.split(PLAIN_REGX));
72
- const exclude = badTags(str.split(PLAIN_REGX));
73
- return (include.length === 0 || include.some((s) => tags2.includes(s))) && !exclude.some((s) => tags2.includes(s));
74
- };
75
- var goodTags = (arr) => {
76
- return arr.filter((s) => s.match(GOOD_REGX));
77
- };
78
- var badTags = (arr) => {
79
- return arr.filter((s) => s.match(BAD_REGX)).map((s) => s.replace(NOT_SYMBOL, ""));
80
- };
81
-
82
- // src/tags/index.ts
83
- function tags(...tagLabels) {
84
- const tagsParam = process.argv.findIndex((item) => item === "--tags");
85
- const passedTags = tagsParam > 0 ? process.argv[tagsParam + 1] : void 0;
86
- const filter = matchFilter(passedTags);
87
- const thisGlobal = global;
88
- const chain = {};
89
- const filterMatch = filter(tagLabels);
90
- chain.describeIf = filterMatch ? describeIf : (_param) => describe.skip;
91
- chain.itIf = filterMatch ? itIf : (_param) => it.skip;
92
- chain.testIf = filterMatch ? testIf : (_param) => test.skip;
93
- chain.describe = filterMatch ? thisGlobal.describe : thisGlobal.xdescribe;
94
- chain.it = filterMatch ? thisGlobal.it : thisGlobal.xit;
95
- chain.test = filterMatch ? thisGlobal.test : thisGlobal.xtest;
96
- chain.test.only = thisGlobal.test.only;
97
- chain.test.skip = thisGlobal.test.skip;
98
- chain.xtest = thisGlobal.xtest;
99
- chain.xit = thisGlobal.xit;
100
- return chain;
101
- }
102
- // Annotate the CommonJS export names for ESM import in node:
103
- 0 && (module.exports = {
104
- tags
105
- });
106
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/tags/index.ts","../../../src/describeIf.ts","../../../src/itIf.ts","../../../src/testIf.ts","../../../src/tags/config.ts","../../../src/tags/regexps.ts","../../../src/tags/filter.ts"],"sourcesContent":["import { describeIf } from '../describeIf'\nimport { itIf } from '../itIf'\nimport { testIf } from '../testIf'\nimport { matchFilter } from './filter'\n\n//Based on https://www.npmjs.com/package/jest-tags/v/1.0.1\n\nexport function tags(...tagLabels: string[]) {\n const tagsParam = process.argv.findIndex((item) => item === '--tags')\n const passedTags = tagsParam > 0 ? process.argv[tagsParam + 1] : undefined\n const filter = matchFilter(passedTags)\n const thisGlobal = global\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const chain: Record<string, any> = {}\n\n const filterMatch = filter(tagLabels)\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n chain.describeIf = filterMatch ? describeIf : (_param: any) => describe.skip\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n chain.itIf = filterMatch ? itIf : (_param: any) => it.skip\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n chain.testIf = filterMatch ? testIf : (_param: any) => test.skip\n chain.describe = filterMatch ? thisGlobal.describe : thisGlobal.xdescribe\n chain.it = filterMatch ? thisGlobal.it : thisGlobal.xit\n chain.test = filterMatch ? thisGlobal.test : thisGlobal.xtest\n chain.test.only = thisGlobal.test.only\n chain.test.skip = thisGlobal.test.skip\n chain.xtest = thisGlobal.xtest\n chain.xit = thisGlobal.xit\n\n return chain\n}\n","/**\n * Conditionally runs or skips the describe\n * @param expr The condition to evaluate\n * @returns If the condition is true, describe, otherwise skips\n */\nexport const describeIf = <T>(expr?: T | null) => (expr ? describe : describe.skip)\n","/**\n * Conditionally runs or skips the it\n * @param expr The condition to evaluate\n * @returns If the condition is true, it, otherwise skips\n */\nexport const itIf = <T>(expr?: T | null) => (expr ? it : it.skip)\n","/**\n * Conditionally runs or skips the test\n * @param expr The condition to evaluate\n * @returns If the condition is true, test, otherwise skips\n */\nexport const testIf = <T>(expr?: T | null) => (expr ? test : test.skip)\n","export const NOT_SYMBOL = '!'\n\nexport const AND_SYMBOL = '&&'\n\nexport const OR_SYMBOL = '||'\n\nexport const RESERVED_COMMANDS = ['--tags']\n","import { AND_SYMBOL, NOT_SYMBOL, OR_SYMBOL } from './config'\n\nexport const escape = (str: string) =>\n str\n .split('')\n .map((symbol) => `\\\\${symbol}`)\n .join('')\n\nexport const AND_REGX = new RegExp(`\\\\s*${escape(AND_SYMBOL)}\\\\s*`)\n\nexport const OR_REGX = new RegExp(`\\\\s*${escape(OR_SYMBOL)}\\\\s*`)\n\nexport const PLAIN_REGX = new RegExp('\\\\s+')\n\nexport const BAD_REGX = new RegExp(`^${escape(NOT_SYMBOL)}.*$`)\n\nexport const GOOD_REGX = new RegExp(`^[^${escape(NOT_SYMBOL)}].*$`)\n","import { AND_SYMBOL, NOT_SYMBOL, OR_SYMBOL } from './config'\nimport { AND_REGX, BAD_REGX, GOOD_REGX, OR_REGX, PLAIN_REGX } from './regexps'\n\n// f.e. tag1 !tag2\n// tag1 && tag2 && !tag3\n// tag1 || tag2 || !tag3\n\n//ATTENTION!!: cases with () not handled: f.e. (tag1 && tag2) || tag3 won`t work\n\nexport const matchFilter =\n (strParam = '') =>\n (tags: string[]) => {\n const str = strParam.trim()\n if (typeof tags === 'string') {\n tags = [tags]\n }\n if (str.includes(OR_SYMBOL)) {\n const include = goodTags(str.split(OR_REGX))\n const exclude = badTags(str.split(OR_REGX))\n if (exclude.length === 0) {\n return include.length === 0 || include.some((s) => tags.includes(s))\n }\n if (include.length === 0 && exclude.length !== 0) {\n return exclude.some((s) => !tags.includes(s))\n }\n return include.length === 0 || include.some((s) => tags.includes(s)) || exclude.some((s) => !tags.includes(s))\n }\n if (str.includes(AND_SYMBOL)) {\n const include = goodTags(str.split(AND_REGX))\n const exclude = badTags(str.split(AND_REGX))\n\n return (include.length === 0 || include.every((s) => tags.includes(s))) && !exclude.some((s) => tags.includes(s))\n }\n const include = goodTags(str.split(PLAIN_REGX))\n const exclude = badTags(str.split(PLAIN_REGX))\n\n return (include.length === 0 || include.some((s) => tags.includes(s))) && !exclude.some((s) => tags.includes(s))\n }\n\nconst goodTags = (arr: string[]) => {\n return arr.filter((s) => s.match(GOOD_REGX))\n}\n\nconst badTags = (arr: string[]) => {\n return arr.filter((s) => s.match(BAD_REGX)).map((s) => s.replace(NOT_SYMBOL, ''))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,aAAa,CAAI,SAAqB,OAAO,WAAW,SAAS;;;ACAvE,IAAM,OAAO,CAAI,SAAqB,OAAO,KAAK,GAAG;;;ACArD,IAAM,SAAS,CAAI,SAAqB,OAAO,OAAO,KAAK;;;ACL3D,IAAM,aAAa;AAEnB,IAAM,aAAa;AAEnB,IAAM,YAAY;;;ACFlB,IAAM,SAAS,CAAC,QACrB,IACG,MAAM,EAAE,EACR,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE,EAC7B,KAAK,EAAE;AAEL,IAAM,WAAW,IAAI,OAAO,OAAO,OAAO,UAAU,CAAC,MAAM;AAE3D,IAAM,UAAU,IAAI,OAAO,OAAO,OAAO,SAAS,CAAC,MAAM;AAEzD,IAAM,aAAa,IAAI,OAAO,MAAM;AAEpC,IAAM,WAAW,IAAI,OAAO,IAAI,OAAO,UAAU,CAAC,KAAK;AAEvD,IAAM,YAAY,IAAI,OAAO,MAAM,OAAO,UAAU,CAAC,MAAM;;;ACP3D,IAAM,cACX,CAAC,WAAW,OACZ,CAACA,UAAmB;AAClB,QAAM,MAAM,SAAS,KAAK;AAC1B,MAAI,OAAOA,UAAS,UAAU;AAC5B,IAAAA,QAAO,CAACA,KAAI;AAAA,EACd;AACA,MAAI,IAAI,SAAS,SAAS,GAAG;AAC3B,UAAMC,WAA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M,QAAQ,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,YAAY,EAAE,CAAC;AAClF;;;ANtCO,SAAS,QAAQ,WAAqB;AAC3C,QAAM,YAAY,QAAQ,KAAK,UAAU,CAAC,SAAS,SAAS,QAAQ;AACpE,QAAM,aAAa,YAAY,IAAI,QAAQ,KAAK,YAAY,CAAC,IAAI;AACjE,QAAM,SAAS,YAAY,UAAU;AACrC,QAAM,aAAa;AAGnB,QAAM,QAA6B,CAAC;AAEpC,QAAM,cAAc,OAAO,SAAS;AAGpC,QAAM,aAAa,cAAc,aAAa,CAAC,WAAgB,SAAS;AAExE,QAAM,OAAO,cAAc,OAAO,CAAC,WAAgB,GAAG;AAEtD,QAAM,SAAS,cAAc,SAAS,CAAC,WAAgB,KAAK;AAC5D,QAAM,WAAW,cAAc,WAAW,WAAW,WAAW;AAChE,QAAM,KAAK,cAAc,WAAW,KAAK,WAAW;AACpD,QAAM,OAAO,cAAc,WAAW,OAAO,WAAW;AACxD,QAAM,KAAK,OAAO,WAAW,KAAK;AAClC,QAAM,KAAK,OAAO,WAAW,KAAK;AAClC,QAAM,QAAQ,WAAW;AACzB,QAAM,MAAM,WAAW;AAEvB,SAAO;AACT;","names":["tags","include","exclude"]}
@@ -1,79 +0,0 @@
1
- // src/describeIf.ts
2
- var describeIf = (expr) => expr ? describe : describe.skip;
3
-
4
- // src/itIf.ts
5
- var itIf = (expr) => expr ? it : it.skip;
6
-
7
- // src/testIf.ts
8
- var testIf = (expr) => expr ? test : test.skip;
9
-
10
- // src/tags/config.ts
11
- var NOT_SYMBOL = "!";
12
- var AND_SYMBOL = "&&";
13
- var OR_SYMBOL = "||";
14
-
15
- // src/tags/regexps.ts
16
- var escape = (str) => str.split("").map((symbol) => `\\${symbol}`).join("");
17
- var AND_REGX = new RegExp(`\\s*${escape(AND_SYMBOL)}\\s*`);
18
- var OR_REGX = new RegExp(`\\s*${escape(OR_SYMBOL)}\\s*`);
19
- var PLAIN_REGX = new RegExp("\\s+");
20
- var BAD_REGX = new RegExp(`^${escape(NOT_SYMBOL)}.*$`);
21
- var GOOD_REGX = new RegExp(`^[^${escape(NOT_SYMBOL)}].*$`);
22
-
23
- // src/tags/filter.ts
24
- var matchFilter = (strParam = "") => (tags2) => {
25
- const str = strParam.trim();
26
- if (typeof tags2 === "string") {
27
- tags2 = [tags2];
28
- }
29
- if (str.includes(OR_SYMBOL)) {
30
- const include2 = goodTags(str.split(OR_REGX));
31
- const exclude2 = badTags(str.split(OR_REGX));
32
- if (exclude2.length === 0) {
33
- return include2.length === 0 || include2.some((s) => tags2.includes(s));
34
- }
35
- if (include2.length === 0 && exclude2.length !== 0) {
36
- return exclude2.some((s) => !tags2.includes(s));
37
- }
38
- return include2.length === 0 || include2.some((s) => tags2.includes(s)) || exclude2.some((s) => !tags2.includes(s));
39
- }
40
- if (str.includes(AND_SYMBOL)) {
41
- const include2 = goodTags(str.split(AND_REGX));
42
- const exclude2 = badTags(str.split(AND_REGX));
43
- return (include2.length === 0 || include2.every((s) => tags2.includes(s))) && !exclude2.some((s) => tags2.includes(s));
44
- }
45
- const include = goodTags(str.split(PLAIN_REGX));
46
- const exclude = badTags(str.split(PLAIN_REGX));
47
- return (include.length === 0 || include.some((s) => tags2.includes(s))) && !exclude.some((s) => tags2.includes(s));
48
- };
49
- var goodTags = (arr) => {
50
- return arr.filter((s) => s.match(GOOD_REGX));
51
- };
52
- var badTags = (arr) => {
53
- return arr.filter((s) => s.match(BAD_REGX)).map((s) => s.replace(NOT_SYMBOL, ""));
54
- };
55
-
56
- // src/tags/index.ts
57
- function tags(...tagLabels) {
58
- const tagsParam = process.argv.findIndex((item) => item === "--tags");
59
- const passedTags = tagsParam > 0 ? process.argv[tagsParam + 1] : void 0;
60
- const filter = matchFilter(passedTags);
61
- const thisGlobal = global;
62
- const chain = {};
63
- const filterMatch = filter(tagLabels);
64
- chain.describeIf = filterMatch ? describeIf : (_param) => describe.skip;
65
- chain.itIf = filterMatch ? itIf : (_param) => it.skip;
66
- chain.testIf = filterMatch ? testIf : (_param) => test.skip;
67
- chain.describe = filterMatch ? thisGlobal.describe : thisGlobal.xdescribe;
68
- chain.it = filterMatch ? thisGlobal.it : thisGlobal.xit;
69
- chain.test = filterMatch ? thisGlobal.test : thisGlobal.xtest;
70
- chain.test.only = thisGlobal.test.only;
71
- chain.test.skip = thisGlobal.test.skip;
72
- chain.xtest = thisGlobal.xtest;
73
- chain.xit = thisGlobal.xit;
74
- return chain;
75
- }
76
- export {
77
- tags
78
- };
79
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/describeIf.ts","../../../src/itIf.ts","../../../src/testIf.ts","../../../src/tags/config.ts","../../../src/tags/regexps.ts","../../../src/tags/filter.ts","../../../src/tags/index.ts"],"sourcesContent":["/**\n * Conditionally runs or skips the describe\n * @param expr The condition to evaluate\n * @returns If the condition is true, describe, otherwise skips\n */\nexport const describeIf = <T>(expr?: T | null) => (expr ? describe : describe.skip)\n","/**\n * Conditionally runs or skips the it\n * @param expr The condition to evaluate\n * @returns If the condition is true, it, otherwise skips\n */\nexport const itIf = <T>(expr?: T | null) => (expr ? it : it.skip)\n","/**\n * Conditionally runs or skips the test\n * @param expr The condition to evaluate\n * @returns If the condition is true, test, otherwise skips\n */\nexport const testIf = <T>(expr?: T | null) => (expr ? test : test.skip)\n","export const NOT_SYMBOL = '!'\n\nexport const AND_SYMBOL = '&&'\n\nexport const OR_SYMBOL = '||'\n\nexport const RESERVED_COMMANDS = ['--tags']\n","import { AND_SYMBOL, NOT_SYMBOL, OR_SYMBOL } from './config'\n\nexport const escape = (str: string) =>\n str\n .split('')\n .map((symbol) => `\\\\${symbol}`)\n .join('')\n\nexport const AND_REGX = new RegExp(`\\\\s*${escape(AND_SYMBOL)}\\\\s*`)\n\nexport const OR_REGX = new RegExp(`\\\\s*${escape(OR_SYMBOL)}\\\\s*`)\n\nexport const PLAIN_REGX = new RegExp('\\\\s+')\n\nexport const BAD_REGX = new RegExp(`^${escape(NOT_SYMBOL)}.*$`)\n\nexport const GOOD_REGX = new RegExp(`^[^${escape(NOT_SYMBOL)}].*$`)\n","import { AND_SYMBOL, NOT_SYMBOL, OR_SYMBOL } from './config'\nimport { AND_REGX, BAD_REGX, GOOD_REGX, OR_REGX, PLAIN_REGX } from './regexps'\n\n// f.e. tag1 !tag2\n// tag1 && tag2 && !tag3\n// tag1 || tag2 || !tag3\n\n//ATTENTION!!: cases with () not handled: f.e. (tag1 && tag2) || tag3 won`t work\n\nexport const matchFilter =\n (strParam = '') =>\n (tags: string[]) => {\n const str = strParam.trim()\n if (typeof tags === 'string') {\n tags = [tags]\n }\n if (str.includes(OR_SYMBOL)) {\n const include = goodTags(str.split(OR_REGX))\n const exclude = badTags(str.split(OR_REGX))\n if (exclude.length === 0) {\n return include.length === 0 || include.some((s) => tags.includes(s))\n }\n if (include.length === 0 && exclude.length !== 0) {\n return exclude.some((s) => !tags.includes(s))\n }\n return include.length === 0 || include.some((s) => tags.includes(s)) || exclude.some((s) => !tags.includes(s))\n }\n if (str.includes(AND_SYMBOL)) {\n const include = goodTags(str.split(AND_REGX))\n const exclude = badTags(str.split(AND_REGX))\n\n return (include.length === 0 || include.every((s) => tags.includes(s))) && !exclude.some((s) => tags.includes(s))\n }\n const include = goodTags(str.split(PLAIN_REGX))\n const exclude = badTags(str.split(PLAIN_REGX))\n\n return (include.length === 0 || include.some((s) => tags.includes(s))) && !exclude.some((s) => tags.includes(s))\n }\n\nconst goodTags = (arr: string[]) => {\n return arr.filter((s) => s.match(GOOD_REGX))\n}\n\nconst badTags = (arr: string[]) => {\n return arr.filter((s) => s.match(BAD_REGX)).map((s) => s.replace(NOT_SYMBOL, ''))\n}\n","import { describeIf } from '../describeIf'\nimport { itIf } from '../itIf'\nimport { testIf } from '../testIf'\nimport { matchFilter } from './filter'\n\n//Based on https://www.npmjs.com/package/jest-tags/v/1.0.1\n\nexport function tags(...tagLabels: string[]) {\n const tagsParam = process.argv.findIndex((item) => item === '--tags')\n const passedTags = tagsParam > 0 ? process.argv[tagsParam + 1] : undefined\n const filter = matchFilter(passedTags)\n const thisGlobal = global\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const chain: Record<string, any> = {}\n\n const filterMatch = filter(tagLabels)\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n chain.describeIf = filterMatch ? describeIf : (_param: any) => describe.skip\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n chain.itIf = filterMatch ? itIf : (_param: any) => it.skip\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n chain.testIf = filterMatch ? testIf : (_param: any) => test.skip\n chain.describe = filterMatch ? thisGlobal.describe : thisGlobal.xdescribe\n chain.it = filterMatch ? thisGlobal.it : thisGlobal.xit\n chain.test = filterMatch ? thisGlobal.test : thisGlobal.xtest\n chain.test.only = thisGlobal.test.only\n chain.test.skip = thisGlobal.test.skip\n chain.xtest = thisGlobal.xtest\n chain.xit = thisGlobal.xit\n\n return chain\n}\n"],"mappings":";AAKO,IAAM,aAAa,CAAI,SAAqB,OAAO,WAAW,SAAS;;;ACAvE,IAAM,OAAO,CAAI,SAAqB,OAAO,KAAK,GAAG;;;ACArD,IAAM,SAAS,CAAI,SAAqB,OAAO,OAAO,KAAK;;;ACL3D,IAAM,aAAa;AAEnB,IAAM,aAAa;AAEnB,IAAM,YAAY;;;ACFlB,IAAM,SAAS,CAAC,QACrB,IACG,MAAM,EAAE,EACR,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE,EAC7B,KAAK,EAAE;AAEL,IAAM,WAAW,IAAI,OAAO,OAAO,OAAO,UAAU,CAAC,MAAM;AAE3D,IAAM,UAAU,IAAI,OAAO,OAAO,OAAO,SAAS,CAAC,MAAM;AAEzD,IAAM,aAAa,IAAI,OAAO,MAAM;AAEpC,IAAM,WAAW,IAAI,OAAO,IAAI,OAAO,UAAU,CAAC,KAAK;AAEvD,IAAM,YAAY,IAAI,OAAO,MAAM,OAAO,UAAU,CAAC,MAAM;;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