@zohodesk/testinglibrary 0.1.8-bdd-30.1 → 0.1.8-bdd-30.2

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 (40) hide show
  1. package/.babelrc +18 -18
  2. package/.eslintrc.js +31 -31
  3. package/.prettierrc +5 -5
  4. package/README.md +17 -17
  5. package/bin/cli.js +2 -2
  6. package/build/bdd-poc/core-runner/createCallbacksMap.js +11 -8
  7. package/build/bdd-poc/core-runner/{intialize.js → initializeMaps.js} +1 -1
  8. package/build/bdd-poc/core-runner/main.js +7 -7
  9. package/build/bdd-poc/core-runner/stepRunner.js +8 -2
  10. package/build/bdd-poc/errors/throwError.js +6 -1
  11. package/build/bdd-poc/gherkin-parser/createTestTemplate.js +8 -8
  12. package/build/bdd-poc/gherkin-parser/cucumber/{cucumberSynatxParser.js → cucumberSyntaxParser.js} +4 -4
  13. package/build/bdd-poc/gherkin-parser/cucumber/data-driven/dataSourceMap.js +16 -16
  14. package/build/bdd-poc/gherkin-parser/stepsDefinition/extractTestInputs.js +18 -17
  15. package/build/bdd-poc/gherkin-parser/stepsDefinition/parserStepsArguments.js +5 -6
  16. package/build/bdd-poc/snippets/stepsnippets.js +2 -2
  17. package/build/bdd-poc/utils/stringManipulation.js +11 -8
  18. package/build/core/playwright/readConfigFile.js +30 -30
  19. package/build/core/playwright/setup/config-creator.js +9 -9
  20. package/build/core/playwright/setup/config-utils.js +7 -7
  21. package/build/index.d.ts +13 -13
  22. package/build/parser/sample.feature +34 -34
  23. package/build/parser/sample.spec.js +18 -18
  24. package/build/parser/verifier.js +2 -3
  25. package/build/setup-folder-structure/reportEnhancement/addonScript.html +23 -24
  26. package/build/setup-folder-structure/samples/auth-setup-sample.js +72 -72
  27. package/build/setup-folder-structure/samples/authUsers-sample.json +8 -8
  28. package/build/setup-folder-structure/samples/env-config-sample.json +20 -20
  29. package/build/setup-folder-structure/samples/git-ignore.sample.js +36 -36
  30. package/build/setup-folder-structure/samples/uat-config-sample.js +44 -44
  31. package/build/utils/PathProviderOfConfig.js +25 -0
  32. package/build/utils/cliArgsToObject.js +25 -25
  33. package/build/utils/fileUtils.js +10 -0
  34. package/changelog.md +131 -131
  35. package/jest.config.js +63 -63
  36. package/npm-shrinkwrap.json +5994 -5994
  37. package/package.json +56 -56
  38. package/playwright.config.js +112 -112
  39. package/build/bdd-poc/config/pathConfig.js +0 -26
  40. /package/build/bdd-poc/gherkin-parser/cucumber/{cucumber.js → invokerOfCucumberParser.js} +0 -0
@@ -1,44 +1,44 @@
1
- /**
2
- * @typedef {Object|null} viewportConfig
3
- * @property {number} width - width of the viewport
4
- * @property {number} height - height of the viewport
5
- */
6
- /**
7
- * Represents the user configuration object.
8
- * @typedef {Object} UserConfig
9
- * @property {string} headless - Headless Browsers mode.
10
- * @property {number} trace - trace for test cases.
11
- * @property {boolean} video - video for test cases,
12
- * @property {boolean} debug - debug mode
13
- * @property {string} mode: mode in which the test cases needs to run
14
- * @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
15
- * @property {string} authFilePath - File Path where the cookies stored
16
- * @property {any} browsers: List of browsers
17
- * @property {string} openReportOn: default Option value (never, on-failure and always)
18
- * @property {any} reportPath : directory where report is generate
19
- * @property {boolean} bddMode: Feature files needs to be processed
20
- * @property {number} expectTimeout: time in milliseconds which the expect condition should fail
21
- * @property {number} testTimeout: time in milliseconds which the test should fail
22
- * @property {Object} additionalPages: custom pages configuration
23
- * @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
24
- * @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
25
- * @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
26
- * @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
27
- */
28
-
29
- /**
30
- * @type {UserConfig}
31
- */
32
- module.exports = {
33
- headless: false,
34
- browsers: ['Chrome', 'Firefox', 'Safari', 'Edge'],
35
- mode: 'dev',
36
- isAuthMode: true,
37
- authFilePath: 'uat/playwright/.auth/user.json',
38
- trace: true,
39
- video: true,
40
- bddMode: true,
41
- featureFilesFolder: 'feature-files',
42
- stepDefinitionsFolder: 'steps',
43
- viewport: { width: 1280, height: 720 }
44
- }
1
+ /**
2
+ * @typedef {Object|null} viewportConfig
3
+ * @property {number} width - width of the viewport
4
+ * @property {number} height - height of the viewport
5
+ */
6
+ /**
7
+ * Represents the user configuration object.
8
+ * @typedef {Object} UserConfig
9
+ * @property {string} headless - Headless Browsers mode.
10
+ * @property {number} trace - trace for test cases.
11
+ * @property {boolean} video - video for test cases,
12
+ * @property {boolean} debug - debug mode
13
+ * @property {string} mode: mode in which the test cases needs to run
14
+ * @property {boolean} isAuthMode - Auth Mode. config whether authentication step needed before running test cases
15
+ * @property {string} authFilePath - File Path where the cookies stored
16
+ * @property {any} browsers: List of browsers
17
+ * @property {string} openReportOn: default Option value (never, on-failure and always)
18
+ * @property {any} reportPath : directory where report is generate
19
+ * @property {boolean} bddMode: Feature files needs to be processed
20
+ * @property {number} expectTimeout: time in milliseconds which the expect condition should fail
21
+ * @property {number} testTimeout: time in milliseconds which the test should fail
22
+ * @property {Object} additionalPages: custom pages configuration
23
+ * @property {string} featureFilesFolder: folder name under which feature-files will be placed. Default is feature-files
24
+ * @property {string} stepDefinitionsFolder: folder name under which step implementations will be placed. Default is steps
25
+ * @property {viewportConfig} viewport: viewport configuration for the browser. Default is { width: 1280, height: 720 }
26
+ * @property {string} testIdAttribute: Change the default data-testid attribute. configure what attribute to search while calling getByTestId
27
+ */
28
+
29
+ /**
30
+ * @type {UserConfig}
31
+ */
32
+ module.exports = {
33
+ headless: false,
34
+ browsers: ['Chrome', 'Firefox', 'Safari', 'Edge'],
35
+ mode: 'dev',
36
+ isAuthMode: true,
37
+ authFilePath: 'uat/playwright/.auth/user.json',
38
+ trace: true,
39
+ video: true,
40
+ bddMode: true,
41
+ featureFilesFolder: 'feature-files',
42
+ stepDefinitionsFolder: 'steps',
43
+ viewport: { width: 1280, height: 720 }
44
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getFeatureFilePath = getFeatureFilePath;
8
+ exports.getStepFilePath = getStepFilePath;
9
+ var _readConfigFile = require("../core/playwright/readConfigFile");
10
+ var _stringManipulation = require("../bdd-poc/utils/stringManipulation");
11
+ var _path = _interopRequireDefault(require("path"));
12
+ const {
13
+ featureFilesFolder,
14
+ stepDefinitionsFolder
15
+ } = (0, _readConfigFile.generateConfigFromFile)();
16
+ function getFeatureFilePath() {
17
+ return (0, _stringManipulation.convertUnixPathToWindowsPath)(_path.default.resolve(process.cwd(), 'uat', 'modules', '**', featureFilesFolder || '**', '**', '*.feature'));
18
+ }
19
+ function getStepFilePath() {
20
+ return (0, _stringManipulation.convertUnixPathToWindowsPath)(_path.default.resolve(process.cwd(), 'uat', 'modules', '**', stepDefinitionsFolder || '**', '**', '*.spec.js'));
21
+ }
22
+
23
+ /**
24
+ * loosly coupled and repo context
25
+ */
@@ -5,19 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.cliArgsToObject = cliArgsToObject;
7
7
  exports.objectToCliArgs = objectToCliArgs;
8
- /**
9
- * Converts an array of command-line arguments into an object.
10
- *
11
- * @param {string[]} cliArgs - An array of command-line arguments.
12
- * @param {boolean} [isKeyNeedToBeAdded=true] - Indicates whether the keys should be added to the resulting object.
13
- * @returns {Object} An object representing the command-line arguments, where keys are argument names (without '--') and values are argument values.
14
- * If `isKeyNeedToBeAdded` is set to `false`, only values are included in the object with numeric indexes as keys.
15
- *
16
- * @example
17
- * // Example usage:
18
- * const args = ['--port=8080', '--verbose', 'input.txt'];
19
- * const result = cliArgsToObject(args);
20
- * // result will be: { port: '8080', verbose: true }
8
+ /**
9
+ * Converts an array of command-line arguments into an object.
10
+ *
11
+ * @param {string[]} cliArgs - An array of command-line arguments.
12
+ * @param {boolean} [isKeyNeedToBeAdded=true] - Indicates whether the keys should be added to the resulting object.
13
+ * @returns {Object} An object representing the command-line arguments, where keys are argument names (without '--') and values are argument values.
14
+ * If `isKeyNeedToBeAdded` is set to `false`, only values are included in the object with numeric indexes as keys.
15
+ *
16
+ * @example
17
+ * // Example usage:
18
+ * const args = ['--port=8080', '--verbose', 'input.txt'];
19
+ * const result = cliArgsToObject(args);
20
+ * // result will be: { port: '8080', verbose: true }
21
21
  */
22
22
  // eslint-disable-next-line no-unused-vars
23
23
  function cliArgsToObject(cliArgs, isKeyNeedToBeAdded) {
@@ -37,18 +37,18 @@ function cliArgsToObject(cliArgs, isKeyNeedToBeAdded) {
37
37
  return processEnv;
38
38
  }
39
39
 
40
- /**
41
- * Converts an object to an array of command-line arguments.
42
- *
43
- * @param {Object} objectToBeConverted - The object to be converted to command-line arguments.
44
- * @param {(string|function(string): boolean)} [isKeyNeedToBeAdded=true] - A string representing a key, or a function that determines whether a key should be added to the resulting array.
45
- * @returns {string[]} An array of command-line arguments generated from the object's key-value pairs. Keys are transformed into argument names (with '--') and values are added as argument values.
46
- *
47
- * @example
48
- * // Example usage:
49
- * const options = { port: 8080, verbose: true, input: 'input.txt' };
50
- * const args = objectToCliArgs(options);
51
- * // args will be: ['--port=8080', '--verbose', '--input=input.txt']
40
+ /**
41
+ * Converts an object to an array of command-line arguments.
42
+ *
43
+ * @param {Object} objectToBeConverted - The object to be converted to command-line arguments.
44
+ * @param {(string|function(string): boolean)} [isKeyNeedToBeAdded=true] - A string representing a key, or a function that determines whether a key should be added to the resulting array.
45
+ * @returns {string[]} An array of command-line arguments generated from the object's key-value pairs. Keys are transformed into argument names (with '--') and values are added as argument values.
46
+ *
47
+ * @example
48
+ * // Example usage:
49
+ * const options = { port: 8080, verbose: true, input: 'input.txt' };
50
+ * const args = objectToCliArgs(options);
51
+ * // args will be: ['--port=8080', '--verbose', '--input=input.txt']
52
52
  */
53
53
  function objectToCliArgs(objectToBeConverted, isKeyNeedToBeAdded) {
54
54
  const argsArray = [];
@@ -8,10 +8,13 @@ exports.checkIfFileExists = checkIfFileExists;
8
8
  exports.createFolderSync = createFolderSync;
9
9
  exports.deleteFile = deleteFile;
10
10
  exports.deleteFolder = deleteFolder;
11
+ exports.getFilesFromGivenPattern = getFilesFromGivenPattern;
11
12
  exports.readFileContents = readFileContents;
12
13
  exports.writeFileContents = writeFileContents;
13
14
  var _fs = _interopRequireWildcard(require("fs"));
14
15
  var _path = _interopRequireDefault(require("path"));
16
+ var _fastGlob = _interopRequireDefault(require("fast-glob"));
17
+ var _logger = require("./logger");
15
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
20
  function checkIfFileExists(file) {
@@ -30,6 +33,13 @@ function readFileContents(filePath) {
30
33
  return null;
31
34
  }
32
35
  }
36
+ async function getFilesFromGivenPattern(pattern, options) {
37
+ const files = await _fastGlob.default.globSync(pattern, options);
38
+ if (files.length == 0) {
39
+ _logger.Logger.log(_logger.Logger.FAILURE_TYPE, `given pattern - ${pattern} files are not found`);
40
+ }
41
+ return files;
42
+ }
33
43
  function writeFileContents(filePath, content, writeOptions = {}) {
34
44
  const directoryPath = _path.default.dirname(filePath);
35
45
 
package/changelog.md CHANGED
@@ -1,131 +1,131 @@
1
- # Testing Framework
2
-
3
- ## Framework that abstracts the configuration for playwright and Jest
4
- # 0.1.8
5
- **Issue Fixes**
6
- - Fix #9 Custom report generate Error on Windows
7
- - Add Tags annotations only on bddMode
8
-
9
- **Enhancements**
10
- - Added Failed steps in test summary
11
-
12
- # 0.1.7
13
- **Enhancements**
14
- - Added option to run teardown logic.
15
- - Added support for tag based filtering.
16
- - Playwright-bdd version updated to 5.6.0.
17
- - New fixture added to add tag as annotations in test report
18
-
19
- **Issue Fixes**
20
- - Edition command option. Fixed the edition tags not generated properly
21
-
22
- # 0.1.6
23
-
24
- **Enhancements**
25
- - New Command option Added `--edition`.
26
- - New Configuration Added `editionOrder`.
27
- `In uat.config.js, editionOrder: ['Free', 'Express']`
28
- - Cache Layer added
29
-
30
- **USAGE**
31
- - npm run uat --edition="Free"
32
-
33
-
34
-
35
- # 0.1.5
36
-
37
- **Enhancements**
38
-
39
- - Playwright version updated to `1.40.1`
40
- - And and But Support added
41
- - Added Code Suggestions support
42
- - Custom Reporter added. Now the report will be available in json format.
43
- - New Commands added.
44
-
45
- `- help: npx ZDTestingFramework help`
46
-
47
- - Will list down the commands available in the tool
48
-
49
- `- clearCaches: npx ZDTestingFramework clearCaches`
50
-
51
- - Will clear the exisiting cookies in the authentication setup
52
-
53
- **Issue Fixes**
54
-
55
- - Fixed Issue that occurs while quitting node process.
56
-
57
- # 0.1.4
58
-
59
- - `testIdAttribute` config added
60
- - Fixed issue while reading boolean configuration values
61
-
62
- # 0.1.3
63
-
64
- - uat config sample file updated with `bddMode` and `viewport` values
65
- - user configuration issue fix when the value is undefined
66
-
67
- # 0.1.2
68
-
69
- - Bdd version updated to `5.4.0`
70
- - Playwright version updated to `1.39.0`
71
-
72
- # 0.1.1
73
-
74
- - Fixed post install script error
75
- - Fixed error `@cucumber/gherkin` not found. Cause of this issue is updating @cucumber/cucumber to 9.5.0. Reverting this version to 9.2.0
76
- - Removed testing library exports
77
-
78
- # 0.1.0
79
-
80
- - Removed eslint as dev dependencies as it causes `npm aliases not supported error` for npm version < 6
81
-
82
- # 0.0.9
83
-
84
- - Video sized in report adjusted to viewport size
85
- - Changes in package.json scripts while setting up project
86
-
87
- # 0.0.8
88
-
89
- - Tags Support
90
- - Enable running without bddmode feature
91
- - viewport configuration
92
- - Internal Change - Code refactoring
93
-
94
- # 0.0.7
95
-
96
- - Removed react and react-dom as dependencies. Added this as peer dependency
97
-
98
- # 0.0.6
99
-
100
- ## Provided Initial Support for cucumber feature files
101
-
102
- - Playwright-bdd and cucumber added as dependencies
103
- - Added config bddMode which toggles the feature files processing
104
- - Added expect timeout and test timeout as an option
105
- - Decorators support for given, when and then. Typescript support needed to use this feature
106
-
107
- ## Internal Library change
108
-
109
- - Provided support for import/export statements
110
-
111
- # 0.0.5
112
-
113
- - Added Init command to initialize the folder structure and configuration for testing
114
- - Renamed config.json to env-config.json
115
- - Configured report file path directory and Handled Edge case in Cookies Handling
116
-
117
- # 0.0.4
118
-
119
- - Issue Fixes while loading the storage state
120
-
121
- # 0.0.3
122
-
123
- - Added Support for custom config generator based on user preferences
124
-
125
- # 0.0.2
126
-
127
- - Fix for Finding directories inside node_modules folder
128
-
129
- # 0.0.1
130
-
131
- - test and report command support
1
+ # Testing Framework
2
+
3
+ ## Framework that abstracts the configuration for playwright and Jest
4
+ # 0.1.8
5
+ **Issue Fixes**
6
+ - Fix #9 Custom report generate Error on Windows
7
+ - Add Tags annotations only on bddMode
8
+
9
+ **Enhancements**
10
+ - Added Failed steps in test summary
11
+
12
+ # 0.1.7
13
+ **Enhancements**
14
+ - Added option to run teardown logic.
15
+ - Added support for tag based filtering.
16
+ - Playwright-bdd version updated to 5.6.0.
17
+ - New fixture added to add tag as annotations in test report
18
+
19
+ **Issue Fixes**
20
+ - Edition command option. Fixed the edition tags not generated properly
21
+
22
+ # 0.1.6
23
+
24
+ **Enhancements**
25
+ - New Command option Added `--edition`.
26
+ - New Configuration Added `editionOrder`.
27
+ `In uat.config.js, editionOrder: ['Free', 'Express']`
28
+ - Cache Layer added
29
+
30
+ **USAGE**
31
+ - npm run uat --edition="Free"
32
+
33
+
34
+
35
+ # 0.1.5
36
+
37
+ **Enhancements**
38
+
39
+ - Playwright version updated to `1.40.1`
40
+ - And and But Support added
41
+ - Added Code Suggestions support
42
+ - Custom Reporter added. Now the report will be available in json format.
43
+ - New Commands added.
44
+
45
+ `- help: npx ZDTestingFramework help`
46
+
47
+ - Will list down the commands available in the tool
48
+
49
+ `- clearCaches: npx ZDTestingFramework clearCaches`
50
+
51
+ - Will clear the exisiting cookies in the authentication setup
52
+
53
+ **Issue Fixes**
54
+
55
+ - Fixed Issue that occurs while quitting node process.
56
+
57
+ # 0.1.4
58
+
59
+ - `testIdAttribute` config added
60
+ - Fixed issue while reading boolean configuration values
61
+
62
+ # 0.1.3
63
+
64
+ - uat config sample file updated with `bddMode` and `viewport` values
65
+ - user configuration issue fix when the value is undefined
66
+
67
+ # 0.1.2
68
+
69
+ - Bdd version updated to `5.4.0`
70
+ - Playwright version updated to `1.39.0`
71
+
72
+ # 0.1.1
73
+
74
+ - Fixed post install script error
75
+ - Fixed error `@cucumber/gherkin` not found. Cause of this issue is updating @cucumber/cucumber to 9.5.0. Reverting this version to 9.2.0
76
+ - Removed testing library exports
77
+
78
+ # 0.1.0
79
+
80
+ - Removed eslint as dev dependencies as it causes `npm aliases not supported error` for npm version < 6
81
+
82
+ # 0.0.9
83
+
84
+ - Video sized in report adjusted to viewport size
85
+ - Changes in package.json scripts while setting up project
86
+
87
+ # 0.0.8
88
+
89
+ - Tags Support
90
+ - Enable running without bddmode feature
91
+ - viewport configuration
92
+ - Internal Change - Code refactoring
93
+
94
+ # 0.0.7
95
+
96
+ - Removed react and react-dom as dependencies. Added this as peer dependency
97
+
98
+ # 0.0.6
99
+
100
+ ## Provided Initial Support for cucumber feature files
101
+
102
+ - Playwright-bdd and cucumber added as dependencies
103
+ - Added config bddMode which toggles the feature files processing
104
+ - Added expect timeout and test timeout as an option
105
+ - Decorators support for given, when and then. Typescript support needed to use this feature
106
+
107
+ ## Internal Library change
108
+
109
+ - Provided support for import/export statements
110
+
111
+ # 0.0.5
112
+
113
+ - Added Init command to initialize the folder structure and configuration for testing
114
+ - Renamed config.json to env-config.json
115
+ - Configured report file path directory and Handled Edge case in Cookies Handling
116
+
117
+ # 0.0.4
118
+
119
+ - Issue Fixes while loading the storage state
120
+
121
+ # 0.0.3
122
+
123
+ - Added Support for custom config generator based on user preferences
124
+
125
+ # 0.0.2
126
+
127
+ - Fix for Finding directories inside node_modules folder
128
+
129
+ # 0.0.1
130
+
131
+ - test and report command support
package/jest.config.js CHANGED
@@ -1,64 +1,64 @@
1
- const path = require('path');
2
- const { existsSync } = require('fs');
3
- const appPath = process.cwd();
4
-
5
- const appGlobals = path.resolve(appPath, '__testUtils__', 'globals.js');
6
-
7
- module.exports = {
8
- rootDir: process.cwd(),
9
- testEnvironment: 'jsdom',
10
-
11
- setupFilesAfterEnv: [
12
- existsSync(appGlobals) && appGlobals,
13
- path.resolve(__dirname, 'src', 'core', 'jest', 'setup', 'index.js')
14
- ].filter(Boolean),
15
-
16
- transform: {
17
- '^.+\\.(js|jsx)$': path.resolve(
18
- __dirname,
19
- 'src',
20
- 'core',
21
- 'jest',
22
- 'preprocessor',
23
- 'jsPreprocessor.js'
24
- )
25
- },
26
-
27
- modulePathIgnorePatterns: ['/build/'],
28
-
29
- transformIgnorePatterns: [
30
- '/node_modules/(?!(@zohodesk)/)'
31
- ],
32
-
33
- testPathIgnorePatterns: [
34
- '/node_modules/',
35
- '/build/',
36
- '/uat/'
37
- ],
38
-
39
- watchPathIgnorePatterns: [
40
- '/node_modules/',
41
- '/build/'
42
- ],
43
-
44
- clearMocks: true,
45
- resetMocks: false,
46
-
47
- collectCoverage: true,
48
- collectCoverageFrom: ['src/**/*.js'],
49
- coverageDirectory: './build/cov',
50
- coverageReporters: ['lcov', 'json', 'html', 'json-summary', 'text'],
51
- coverageThreshold: {
52
- global: {
53
- branches: 100,
54
- functions: 100,
55
- lines: 100,
56
- statements: 100
57
- }
58
- },
59
- globals: {
60
- __DEVELOPMENT__: true,
61
- __DOCS__: false,
62
- __TEST__: true
63
- }
1
+ const path = require('path');
2
+ const { existsSync } = require('fs');
3
+ const appPath = process.cwd();
4
+
5
+ const appGlobals = path.resolve(appPath, '__testUtils__', 'globals.js');
6
+
7
+ module.exports = {
8
+ rootDir: process.cwd(),
9
+ testEnvironment: 'jsdom',
10
+
11
+ setupFilesAfterEnv: [
12
+ existsSync(appGlobals) && appGlobals,
13
+ path.resolve(__dirname, 'src', 'core', 'jest', 'setup', 'index.js')
14
+ ].filter(Boolean),
15
+
16
+ transform: {
17
+ '^.+\\.(js|jsx)$': path.resolve(
18
+ __dirname,
19
+ 'src',
20
+ 'core',
21
+ 'jest',
22
+ 'preprocessor',
23
+ 'jsPreprocessor.js'
24
+ )
25
+ },
26
+
27
+ modulePathIgnorePatterns: ['/build/'],
28
+
29
+ transformIgnorePatterns: [
30
+ '/node_modules/(?!(@zohodesk)/)'
31
+ ],
32
+
33
+ testPathIgnorePatterns: [
34
+ '/node_modules/',
35
+ '/build/',
36
+ '/uat/'
37
+ ],
38
+
39
+ watchPathIgnorePatterns: [
40
+ '/node_modules/',
41
+ '/build/'
42
+ ],
43
+
44
+ clearMocks: true,
45
+ resetMocks: false,
46
+
47
+ collectCoverage: true,
48
+ collectCoverageFrom: ['src/**/*.js'],
49
+ coverageDirectory: './build/cov',
50
+ coverageReporters: ['lcov', 'json', 'html', 'json-summary', 'text'],
51
+ coverageThreshold: {
52
+ global: {
53
+ branches: 100,
54
+ functions: 100,
55
+ lines: 100,
56
+ statements: 100
57
+ }
58
+ },
59
+ globals: {
60
+ __DEVELOPMENT__: true,
61
+ __DOCS__: false,
62
+ __TEST__: true
63
+ }
64
64
  };