ts2famix 1.0.13 → 1.0.15

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 (135) hide show
  1. package/.eslintrc.json +24 -24
  2. package/LICENSE +23 -23
  3. package/README.md +109 -109
  4. package/dist/analyze.js +107 -0
  5. package/dist/analyze_functions/processAccesses.js +55 -0
  6. package/dist/analyze_functions/processFiles.js +554 -0
  7. package/dist/analyze_functions/processImportClauses.js +70 -0
  8. package/dist/analyze_functions/processInheritances.js +73 -0
  9. package/dist/analyze_functions/processInvocations.js +49 -0
  10. package/dist/famix2puml.js +125 -0
  11. package/dist/famix_functions/famix_functions.js +525 -0
  12. package/dist/famix_functions/famix_functions_associations.js +223 -0
  13. package/dist/famix_functions/famix_functions_index.js +62 -0
  14. package/dist/famix_functions/famix_functions_types.js +114 -0
  15. package/dist/fqn.js +126 -0
  16. package/dist/lib/famix/src/famix_JSON_exporter.js +54 -0
  17. package/dist/lib/famix/src/famix_base_element.js +13 -0
  18. package/dist/lib/famix/src/famix_repository.js +199 -0
  19. package/dist/lib/famix/src/index.js +30 -0
  20. package/dist/lib/famix/src/model/famix/access.js +39 -0
  21. package/dist/lib/famix/src/model/famix/accessor.js +16 -0
  22. package/dist/lib/famix/src/model/famix/alias.js +32 -0
  23. package/dist/lib/famix/src/model/famix/association.js +36 -0
  24. package/dist/lib/famix/src/model/famix/behavioral_entity.js +81 -0
  25. package/dist/lib/famix/src/model/famix/c_source_language.js +16 -0
  26. package/dist/lib/famix/src/model/famix/class.js +70 -0
  27. package/dist/lib/famix/src/model/famix/comment.js +38 -0
  28. package/dist/lib/famix/src/model/famix/container_entity.js +125 -0
  29. package/dist/lib/famix/src/model/famix/custom_source_language.js +23 -0
  30. package/dist/lib/famix/src/model/famix/decorator.js +31 -0
  31. package/dist/lib/famix/src/model/famix/entity.js +16 -0
  32. package/dist/lib/famix/src/model/famix/enum.js +30 -0
  33. package/dist/lib/famix/src/model/famix/enum_value.js +24 -0
  34. package/dist/lib/famix/src/model/famix/function.js +16 -0
  35. package/dist/lib/famix/src/model/famix/implicit_variable.js +16 -0
  36. package/dist/lib/famix/src/model/famix/import_clause.js +39 -0
  37. package/dist/lib/famix/src/model/famix/index.js +87 -0
  38. package/dist/lib/famix/src/model/famix/indexed_file_anchor.js +37 -0
  39. package/dist/lib/famix/src/model/famix/inheritance.js +32 -0
  40. package/dist/lib/famix/src/model/famix/interface.js +63 -0
  41. package/dist/lib/famix/src/model/famix/invocation.js +53 -0
  42. package/dist/lib/famix/src/model/famix/method.js +66 -0
  43. package/dist/lib/famix/src/model/famix/module.js +31 -0
  44. package/dist/lib/famix/src/model/famix/named_entity.js +77 -0
  45. package/dist/lib/famix/src/model/famix/namespace.js +24 -0
  46. package/dist/lib/famix/src/model/famix/parameter.js +24 -0
  47. package/dist/lib/famix/src/model/famix/parameterizable_class.js +30 -0
  48. package/dist/lib/famix/src/model/famix/parameterizable_interface.js +30 -0
  49. package/dist/lib/famix/src/model/famix/parameterized_type.js +36 -0
  50. package/dist/lib/famix/src/model/famix/primitive_type.js +16 -0
  51. package/dist/lib/famix/src/model/famix/property.js +44 -0
  52. package/dist/lib/famix/src/model/famix/reference.js +32 -0
  53. package/dist/lib/famix/src/model/famix/scoping_entity.js +34 -0
  54. package/dist/lib/famix/src/model/famix/script_entity.js +30 -0
  55. package/dist/lib/famix/src/model/famix/source_anchor.js +26 -0
  56. package/dist/lib/famix/src/model/famix/source_language.js +30 -0
  57. package/dist/lib/famix/src/model/famix/sourced_entity.js +55 -0
  58. package/dist/lib/famix/src/model/famix/structural_entity.js +38 -0
  59. package/dist/lib/famix/src/model/famix/text_anchor.js +37 -0
  60. package/dist/lib/famix/src/model/famix/type.js +71 -0
  61. package/dist/lib/famix/src/model/famix/type_parameter.js +24 -0
  62. package/dist/lib/famix/src/model/famix/variable.js +23 -0
  63. package/dist/lib/ts-complex/cyclomatic-service.js +83 -0
  64. package/dist/ts2famix-cli.js +63 -0
  65. package/dist/ts2famix-tsconfig.js +53 -0
  66. package/jest.config-old.ts +199 -199
  67. package/package.json +47 -47
  68. package/src/analyze.ts +94 -94
  69. package/src/analyze_functions/processAccesses.ts +57 -57
  70. package/src/analyze_functions/processFiles.ts +669 -669
  71. package/src/analyze_functions/processImportClauses.ts +77 -77
  72. package/src/analyze_functions/processInheritances.ts +84 -84
  73. package/src/analyze_functions/processInvocations.ts +51 -51
  74. package/src/famix2puml.ts +119 -119
  75. package/src/famix_functions/famix_functions.ts +565 -559
  76. package/src/famix_functions/famix_functions_associations.ts +225 -215
  77. package/src/famix_functions/famix_functions_index.ts +44 -44
  78. package/src/famix_functions/famix_functions_types.ts +105 -105
  79. package/src/generate_uml.sh +16 -16
  80. package/src/lib/famix/License.md +22 -22
  81. package/src/lib/famix/package-lock.json +301 -301
  82. package/src/lib/famix/package.json +27 -27
  83. package/src/lib/famix/readme.md +4 -4
  84. package/src/lib/famix/src/famix_JSON_exporter.ts +56 -56
  85. package/src/lib/famix/src/famix_base_element.ts +18 -18
  86. package/src/lib/famix/src/famix_repository.ts +212 -199
  87. package/src/lib/famix/src/index.ts +8 -8
  88. package/src/lib/famix/src/model/famix/access.ts +53 -53
  89. package/src/lib/famix/src/model/famix/accessor.ts +15 -15
  90. package/src/lib/famix/src/model/famix/alias.ts +41 -41
  91. package/src/lib/famix/src/model/famix/association.ts +44 -44
  92. package/src/lib/famix/src/model/famix/behavioral_entity.ts +107 -107
  93. package/src/lib/famix/src/model/famix/c_source_language.ts +15 -15
  94. package/src/lib/famix/src/model/famix/class.ts +86 -86
  95. package/src/lib/famix/src/model/famix/comment.ts +50 -50
  96. package/src/lib/famix/src/model/famix/container_entity.ts +165 -165
  97. package/src/lib/famix/src/model/famix/custom_source_language.ts +27 -27
  98. package/src/lib/famix/src/model/famix/decorator.ts +39 -39
  99. package/src/lib/famix/src/model/famix/entity.ts +15 -15
  100. package/src/lib/famix/src/model/famix/enum.ts +31 -31
  101. package/src/lib/famix/src/model/famix/enum_value.ts +29 -29
  102. package/src/lib/famix/src/model/famix/function.ts +15 -15
  103. package/src/lib/famix/src/model/famix/implicit_variable.ts +15 -15
  104. package/src/lib/famix/src/model/famix/import_clause.ts +53 -53
  105. package/src/lib/famix/src/model/famix/index.ts +42 -42
  106. package/src/lib/famix/src/model/famix/indexed_file_anchor.ts +49 -49
  107. package/src/lib/famix/src/model/famix/inheritance.ts +42 -42
  108. package/src/lib/famix/src/model/famix/interface.ts +75 -75
  109. package/src/lib/famix/src/model/famix/invocation.ts +68 -68
  110. package/src/lib/famix/src/model/famix/method.ts +96 -96
  111. package/src/lib/famix/src/model/famix/module.ts +31 -31
  112. package/src/lib/famix/src/model/famix/named_entity.ts +98 -98
  113. package/src/lib/famix/src/model/famix/namespace.ts +28 -28
  114. package/src/lib/famix/src/model/famix/parameter.ts +29 -29
  115. package/src/lib/famix/src/model/famix/parameterizable_class.ts +31 -31
  116. package/src/lib/famix/src/model/famix/parameterizable_interface.ts +31 -31
  117. package/src/lib/famix/src/model/famix/parameterized_type.ts +40 -40
  118. package/src/lib/famix/src/model/famix/primitive_type.ts +15 -15
  119. package/src/lib/famix/src/model/famix/property.ts +54 -54
  120. package/src/lib/famix/src/model/famix/reference.ts +42 -42
  121. package/src/lib/famix/src/model/famix/scoping_entity.ts +34 -31
  122. package/src/lib/famix/src/model/famix/script_entity.ts +38 -38
  123. package/src/lib/famix/src/model/famix/source_anchor.ts +31 -31
  124. package/src/lib/famix/src/model/famix/source_language.ts +31 -31
  125. package/src/lib/famix/src/model/famix/sourced_entity.ts +70 -70
  126. package/src/lib/famix/src/model/famix/structural_entity.ts +44 -44
  127. package/src/lib/famix/src/model/famix/text_anchor.ts +49 -49
  128. package/src/lib/famix/src/model/famix/type.ts +88 -88
  129. package/src/lib/famix/src/model/famix/type_parameter.ts +33 -33
  130. package/src/lib/famix/src/model/famix/variable.ts +28 -28
  131. package/src/lib/famix/tsconfig.json +26 -26
  132. package/src/lib/famix/tslint.json +14 -14
  133. package/src/lib/ts-complex/cyclomatic-service.ts +85 -85
  134. package/src/ts2famix-cli.ts +39 -39
  135. package/tsconfig.json +69 -69
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /*
3
+ Portions of this file:
4
+
5
+ MIT License
6
+
7
+ Copyright (c) 2018 Anand Undavia
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.calculate = void 0;
17
+ const typescript_1 = require("typescript");
18
+ const tsutils_1 = require("tsutils");
19
+ const fs_1 = require("fs");
20
+ const { isIdentifier } = require('typescript');
21
+ const getNodeName = (node) => {
22
+ const { name, pos, end } = node;
23
+ const key = name !== undefined && isIdentifier(name) ? name.text : JSON.stringify({ pos, end });
24
+ return key;
25
+ };
26
+ const increasesComplexity = (node) => {
27
+ /* eslint-disable indent */
28
+ switch (node.kind) {
29
+ case typescript_1.SyntaxKind.CaseClause:
30
+ return node.statements.length > 0;
31
+ case typescript_1.SyntaxKind.CatchClause:
32
+ case typescript_1.SyntaxKind.ConditionalExpression:
33
+ case typescript_1.SyntaxKind.DoStatement:
34
+ case typescript_1.SyntaxKind.ForStatement:
35
+ case typescript_1.SyntaxKind.ForInStatement:
36
+ case typescript_1.SyntaxKind.ForOfStatement:
37
+ case typescript_1.SyntaxKind.IfStatement:
38
+ case typescript_1.SyntaxKind.WhileStatement:
39
+ return true;
40
+ case typescript_1.SyntaxKind.BinaryExpression:
41
+ switch (node.operatorToken.kind) {
42
+ case typescript_1.SyntaxKind.BarBarToken:
43
+ case typescript_1.SyntaxKind.AmpersandAmpersandToken:
44
+ return true;
45
+ default:
46
+ return false;
47
+ }
48
+ default:
49
+ return false;
50
+ }
51
+ /* eslint-enable indent */
52
+ };
53
+ const calculateFromSource = (ctx) => {
54
+ let complexity = 0;
55
+ const output = {};
56
+ (0, typescript_1.forEachChild)(ctx, function cb(node) {
57
+ var _a;
58
+ if ((0, tsutils_1.isFunctionWithBody)(node)) {
59
+ const old = complexity;
60
+ complexity = 1;
61
+ (0, typescript_1.forEachChild)(node, cb);
62
+ const name = (_a = getNodeName(node)) === null || _a === void 0 ? void 0 : _a.toString();
63
+ output[name] = complexity;
64
+ complexity = old;
65
+ }
66
+ else {
67
+ if (increasesComplexity(node)) {
68
+ complexity += 1;
69
+ }
70
+ (0, typescript_1.forEachChild)(node, cb);
71
+ }
72
+ });
73
+ return output;
74
+ };
75
+ const calculate = (filePath) => {
76
+ if (!(0, fs_1.existsSync)(filePath)) {
77
+ throw new Error(`File "${filePath}" does not exists`);
78
+ }
79
+ const sourceText = (0, fs_1.readFileSync)(filePath).toString();
80
+ const source = (0, typescript_1.createSourceFile)(filePath, sourceText, isIdentifier.ES2015);
81
+ return calculateFromSource(source);
82
+ };
83
+ exports.calculate = calculate;
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ var __importDefault = (this && this.__importDefault) || function (mod) {
27
+ return (mod && mod.__esModule) ? mod : { "default": mod };
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ const fs = __importStar(require("fs"));
31
+ const yargs_1 = __importDefault(require("yargs"));
32
+ const analyze_1 = require("./analyze");
33
+ const ts_morph_1 = require("ts-morph");
34
+ const argv = yargs_1.default
35
+ .example(`ts2famix -i "path/to/project/**/*.ts" -o JSONModels/projectName.json`, 'Creates a JSON-format Famix model of typescript files.')
36
+ .example(`ts2famix -i path/to/tsconfig.json -o JSONModels/projectName.json`, 'Creates a JSON-format model of a typescript project.')
37
+ .alias('i', 'input')
38
+ .nargs('i', 1)
39
+ .alias('o', 'output')
40
+ .nargs('o', 1)
41
+ .demandOption('input').demandOption('output').parseSync();
42
+ const importer = new analyze_1.Importer();
43
+ let famixRep;
44
+ if (argv.input.endsWith('tsconfig.json')) {
45
+ const tsConfigFilePath = argv.input;
46
+ const project = new ts_morph_1.Project({
47
+ tsConfigFilePath
48
+ });
49
+ famixRep = importer.famixRepFromProject(project);
50
+ }
51
+ else {
52
+ const paths = new Array();
53
+ paths.push(argv.input);
54
+ famixRep = importer.famixRepFromPaths(paths);
55
+ }
56
+ const jsonOutput = famixRep.getJSON();
57
+ const jsonFilePath = argv.output;
58
+ fs.writeFile(jsonFilePath, jsonOutput, (err) => {
59
+ if (err) {
60
+ throw err;
61
+ }
62
+ });
63
+ console.info(`Created: ${jsonFilePath}`);
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const fs = __importStar(require("fs"));
30
+ const yargs_1 = __importDefault(require("yargs"));
31
+ const analyze_1 = require("./analyze");
32
+ const ts_morph_1 = require("ts-morph");
33
+ const importer = new analyze_1.Importer();
34
+ const argv = yargs_1.default
35
+ .example(`ts-node src/ts2famix-tsconfig.ts -i ../path/to/project/tsconfig.json -o JSONModels/projectName.json`, 'creates a JSON-format model of a typescript project')
36
+ .alias('i', 'input')
37
+ .nargs('i', 1)
38
+ .alias('o', 'output')
39
+ .nargs('o', 1)
40
+ .demandOption('input').demandOption('output').parseSync();
41
+ const tsConfigFilePath = argv.input;
42
+ const project = new ts_morph_1.Project({
43
+ tsConfigFilePath
44
+ });
45
+ const famixRep = importer.famixRepFromProject(project);
46
+ const jsonOutput = famixRep.getJSON();
47
+ const jsonFilePath = argv.output;
48
+ fs.writeFile(jsonFilePath, jsonOutput, (err) => {
49
+ if (err) {
50
+ throw err;
51
+ }
52
+ });
53
+ console.info(`Created: ${jsonFilePath}`);
@@ -1,199 +1,199 @@
1
- /*
2
- * For a detailed explanation regarding each configuration property and type check, visit:
3
- * https://jestjs.io/docs/configuration
4
- */
5
-
6
- export default {
7
- // All imported modules in your tests should be mocked automatically
8
- // automock: false,
9
-
10
- // Stop running tests after `n` failures
11
- // bail: 0,
12
-
13
- // The directory where Jest should store its cached dependency information
14
- // cacheDirectory: "",
15
-
16
- // Automatically clear mock calls and instances between every test
17
- // clearMocks: false,
18
-
19
- // Indicates whether the coverage information should be collected while executing the test
20
- collectCoverage: false,
21
-
22
- // An array of glob patterns indicating a set of files for which coverage information should be collected
23
- // collectCoverageFrom: undefined,
24
-
25
- // The directory where Jest should output its coverage files
26
- coverageDirectory: "coverage",
27
-
28
- // An array of regexp pattern strings used to skip coverage collection
29
- // coveragePathIgnorePatterns: [
30
- // "\\\\node_modules\\\\"
31
- // ],
32
-
33
- // Indicates which provider should be used to instrument code for coverage
34
- coverageProvider: "babel",
35
-
36
- // A list of reporter names that Jest uses when writing coverage reports
37
- // coverageReporters: [
38
- // "json",
39
- // "text",
40
- // "lcov",
41
- // "clover"
42
- // ],
43
-
44
- // An object that configures minimum threshold enforcement for coverage results
45
- // coverageThreshold: undefined,
46
-
47
- // A path to a custom dependency extractor
48
- // dependencyExtractor: undefined,
49
-
50
- // Make calling deprecated APIs throw helpful error messages
51
- // errorOnDeprecated: false,
52
-
53
- // Force coverage collection from ignored files using an array of glob patterns
54
- // forceCoverageMatch: [],
55
-
56
- // A path to a module which exports an async function that is triggered once before all test suites
57
- // globalSetup: undefined,
58
-
59
- // A path to a module which exports an async function that is triggered once after all test suites
60
- // globalTeardown: undefined,
61
-
62
- // A set of global variables that need to be available in all test environments
63
- // globals: {},
64
-
65
- // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
66
- // maxWorkers: 1,
67
-
68
- // An array of directory names to be searched recursively up from the requiring module's location
69
- // moduleDirectories: [
70
- // "node_modules"
71
- // ],
72
-
73
- // An array of file extensions your modules use
74
- // moduleFileExtensions: [
75
- // "js",
76
- // "jsx",
77
- // "ts",
78
- // "tsx",
79
- // "json",
80
- // "node"
81
- // ],
82
-
83
- // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
84
- // moduleNameMapper: {},
85
-
86
- // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
87
- // modulePathIgnorePatterns: [],
88
-
89
- // Activates notifications for test results
90
- // notify: false,
91
-
92
- // An enum that specifies notification mode. Requires { notify: true }
93
- // notifyMode: "failure-change",
94
-
95
- // A preset that is used as a base for Jest's configuration
96
- // preset: undefined,
97
-
98
- // Run tests from one or more projects
99
- // projects: undefined,
100
-
101
- // Use this configuration option to add custom reporters to Jest
102
- // reporters: undefined,
103
-
104
- // Automatically reset mock state between every test
105
- // resetMocks: false,
106
-
107
- // Reset the module registry before running each individual test
108
- // resetModules: false,
109
-
110
- // A path to a custom resolver
111
- // resolver: undefined,
112
-
113
- // Automatically restore mock state between every test
114
- // restoreMocks: false,
115
-
116
- // The root directory that Jest should scan for tests and modules within
117
- // rootDir: undefined,
118
-
119
- // A list of paths to directories that Jest should use to search for files in
120
- // roots: [
121
- // "<rootDir>"
122
- // ],
123
-
124
- // Allows you to use a custom runner instead of Jest's default test runner
125
- // runner: "jest-runner",
126
-
127
- // The paths to modules that run some code to configure or set up the testing environment before each test
128
- // setupFiles: [],
129
-
130
- // A list of paths to modules that run some code to configure or set up the testing framework before each test
131
- // setupFilesAfterEnv: [],
132
-
133
- // The number of seconds after which a test is considered as slow and reported as such in the results.
134
- // slowTestThreshold: 5,
135
-
136
- // A list of paths to snapshot serializer modules Jest should use for snapshot testing
137
- // snapshotSerializers: [],
138
-
139
- // The test environment that will be used for testing
140
- testEnvironment: "jest-environment-node",
141
-
142
- // Options that will be passed to the testEnvironment
143
- // testEnvironmentOptions: {},
144
-
145
- // Adds a location field to test results
146
- // testLocationInResults: false,
147
-
148
- // The glob patterns Jest uses to detect test files
149
- // testMatch: [
150
- // "**/__tests__/**/*.[jt]s?(x)",
151
- // "**/?(*.)+(spec|test).[tj]s?(x)"
152
- // ],
153
-
154
- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
155
- // testPathIgnorePatterns: [
156
- // "\\\\node_modules\\\\"
157
- // ],
158
-
159
- // The regexp pattern or array of patterns that Jest uses to detect test files
160
- // testRegex: [],
161
-
162
- // This option allows the use of a custom results processor
163
- // testResultsProcessor: undefined,
164
-
165
- // This option allows use of a custom test runner
166
- // testRunner: "jest-circus/runner",
167
-
168
- // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
169
- // testURL: "http://localhost",
170
-
171
- // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
172
- // timers: "real",
173
-
174
- // A map from regular expressions to paths to transformers
175
- // transform: undefined,
176
- transform: {
177
- "^.+\\.tsx?$": ["ts-jest", {
178
- isolatedModules: true
179
- }]
180
- },
181
-
182
- // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
183
- // transformIgnorePatterns: [
184
- // "\\\\node_modules\\\\",
185
- // "\\.pnp\\.[^\\\\]+$"
186
- // ],
187
-
188
- // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
189
- // unmockedModulePathPatterns: undefined,
190
-
191
- // Indicates whether each individual test should be reported during the run
192
- verbose: true,
193
-
194
- // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
195
- // watchPathIgnorePatterns: [],
196
-
197
- // Whether to use watchman for file crawling
198
- // watchman: true,
199
- };
1
+ /*
2
+ * For a detailed explanation regarding each configuration property and type check, visit:
3
+ * https://jestjs.io/docs/configuration
4
+ */
5
+
6
+ export default {
7
+ // All imported modules in your tests should be mocked automatically
8
+ // automock: false,
9
+
10
+ // Stop running tests after `n` failures
11
+ // bail: 0,
12
+
13
+ // The directory where Jest should store its cached dependency information
14
+ // cacheDirectory: "",
15
+
16
+ // Automatically clear mock calls and instances between every test
17
+ // clearMocks: false,
18
+
19
+ // Indicates whether the coverage information should be collected while executing the test
20
+ collectCoverage: false,
21
+
22
+ // An array of glob patterns indicating a set of files for which coverage information should be collected
23
+ // collectCoverageFrom: undefined,
24
+
25
+ // The directory where Jest should output its coverage files
26
+ coverageDirectory: "coverage",
27
+
28
+ // An array of regexp pattern strings used to skip coverage collection
29
+ // coveragePathIgnorePatterns: [
30
+ // "\\\\node_modules\\\\"
31
+ // ],
32
+
33
+ // Indicates which provider should be used to instrument code for coverage
34
+ coverageProvider: "babel",
35
+
36
+ // A list of reporter names that Jest uses when writing coverage reports
37
+ // coverageReporters: [
38
+ // "json",
39
+ // "text",
40
+ // "lcov",
41
+ // "clover"
42
+ // ],
43
+
44
+ // An object that configures minimum threshold enforcement for coverage results
45
+ // coverageThreshold: undefined,
46
+
47
+ // A path to a custom dependency extractor
48
+ // dependencyExtractor: undefined,
49
+
50
+ // Make calling deprecated APIs throw helpful error messages
51
+ // errorOnDeprecated: false,
52
+
53
+ // Force coverage collection from ignored files using an array of glob patterns
54
+ // forceCoverageMatch: [],
55
+
56
+ // A path to a module which exports an async function that is triggered once before all test suites
57
+ // globalSetup: undefined,
58
+
59
+ // A path to a module which exports an async function that is triggered once after all test suites
60
+ // globalTeardown: undefined,
61
+
62
+ // A set of global variables that need to be available in all test environments
63
+ // globals: {},
64
+
65
+ // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
66
+ // maxWorkers: 1,
67
+
68
+ // An array of directory names to be searched recursively up from the requiring module's location
69
+ // moduleDirectories: [
70
+ // "node_modules"
71
+ // ],
72
+
73
+ // An array of file extensions your modules use
74
+ // moduleFileExtensions: [
75
+ // "js",
76
+ // "jsx",
77
+ // "ts",
78
+ // "tsx",
79
+ // "json",
80
+ // "node"
81
+ // ],
82
+
83
+ // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
84
+ // moduleNameMapper: {},
85
+
86
+ // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
87
+ // modulePathIgnorePatterns: [],
88
+
89
+ // Activates notifications for test results
90
+ // notify: false,
91
+
92
+ // An enum that specifies notification mode. Requires { notify: true }
93
+ // notifyMode: "failure-change",
94
+
95
+ // A preset that is used as a base for Jest's configuration
96
+ // preset: undefined,
97
+
98
+ // Run tests from one or more projects
99
+ // projects: undefined,
100
+
101
+ // Use this configuration option to add custom reporters to Jest
102
+ // reporters: undefined,
103
+
104
+ // Automatically reset mock state between every test
105
+ // resetMocks: false,
106
+
107
+ // Reset the module registry before running each individual test
108
+ // resetModules: false,
109
+
110
+ // A path to a custom resolver
111
+ // resolver: undefined,
112
+
113
+ // Automatically restore mock state between every test
114
+ // restoreMocks: false,
115
+
116
+ // The root directory that Jest should scan for tests and modules within
117
+ // rootDir: undefined,
118
+
119
+ // A list of paths to directories that Jest should use to search for files in
120
+ // roots: [
121
+ // "<rootDir>"
122
+ // ],
123
+
124
+ // Allows you to use a custom runner instead of Jest's default test runner
125
+ // runner: "jest-runner",
126
+
127
+ // The paths to modules that run some code to configure or set up the testing environment before each test
128
+ // setupFiles: [],
129
+
130
+ // A list of paths to modules that run some code to configure or set up the testing framework before each test
131
+ // setupFilesAfterEnv: [],
132
+
133
+ // The number of seconds after which a test is considered as slow and reported as such in the results.
134
+ // slowTestThreshold: 5,
135
+
136
+ // A list of paths to snapshot serializer modules Jest should use for snapshot testing
137
+ // snapshotSerializers: [],
138
+
139
+ // The test environment that will be used for testing
140
+ testEnvironment: "jest-environment-node",
141
+
142
+ // Options that will be passed to the testEnvironment
143
+ // testEnvironmentOptions: {},
144
+
145
+ // Adds a location field to test results
146
+ // testLocationInResults: false,
147
+
148
+ // The glob patterns Jest uses to detect test files
149
+ // testMatch: [
150
+ // "**/__tests__/**/*.[jt]s?(x)",
151
+ // "**/?(*.)+(spec|test).[tj]s?(x)"
152
+ // ],
153
+
154
+ // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
155
+ // testPathIgnorePatterns: [
156
+ // "\\\\node_modules\\\\"
157
+ // ],
158
+
159
+ // The regexp pattern or array of patterns that Jest uses to detect test files
160
+ // testRegex: [],
161
+
162
+ // This option allows the use of a custom results processor
163
+ // testResultsProcessor: undefined,
164
+
165
+ // This option allows use of a custom test runner
166
+ // testRunner: "jest-circus/runner",
167
+
168
+ // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
169
+ // testURL: "http://localhost",
170
+
171
+ // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
172
+ // timers: "real",
173
+
174
+ // A map from regular expressions to paths to transformers
175
+ // transform: undefined,
176
+ transform: {
177
+ "^.+\\.tsx?$": ["ts-jest", {
178
+ isolatedModules: true
179
+ }]
180
+ },
181
+
182
+ // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
183
+ // transformIgnorePatterns: [
184
+ // "\\\\node_modules\\\\",
185
+ // "\\.pnp\\.[^\\\\]+$"
186
+ // ],
187
+
188
+ // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
189
+ // unmockedModulePathPatterns: undefined,
190
+
191
+ // Indicates whether each individual test should be reported during the run
192
+ verbose: true,
193
+
194
+ // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
195
+ // watchPathIgnorePatterns: [],
196
+
197
+ // Whether to use watchman for file crawling
198
+ // watchman: true,
199
+ };