@zohodesk/testinglibrary 0.0.3 → 0.0.4-n20-experimental

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 (130) hide show
  1. package/.babelrc +24 -0
  2. package/.eslintrc.js +31 -0
  3. package/.gitlab-ci.yml +175 -0
  4. package/.prettierrc +6 -0
  5. package/README.md +151 -1
  6. package/bin/cli.js +1 -1
  7. package/bin/postinstall.js +1 -16
  8. package/build/common/data-generator/steps/DataGenerator.spec.js +19 -0
  9. package/build/common/data-generator/steps/DataGeneratorStepsHelper.js +19 -0
  10. package/build/common/multi-actor/steps/multiActorHandling.spec.js +26 -0
  11. package/build/common/searchFake/helpers/rpcRequestHelper.js +41 -0
  12. package/build/common/searchFake/steps/searchFake.spec.js +26 -0
  13. package/build/core/dataGenerator/DataGenerator.js +94 -0
  14. package/build/core/dataGenerator/DataGeneratorHelper.js +49 -0
  15. package/{src → build}/core/jest/preprocessor/jsPreprocessor.js +4 -6
  16. package/{src → build}/core/jest/runner/jest-runner.js +17 -15
  17. package/build/core/jest/setup/index.js +3 -0
  18. package/build/core/playwright/builtInFixtures/actorContext.js +75 -0
  19. package/build/core/playwright/builtInFixtures/addTags.js +19 -0
  20. package/build/core/playwright/builtInFixtures/cacheLayer.js +13 -0
  21. package/build/core/playwright/builtInFixtures/context.js +32 -0
  22. package/build/core/playwright/builtInFixtures/executionContext.js +17 -0
  23. package/build/core/playwright/builtInFixtures/i18N.js +41 -0
  24. package/build/core/playwright/builtInFixtures/index.js +46 -0
  25. package/build/core/playwright/builtInFixtures/page.js +38 -0
  26. package/build/core/playwright/builtInFixtures/unauthenticatedPage.js +18 -0
  27. package/build/core/playwright/clear-caches.js +49 -0
  28. package/build/core/playwright/codegen.js +55 -0
  29. package/build/core/playwright/configuration/Configuration.js +25 -0
  30. package/build/core/playwright/configuration/ConfigurationHelper.js +43 -0
  31. package/build/core/playwright/configuration/UserArgs.js +12 -0
  32. package/build/core/playwright/constants/browserTypes.js +12 -0
  33. package/build/core/playwright/constants/fileMutexConfig.js +9 -0
  34. package/build/core/playwright/custom-commands.js +7 -0
  35. package/build/core/playwright/env-initializer.js +43 -0
  36. package/build/core/playwright/fixtures.js +24 -0
  37. package/build/core/playwright/helpers/additionalProfiles.js +25 -0
  38. package/build/core/playwright/helpers/auth/accountLogin.js +21 -0
  39. package/build/core/playwright/helpers/auth/checkAuthCookies.js +41 -0
  40. package/build/core/playwright/helpers/auth/getUrlOrigin.js +13 -0
  41. package/build/core/playwright/helpers/auth/getUsers.js +118 -0
  42. package/build/core/playwright/helpers/auth/index.js +76 -0
  43. package/build/core/playwright/helpers/auth/loginDefaultStepsHelper.js +54 -0
  44. package/build/core/playwright/helpers/auth/loginSteps.js +50 -0
  45. package/build/core/playwright/helpers/checkAuthDirectory.js +27 -0
  46. package/build/core/playwright/helpers/configFileNameProvider.js +31 -0
  47. package/build/core/playwright/helpers/customFixturesHelper.js +58 -0
  48. package/build/core/playwright/helpers/fileMutex.js +71 -0
  49. package/build/core/playwright/helpers/getUserFixtures.js +23 -0
  50. package/build/core/playwright/helpers/mergeObjects.js +13 -0
  51. package/build/core/playwright/helpers/parseUserArgs.js +10 -0
  52. package/build/core/playwright/index.js +24 -0
  53. package/build/core/playwright/readConfigFile.js +147 -0
  54. package/build/core/playwright/report-generator.js +42 -0
  55. package/build/core/playwright/runner/Runner.js +22 -0
  56. package/build/core/playwright/runner/RunnerHelper.js +43 -0
  57. package/build/core/playwright/runner/RunnerTypes.js +17 -0
  58. package/build/core/playwright/runner/SpawnRunner.js +113 -0
  59. package/build/core/playwright/setup/config-creator.js +117 -0
  60. package/build/core/playwright/setup/config-utils.js +188 -0
  61. package/build/core/playwright/setup/custom-reporter.js +136 -0
  62. package/build/core/playwright/setup/qc-custom-reporter.js +291 -0
  63. package/build/core/playwright/tagProcessor.js +69 -0
  64. package/build/core/playwright/test-runner.js +116 -0
  65. package/build/core/playwright/types.js +44 -0
  66. package/build/core/playwright/validateFeature.js +28 -0
  67. package/build/decorators.d.ts +1 -0
  68. package/build/decorators.js +16 -0
  69. package/build/index.d.ts +78 -0
  70. package/build/index.js +105 -0
  71. package/build/lib/cli.js +78 -0
  72. package/build/lib/post-install.js +25 -0
  73. package/build/lint/index.js +4 -0
  74. package/build/parser/parser.js +205 -0
  75. package/build/parser/sample.feature +34 -0
  76. package/build/parser/sample.spec.js +37 -0
  77. package/build/parser/verifier.js +130 -0
  78. package/build/setup-folder-structure/helper.js +37 -0
  79. package/build/setup-folder-structure/reportEnhancement/addonScript.html +25 -0
  80. package/build/setup-folder-structure/reportEnhancement/reportAlteration.js +25 -0
  81. package/build/setup-folder-structure/samples/accountLogin-sample.js +19 -0
  82. package/build/setup-folder-structure/samples/actors-index.js +2 -0
  83. package/build/setup-folder-structure/samples/auth-setup-sample.js +15 -0
  84. package/build/setup-folder-structure/samples/editions-index.js +3 -0
  85. package/build/setup-folder-structure/samples/free-sample.json +25 -0
  86. package/build/setup-folder-structure/samples/git-ignore.sample.js +37 -0
  87. package/build/setup-folder-structure/samples/settings.json +7 -0
  88. package/build/setup-folder-structure/samples/testSetup-sample.js +14 -0
  89. package/build/setup-folder-structure/samples/uat-config-sample.js +46 -0
  90. package/build/setup-folder-structure/setupProject.js +122 -0
  91. package/build/test/core/playwright/__tests__/tagProcessor.test.js +94 -0
  92. package/build/test/core/playwright/__tests__/validateFeature.test.js +69 -0
  93. package/build/test/core/playwright/buildInFixtures/__tests__/executionContext.test.js +27 -0
  94. package/build/test/core/playwright/configuration/__tests__/Configuration.test.js +53 -0
  95. package/build/test/core/playwright/helpers/__tests__/additionalProfiles.test.js +45 -0
  96. package/build/test/core/playwright/helpers/__tests__/configFileNameProvider.test.js +34 -0
  97. package/build/test/core/playwright/helpers/__tests__/customFixturesHelper.test.js +51 -0
  98. package/build/test/core/playwright/helpers/__tests__/fileMutex.test.js +79 -0
  99. package/build/test/core/playwright/helpers/__tests__/getUsers_ListOfActors.test.js +80 -0
  100. package/build/test/core/playwright/runner/__tests__/RunnerHelper.test.js +16 -0
  101. package/build/test/core/playwright/runner/__tests__/SpawnRunner.test.js +27 -0
  102. package/build/utils/cliArgsToObject.js +72 -0
  103. package/build/utils/commonUtils.js +17 -0
  104. package/build/utils/fileUtils.js +109 -0
  105. package/build/utils/getFilePath.js +11 -0
  106. package/build/utils/logger.js +28 -0
  107. package/build/utils/rootPath.js +53 -0
  108. package/build/utils/stepDefinitionsFormatter.js +11 -0
  109. package/changelog.md +153 -1
  110. package/jest.config.js +29 -11
  111. package/npm-shrinkwrap.json +10902 -4825
  112. package/package.json +47 -17
  113. package/playwright.config.js +6 -56
  114. package/test-results/.last-run.json +4 -0
  115. package/unit_reports/unit-report.html +260 -0
  116. package/src/core/jest/setup/index.js +0 -165
  117. package/src/core/playwright/codegen.js +0 -60
  118. package/src/core/playwright/custom-commands.js +0 -3
  119. package/src/core/playwright/env-initializer.js +0 -24
  120. package/src/core/playwright/index.js +0 -82
  121. package/src/core/playwright/readConfigFile.js +0 -30
  122. package/src/core/playwright/report-generator.js +0 -43
  123. package/src/core/playwright/setup/config-creator.js +0 -79
  124. package/src/core/playwright/test-runner.js +0 -64
  125. package/src/index.js +0 -9
  126. package/src/lib/cli.js +0 -35
  127. package/src/utils/cliArgsToObject.js +0 -35
  128. package/src/utils/getFilePath.js +0 -9
  129. package/src/utils/logger.js +0 -28
  130. package/src/utils/rootPath.js +0 -51
@@ -1,24 +0,0 @@
1
- const { readFileSync } = require('fs');
2
- const path = require('path');
3
-
4
-
5
-
6
- function initializeEnvConfig(mode = 'dev') {
7
- try {
8
- const configFile = readFileSync(path.resolve(process.cwd(), './uat/config.json'));
9
-
10
- const configJSON = JSON.parse(configFile);
11
- process.env.mode = mode;
12
- for (const key in configJSON[mode]) {
13
- process.env[key] = configJSON[mode][key];
14
- }
15
- } catch (err) {
16
- throw new Error('Config File Not Exists. Please provide a config file to intiailize the environment variables')
17
- }
18
-
19
- }
20
-
21
-
22
- module.exports = {
23
- initializeEnvConfig
24
- };
@@ -1,82 +0,0 @@
1
- const { expect, test: base } = require('@playwright/test');
2
- // function test(descrition, callback) {
3
- // return test(descrition, ({ page }) => {
4
- // const { locator, ...custompage } = page
5
- // callback({ page: custompage })
6
- // })
7
- // }
8
-
9
- // class FilteredPage {
10
- // constructor(page) {
11
- // this.page = page;
12
- // this.allowedMethods = ['getByText', 'getByTitle'];
13
- // this.context = page.context;
14
- // }
15
-
16
- // goto(...args) {
17
- // return this.page['goto'](...args);
18
- // }
19
-
20
-
21
- // getByRole(...args) {
22
- // return this.page['getByRole'](...args);
23
- // }
24
- // }
25
-
26
-
27
- // function FilteredPage(page) {
28
- // return {
29
- // getByRole: () => {
30
- // throw new Error('You cannnot use getByRole property')
31
- // }
32
- // }
33
- // }
34
-
35
- const test = base.extend({
36
- page: async ({ baseURL, page }, use) => {
37
- // const proxyPage = new Proxy(page, {
38
- // get: function (obj, prop) {
39
- // console.log('Gettig Priop', prop);
40
- // let filterMethod = FilteredPage(page)[prop];
41
- // if (filterMethod) {
42
- // return filterMethod;
43
- // } else {
44
- // return obj[prop] ? obj[prop] : 'property does not exist';
45
- // }
46
- // }
47
- // })
48
- page.getBaseUrl = function () {
49
- if (process.env.mode === 'dev') {
50
- return `${process.env.domain}?devURL=${process.env.devUrl}`;
51
- }
52
- return `${process.env.domain}`;
53
- }
54
-
55
- page.getCustomPageUrl = function (url) {
56
- if (process.env.mode === 'dev') {
57
- return `${process.env.domain}/${url}?devURL=${process.env.devUrl}`
58
- }
59
- return `${process.env.domain}/${url}`
60
- }
61
- await use(page);
62
-
63
-
64
- //await use(new FilteredPage(page));
65
-
66
- // await use(async (page) => {
67
- // delete page.getByTestId;
68
- // await page;
69
- // });
70
-
71
- },
72
- context: async ({ context }, use) => {
73
- await context.addInitScript(() => window.localStorage.setItem('isDnBannerHide', true));
74
- await use(context);
75
- }
76
- })
77
-
78
-
79
- module.exports = {
80
- expect,
81
- test
82
- }
@@ -1,30 +0,0 @@
1
- const { existsSync } = require('fs');
2
- const path = require('path');
3
-
4
- const fileName = 'uat.config.js';
5
-
6
- function generateConfigFromFile() {
7
- const filePath = path.resolve(process.cwd(), fileName);
8
-
9
- if (existsSync(filePath)) {
10
- const config = require(filePath);
11
- return config;
12
- }
13
-
14
- return {};
15
- }
16
-
17
- function isUserConfigFileAvailable() {
18
- const filePath = path.resolve(process.cwd(), fileName);
19
- if (existsSync(filePath)) {
20
- return true;
21
- }
22
- return false;
23
- }
24
-
25
-
26
- module.exports = {
27
- fileName,
28
- isUserConfigFileAvailable,
29
- generateConfigFromFile
30
- };
@@ -1,43 +0,0 @@
1
- const { spawn } = require('child_process');
2
- const path = require('path');
3
- const { Logger } = require('../../utils/logger');
4
- const { getExecutableBinaryPath } = require('../../utils/rootPath');
5
-
6
-
7
- const userArgs = process.argv.slice(3);
8
-
9
- const playwrightPath = path.resolve(getExecutableBinaryPath('playwright'));;
10
- const command = playwrightPath;
11
- const reportPath = path.resolve(process.cwd(), './playwright-report');
12
-
13
-
14
- const args = ['show-report', reportPath].concat(userArgs);
15
-
16
- function generateReport() {
17
- const childProcess = spawn(command, args, { stdio: 'inherit' });
18
- childProcess.on('error', (error) => {
19
- Logger.log(Logger.FAILURE_TYPE, error);
20
- })
21
-
22
- childProcess.on('exit', (code, signal) => {
23
- Logger.log(Logger.FAILURE_TYPE, `Child Process Exited with Code ${code} and Signal ${signal}`);
24
-
25
- process.exit();
26
- });
27
-
28
- process.on('exit', () => {
29
- Logger.log(Logger.INFO_TYPE, 'Terminating Playwright Process...');
30
- childProcess.kill();
31
- return;
32
- });
33
-
34
- process.on('SIGINT', () => {
35
- Logger.log(Logger.INFO_TYPE, 'Cleaning up...');
36
- childProcess.kill();
37
- process.exit();
38
-
39
- });
40
- }
41
-
42
-
43
- module.exports = generateReport;
@@ -1,79 +0,0 @@
1
- // @ts-check
2
- const { defineConfig, devices } = require('@playwright/test');
3
- const path = require('path');
4
- const { generateConfigFromFile } = require('../readConfigFile');
5
- const numCPUs = require('os').cpus().length;
6
-
7
- const defaultBrowser = ['Chrome']
8
-
9
- const { browsers = defaultBrowser, isAuthMode, trace = false, video = false } = generateConfigFromFile();
10
-
11
-
12
- let projects = browsers.map(browser => {
13
- if (browser === 'Chrome') {
14
- return {
15
- name: 'chromium',
16
- use: {
17
- ...devices['Desktop Chrome'],
18
- storageState: isAuthMode ? path.resolve(process.cwd(), 'playwright/.auth/user.json') : null
19
- },
20
- dependencies: isAuthMode ? ['setup'] : [],
21
- };
22
- } else if (browser === 'Firefox') {
23
- return {
24
- name: 'firefox',
25
- timeout: 4 * 60 * 1000,
26
- expect: {
27
- timeout: 80 * 1000,
28
- },
29
- use: {
30
- ...devices['Desktop Firefox'],
31
- storageState: isAuthMode ? path.resolve(process.cwd(), 'playwright/.auth/user.json') : null
32
- },
33
- dependencies: isAuthMode ? ['setup'] : [],
34
- };
35
- } else if (browser === 'safari') {
36
- return {
37
- name: 'webkit',
38
- timeout: 2 * 60 * 1000,
39
- expect: {
40
- timeout: 80 * 1000,
41
- },
42
- use: {
43
- ...devices['Desktop Safari'],
44
- storageState: isAuthMode ? path.resolve(process.cwd(), 'playwright/.auth/user.json') : null
45
- },
46
- dependencies: isAuthMode ? ['setup'] : null,
47
- }
48
- }
49
- }).filter(Boolean);
50
-
51
- console.log(projects);
52
-
53
- module.exports = defineConfig({
54
- testDir: path.join(path.resolve(process.cwd()), 'uat'),
55
- outputDir: path.join(process.cwd(), 'test-results'),
56
- fullyParallel: true,
57
- forbidOnly: !!process.env.CI,
58
- retries: process.env.CI ? 2 : 0,
59
- workers: process.env.CI ? 1 : 1,
60
- reporter: [['html', { outputFolder: path.join(process.cwd(), 'playwright-report'), open: "always" }]],
61
- timeout: 60 * 1000,
62
- expect: {
63
- timeout: 5 * 1000,
64
- },
65
-
66
- use: {
67
- trace: trace ? 'on' : 'off',
68
- video: video ? {
69
- mode: 'on',
70
- size: { width: 640, height: 480 }
71
- } : 'off'
72
- },
73
-
74
- projects: isAuthMode ? [
75
- { name: 'setup', testMatch: /.*\.setup\.js/ },
76
- ...projects
77
- ] : [...projects]
78
- });
79
-
@@ -1,64 +0,0 @@
1
- const { spawn } = require('child_process');
2
- const path = require('path');
3
- const { CUSTOM_COMMANDS } = require('./custom-commands');
4
- const { cliArgsToObject, objectToCliArgs } = require('../../utils/cliArgsToObject');
5
- const { initializeEnvConfig } = require('./env-initializer');
6
- const { Logger } = require('../../utils/logger');
7
- const { isUserConfigFileAvailable } = require('./readConfigFile');
8
- const { getExecutableBinaryPath } = require('../../utils/rootPath');
9
-
10
-
11
-
12
- // Access the command line arguments
13
- const userArgs = process.argv.slice(2);
14
-
15
- const userArgsObject = cliArgsToObject(userArgs);
16
-
17
-
18
- // Environment variables Initialization
19
- initializeEnvConfig(userArgsObject.mode ? userArgsObject.mode : 'dev');
20
-
21
-
22
- const playwrightArgs = objectToCliArgs(userArgsObject, (key) => !CUSTOM_COMMANDS.includes(key));
23
-
24
- // Command and arguments for npx playwright test
25
- const playwrightPath = path.resolve(getExecutableBinaryPath('playwright'));
26
-
27
- const command = playwrightPath;
28
-
29
- const configPath = isUserConfigFileAvailable() ? require.resolve('./setup/config-creator.js') : require.resolve('../../../playwright.config.js');
30
-
31
- const args = ['test', '--config', configPath].concat(playwrightArgs);
32
-
33
-
34
- function createTestRunner() {
35
- // Spawn the child process
36
-
37
- const childProcess = spawn(command, args, { stdio: 'inherit' });
38
-
39
- childProcess.on('error', (error) => {
40
- Logger.log(Logger.FAILURE_TYPE, error);
41
- })
42
-
43
- childProcess.on('exit', (code, signal) => {
44
- Logger.log(Logger.FAILURE_TYPE, `Child Process Exited with Code ${code} and Signal ${signal}`);
45
-
46
- process.exit();
47
- });
48
-
49
- process.on('exit', () => {
50
- Logger.log(Logger.INFO_TYPE, 'Terminating Playwright Process...');
51
- //childProcess.kill();
52
- return;
53
- });
54
-
55
- process.on('SIGINT', () => {
56
- Logger.log(Logger.INFO_TYPE, 'Cleaning up...');
57
- //childProcess.kill();
58
- process.exit();
59
-
60
- });
61
- }
62
-
63
-
64
- module.exports = createTestRunner;
package/src/index.js DELETED
@@ -1,9 +0,0 @@
1
- const { expect, test } = require('./core/playwright/index');
2
- const { fireEvent, render } = require('@testing-library/react');
3
-
4
- module.exports = {
5
- expect,
6
- test,
7
- fireEvent,
8
- render
9
- }
package/src/lib/cli.js DELETED
@@ -1,35 +0,0 @@
1
- const createTestRunner = require("../core/playwright/test-runner");
2
- const createJestRunner = require('../core/jest/runner/jest-runner');
3
- const generateReport = require("../core/playwright/report-generator");
4
- const generateCodegen = require('../core/playwright/codegen')
5
- const { Logger } = require("../utils/logger");
6
-
7
- const [, , option] = process.argv;
8
- const args = process.argv.slice(3);
9
- const appPath = process.cwd();
10
-
11
-
12
- switch (option) {
13
- case 'test': {
14
- Logger.log(Logger.SUCCESS_TYPE, 'Running Tests..');
15
- createTestRunner();
16
- //createJestRunner();
17
- break;
18
- }
19
- case 'report': {
20
- // console.log('\x1b[36mGenerating Reports...\x1b[0m');
21
- Logger.log(Logger.SUCCESS_TYPE, 'Generating Reports...');
22
- generateReport();
23
- break;
24
- }
25
- case 'codegen': {
26
- Logger.log(Logger.INFO_TYPE, 'The purpose of codegen is to assist developer .....')
27
- generateCodegen();
28
- break;
29
- }
30
-
31
- default: {
32
- console.log('Supported Commands test and report')
33
- break;
34
- }
35
- }
@@ -1,35 +0,0 @@
1
- function cliArgsToObject(cliArgs, isKeyNeedToBeAdded) {
2
- const processEnv = {};
3
- cliArgs.forEach(option => {
4
- if (/^--./.test(option)) {
5
- const equIndex = option.indexOf('=');
6
- let key = option.slice(2, equIndex);
7
- let value = option.slice(equIndex + 1);
8
- if (equIndex === -1) {
9
- key = option.slice(2);
10
- value = true;
11
- }
12
- processEnv[key] = value;
13
- }
14
- });
15
- return processEnv;
16
- }
17
-
18
- function objectToCliArgs(objectToBeConverted, isKeyNeedToBeAdded) {
19
- const argsArray = [];
20
-
21
- Object.keys(objectToBeConverted).forEach(key => {
22
- if (isKeyNeedToBeAdded(key)) {
23
- if (typeof objectToBeConverted[key] === 'boolean' && objectToBeConverted[key]) {
24
- argsArray.push(`--${key}`)
25
- } else {
26
- argsArray.push(`--${key}=${objectToBeConverted[key]}`)
27
- }
28
- }
29
- })
30
-
31
- return argsArray;
32
- }
33
-
34
-
35
- module.exports = { cliArgsToObject, objectToCliArgs };
@@ -1,9 +0,0 @@
1
- const { platform } = require('os');
2
-
3
- const isWindows = platform().toLowerCase() === 'win32';
4
-
5
- function getFilePathWithExtension(binName) {
6
- return isWindows ? `${binName}.cmd` : binName;
7
- }
8
-
9
- module.exports = getFilePathWithExtension;
@@ -1,28 +0,0 @@
1
- const SUCCESS_TYPE = 'success';
2
- const FAILURE_TYPE = 'failure';
3
- const INFO_TYPE = 'info';
4
-
5
- function logger() {
6
- this.colors = {
7
- 'success': ['\x1b[36m', '\x1b[0m'],
8
- 'failure': ['\x1b[31m', '\x1b[0m'],
9
- 'info': ['\x1b[33m', '\x1b[0m']
10
- }
11
- this.consoleLogger = console;
12
- return {
13
- SUCCESS_TYPE,
14
- FAILURE_TYPE,
15
- INFO_TYPE,
16
- error: () => { },
17
- info: () => { },
18
- log: (type, message) => {
19
- const color = this.colors[type];
20
- this.consoleLogger.log(`${color[0]}${message}${color[1]}`)
21
- }
22
- }
23
- }
24
-
25
-
26
- module.exports = {
27
- Logger: logger()
28
- }
@@ -1,51 +0,0 @@
1
- const path = require('path')
2
- const fs = require('fs');
3
- const { Logger } = require('./logger');
4
- const getFilePathWithExtension = require('./getFilePath');
5
-
6
- function findBinaryPath(directory, command) {
7
- const binaryPath = path.join(directory, '.bin', getFilePathWithExtension(command));
8
- if (fs.existsSync(binaryPath)) {
9
- return binaryPath;
10
- }
11
-
12
- // Recursively search parent directories. Might be time-consuming ?? Can we look for npm module like which?
13
- const parentDir = path.dirname(directory);
14
- if (parentDir === directory) {
15
- return null;
16
- }
17
-
18
- return findBinaryPath(parentDir, command);
19
- }
20
-
21
- function getRootPath() {
22
- return path.resolve(__dirname, '../', '../');
23
- }
24
-
25
- function getRootNodeModulesPath() {
26
- return path.resolve(getRootPath(), 'node_modules');
27
- }
28
-
29
- function getBinPath(command) {
30
- const packageNodeModulesPath = getRootNodeModulesPath();
31
- return findBinaryPath(packageNodeModulesPath, command);
32
-
33
- }
34
-
35
-
36
- function getExecutableBinaryPath(command) {
37
- const binPath = getBinPath(command);
38
- if (binPath !== null) {
39
- return binPath;
40
- } else {
41
- Logger.log(Logger.FAILURE_TYPE, `Error: Could not find executable bin file. Make sure to npm install before proceeding`);
42
- process.exit();
43
- }
44
- }
45
-
46
- module.exports = {
47
- getRootPath,
48
- getBinPath,
49
- getRootNodeModulesPath,
50
- getExecutableBinaryPath
51
- }