@memlab/cli 1.0.17 → 1.0.19

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 (47) hide show
  1. package/dist/options/DebugOption.js +6 -2
  2. package/dist/options/HelperOption.js +6 -2
  3. package/dist/options/MLClusteringLinkageMaxDistanceOption.js +9 -3
  4. package/dist/options/MLClusteringMaxDFOption.js +9 -3
  5. package/dist/options/MLClusteringOption.js +7 -2
  6. package/dist/options/NumberOfRunsOption.js +5 -1
  7. package/dist/options/SetContinuousTestOption.js +7 -2
  8. package/dist/options/SetWorkingDirectoryOption.js +5 -1
  9. package/dist/options/SilentOption.js +6 -2
  10. package/dist/options/VerboseOption.js +6 -2
  11. package/dist/options/constant.d.ts +50 -0
  12. package/dist/options/constant.js +52 -0
  13. package/dist/options/e2e/AppOption.js +9 -5
  14. package/dist/options/e2e/DisableWebSecurityOption.js +5 -1
  15. package/dist/options/e2e/DisableXvfbOption.js +6 -2
  16. package/dist/options/e2e/EnableJSInterceptOption.d.ts +18 -0
  17. package/dist/options/e2e/EnableJSInterceptOption.js +42 -0
  18. package/dist/options/e2e/EnableJSRewriteOption.js +8 -1
  19. package/dist/options/e2e/FullExecutionOption.js +6 -2
  20. package/dist/options/e2e/HeadfulBrowserOption.js +5 -1
  21. package/dist/options/e2e/InteractionOption.js +9 -5
  22. package/dist/options/e2e/RemoteBrowserDebugOption.js +6 -2
  23. package/dist/options/e2e/RunningModeOption.js +6 -2
  24. package/dist/options/e2e/ScenarioFileOption.js +9 -3
  25. package/dist/options/e2e/SetDeviceOption.js +9 -3
  26. package/dist/options/e2e/SetUserAgentOption.js +5 -1
  27. package/dist/options/e2e/SkipExtraOperationOption.js +7 -2
  28. package/dist/options/e2e/SkipGCOption.js +5 -1
  29. package/dist/options/e2e/SkipScreenshotOption.js +6 -2
  30. package/dist/options/e2e/SkipScrollOption.js +6 -2
  31. package/dist/options/e2e/SkipSnapshotOption.js +6 -2
  32. package/dist/options/e2e/SkipWarmupOption.js +5 -1
  33. package/dist/options/heap/BaselineFileOption.js +5 -3
  34. package/dist/options/heap/FinalFileOption.js +5 -3
  35. package/dist/options/heap/HeapNodeIdOption.js +5 -1
  36. package/dist/options/heap/JSEngineOption.js +8 -3
  37. package/dist/options/heap/LeakClusterSizeThresholdOption.js +5 -1
  38. package/dist/options/heap/LogTraceAsClusterOption.js +5 -1
  39. package/dist/options/heap/OversizeThresholdOption.js +5 -1
  40. package/dist/options/heap/SnapshotDirectoryOption.js +5 -3
  41. package/dist/options/heap/SnapshotFileOption.js +5 -3
  42. package/dist/options/heap/TargetFileOption.js +5 -3
  43. package/dist/options/heap/TraceAllObjectsOption.js +5 -1
  44. package/dist/options/heap/leak-filter/LeakFilterFileOption.js +5 -1
  45. package/dist/options/lib/OptionConstant.d.ts +116 -0
  46. package/dist/options/lib/OptionConstant.js +67 -0
  47. package/package.json +1 -1
@@ -17,12 +17,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
22
25
  const e2e_1 = require("@memlab/e2e");
26
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
23
27
  class ScenarioFileOption extends core_1.BaseOption {
24
28
  getOptionName() {
25
- return 'scenario';
29
+ return OptionConstant_1.default.optionNames.SCENARIO;
26
30
  }
27
31
  getDescription() {
28
32
  return 'set file path loading test scenario';
@@ -32,11 +36,13 @@ class ScenarioFileOption extends core_1.BaseOption {
32
36
  }
33
37
  parse(config, args) {
34
38
  return __awaiter(this, void 0, void 0, function* () {
35
- if (args.scenario) {
36
- const scenarioFile = args.scenario;
39
+ const name = this.getOptionName();
40
+ if (args[name]) {
41
+ const scenarioFile = args[name];
37
42
  // load scenario file and get target app name
38
43
  config.scenario = core_1.utils.loadScenario(scenarioFile);
39
44
  config.targetApp = e2e_1.E2EUtils.getScenarioAppName(config.scenario);
45
+ config.targetTab = core_1.constant.unset;
40
46
  }
41
47
  });
42
48
  }
@@ -17,8 +17,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  const devices = core_1.constant.isFRL
23
27
  ? {}
24
28
  : core_1.constant.isFB
@@ -27,7 +31,7 @@ const devices = core_1.constant.isFRL
27
31
  require('puppeteer').devices;
28
32
  class SetDeviceOption extends core_1.BaseOption {
29
33
  getOptionName() {
30
- return 'device';
34
+ return OptionConstant_1.default.optionNames.DEVICE;
31
35
  }
32
36
  getDescription() {
33
37
  return 'set the device type to emulate';
@@ -37,8 +41,10 @@ class SetDeviceOption extends core_1.BaseOption {
37
41
  }
38
42
  parse(config, args) {
39
43
  return __awaiter(this, void 0, void 0, function* () {
40
- if (args.device) {
41
- config.setDevice(args.device, { manualOverride: true });
44
+ const name = this.getOptionName();
45
+ const arg = args[name];
46
+ if (arg) {
47
+ config.setDevice(arg, { manualOverride: true });
42
48
  }
43
49
  });
44
50
  }
@@ -17,11 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class SetUserAgentOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'user-agent';
28
+ return OptionConstant_1.default.optionNames.USER_AGENT;
25
29
  }
26
30
  getDescription() {
27
31
  return ('set the UserAgent string in browser (for E2E interaction), ' +
@@ -17,18 +17,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class SkipExtraOperationOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'skip-extra-ops';
28
+ return OptionConstant_1.default.optionNames.SKIP_EXTRA_OPS;
25
29
  }
26
30
  getDescription() {
27
31
  return 'skip doing extra interactions (e.g., scrolling and waiting) on target and final page';
28
32
  }
29
33
  parse(config, args) {
30
34
  return __awaiter(this, void 0, void 0, function* () {
31
- if (args['skip-extra-ops'] || args['skip-extra-op']) {
35
+ if (args[this.getOptionName()] ||
36
+ args[OptionConstant_1.default.optionNames.SKIP_EXTRA_OP]) {
32
37
  config.skipExtraOps = true;
33
38
  }
34
39
  });
@@ -17,11 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class SkipGCOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'skip-gc';
28
+ return OptionConstant_1.default.optionNames.SKIP_GC;
25
29
  }
26
30
  getDescription() {
27
31
  return 'skip doing garbage collection in browser';
@@ -17,18 +17,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class SkipScreenshotOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'skip-screenshot';
28
+ return OptionConstant_1.default.optionNames.SKIP_SCREENSHOT;
25
29
  }
26
30
  getDescription() {
27
31
  return 'skip taking screenshots';
28
32
  }
29
33
  parse(config, args) {
30
34
  return __awaiter(this, void 0, void 0, function* () {
31
- if (args['skip-screenshot']) {
35
+ if (args[this.getOptionName()]) {
32
36
  config.skipScreenshot = true;
33
37
  }
34
38
  });
@@ -17,18 +17,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class SkipScrollOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'skip-scroll';
28
+ return OptionConstant_1.default.optionNames.SKIP_SCROLL;
25
29
  }
26
30
  getDescription() {
27
31
  return 'skip scrolling target page in browser';
28
32
  }
29
33
  parse(config, args) {
30
34
  return __awaiter(this, void 0, void 0, function* () {
31
- if (args['skip-scroll']) {
35
+ if (args[this.getOptionName()]) {
32
36
  config.skipScroll = true;
33
37
  }
34
38
  });
@@ -17,18 +17,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class SkipSnapshotOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'skip-snapshot';
28
+ return OptionConstant_1.default.optionNames.SKIP_SNAPSHOT;
25
29
  }
26
30
  getDescription() {
27
31
  return 'skip taking heap snapshots';
28
32
  }
29
33
  parse(config, args) {
30
34
  return __awaiter(this, void 0, void 0, function* () {
31
- if (args['skip-snapshot']) {
35
+ if (args[this.getOptionName()]) {
32
36
  config.skipSnapshot = true;
33
37
  }
34
38
  });
@@ -17,11 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class SkipWarmupOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'skip-warmup';
28
+ return OptionConstant_1.default.optionNames.SKIP_WARMUP;
25
29
  }
26
30
  getDescription() {
27
31
  return 'skip warming up web server';
@@ -23,9 +23,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  const fs_1 = __importDefault(require("fs"));
25
25
  const core_1 = require("@memlab/core");
26
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
26
27
  class BaselineFileOption extends core_1.BaseOption {
27
28
  getOptionName() {
28
- return 'baseline';
29
+ return OptionConstant_1.default.optionNames.BASELINE;
29
30
  }
30
31
  getDescription() {
31
32
  return 'set file path of the baseline heap snapshot';
@@ -35,10 +36,11 @@ class BaselineFileOption extends core_1.BaseOption {
35
36
  }
36
37
  parse(config, args) {
37
38
  return __awaiter(this, void 0, void 0, function* () {
38
- if (!args.baseline) {
39
+ const name = this.getOptionName();
40
+ if (!args[name]) {
39
41
  return;
40
42
  }
41
- const file = args.baseline;
43
+ const file = args[name];
42
44
  if (!fs_1.default.existsSync(file)) {
43
45
  core_1.utils.haltOrThrow(`Invalid snapshot file: ${file}`);
44
46
  }
@@ -23,9 +23,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  const fs_1 = __importDefault(require("fs"));
25
25
  const core_1 = require("@memlab/core");
26
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
26
27
  class FinalFileOption extends core_1.BaseOption {
27
28
  getOptionName() {
28
- return 'final';
29
+ return OptionConstant_1.default.optionNames.FINAL;
29
30
  }
30
31
  getDescription() {
31
32
  return 'set file path of the final heap snapshot';
@@ -35,10 +36,11 @@ class FinalFileOption extends core_1.BaseOption {
35
36
  }
36
37
  parse(config, args) {
37
38
  return __awaiter(this, void 0, void 0, function* () {
38
- if (!args.final) {
39
+ const name = this.getOptionName();
40
+ if (!args[name]) {
39
41
  return;
40
42
  }
41
- const file = args.final;
43
+ const file = args[name];
42
44
  if (!fs_1.default.existsSync(file)) {
43
45
  core_1.utils.haltOrThrow(`Invalid snapshot file: ${file}`);
44
46
  }
@@ -17,11 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class HeapNodeIdOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'node-id';
28
+ return OptionConstant_1.default.optionNames.NODE_ID;
25
29
  }
26
30
  getDescription() {
27
31
  return 'set heap node ID';
@@ -17,11 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class JSEngineOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'engine';
28
+ return OptionConstant_1.default.optionNames.ENGINE;
25
29
  }
26
30
  getDescription() {
27
31
  return 'set the JavaScript engine (default to V8)';
@@ -31,10 +35,11 @@ class JSEngineOption extends core_1.BaseOption {
31
35
  }
32
36
  parse(config, args) {
33
37
  return __awaiter(this, void 0, void 0, function* () {
34
- if (!args.engine) {
38
+ const name = this.getOptionName();
39
+ if (!args[name]) {
35
40
  return;
36
41
  }
37
- config.jsEngine = args.engine;
42
+ config.jsEngine = args[name];
38
43
  config.specifiedEngine = true;
39
44
  if (core_1.constant.supportedEngines.indexOf(config.jsEngine) < 0) {
40
45
  core_1.utils.haltOrThrow(`Invalid engine: ${config.jsEngine} ` +
@@ -17,11 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class LeakClusterSizeThresholdOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'ignore-leak-cluster-size-below';
28
+ return OptionConstant_1.default.optionNames.IGNORE_LEAK_CLUSTER_SIZE_BELOW;
25
29
  }
26
30
  getDescription() {
27
31
  return 'ignore memory leaks with aggregated retained size smaller than the threshold';
@@ -17,11 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class LogTraceAsClusterOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'save-trace-as-unclassified-cluster';
28
+ return OptionConstant_1.default.optionNames.SAVE_TRACE_AS_UNCLASSIFIED_CLUSTER;
25
29
  }
26
30
  getDescription() {
27
31
  return 'dump each retainer trace as an unclassified trace cluster';
@@ -17,11 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class OversizeThresholdOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'trace-object-size-above';
28
+ return OptionConstant_1.default.optionNames.TRACE_OBJECT_SIZE_ABOVE;
25
29
  }
26
30
  getDescription() {
27
31
  return ('objects with retained size (bytes) ' +
@@ -23,9 +23,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  const fs_1 = __importDefault(require("fs"));
25
25
  const core_1 = require("@memlab/core");
26
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
26
27
  class SnapshotDirectoryOption extends core_1.BaseOption {
27
28
  getOptionName() {
28
- return 'snapshot-dir';
29
+ return OptionConstant_1.default.optionNames.SNAPSHOT_DIR;
29
30
  }
30
31
  getDescription() {
31
32
  return 'set directory path containing all heap snapshots under analysis';
@@ -35,10 +36,11 @@ class SnapshotDirectoryOption extends core_1.BaseOption {
35
36
  }
36
37
  parse(config, args) {
37
38
  return __awaiter(this, void 0, void 0, function* () {
38
- if (!args['snapshot-dir']) {
39
+ const name = this.getOptionName();
40
+ if (!args[name]) {
39
41
  return;
40
42
  }
41
- const dir = args['snapshot-dir'];
43
+ const dir = args[name];
42
44
  if (!fs_1.default.existsSync(dir)) {
43
45
  core_1.utils.haltOrThrow(`Invalid directory: ${dir}`);
44
46
  }
@@ -23,9 +23,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  const fs_1 = __importDefault(require("fs"));
25
25
  const core_1 = require("@memlab/core");
26
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
26
27
  class SnapshotFileOption extends core_1.BaseOption {
27
28
  getOptionName() {
28
- return 'snapshot';
29
+ return OptionConstant_1.default.optionNames.SNAPSHOT;
29
30
  }
30
31
  getDescription() {
31
32
  return 'set file path of the heap snapshot under analysis';
@@ -35,10 +36,11 @@ class SnapshotFileOption extends core_1.BaseOption {
35
36
  }
36
37
  parse(config, args) {
37
38
  return __awaiter(this, void 0, void 0, function* () {
38
- if (!args.snapshot) {
39
+ const name = this.getOptionName();
40
+ if (!args[name]) {
39
41
  return;
40
42
  }
41
- const file = args.snapshot;
43
+ const file = args[name];
42
44
  if (!fs_1.default.existsSync(file)) {
43
45
  core_1.utils.haltOrThrow(`Invalid snapshot file: ${file}`);
44
46
  }
@@ -23,9 +23,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  const fs_1 = __importDefault(require("fs"));
25
25
  const core_1 = require("@memlab/core");
26
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
26
27
  class TargetFileOption extends core_1.BaseOption {
27
28
  getOptionName() {
28
- return 'target';
29
+ return OptionConstant_1.default.optionNames.TARGET;
29
30
  }
30
31
  getDescription() {
31
32
  return 'set file path of the target heap snapshot';
@@ -35,10 +36,11 @@ class TargetFileOption extends core_1.BaseOption {
35
36
  }
36
37
  parse(config, args) {
37
38
  return __awaiter(this, void 0, void 0, function* () {
38
- if (!args.target) {
39
+ const name = this.getOptionName();
40
+ if (!args[name]) {
39
41
  return;
40
42
  }
41
- const file = args.target;
43
+ const file = args[name];
42
44
  if (!fs_1.default.existsSync(file)) {
43
45
  core_1.utils.haltOrThrow(`Invalid snapshot file: ${file}`);
44
46
  }
@@ -17,11 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../lib/OptionConstant"));
22
26
  class TraceAllObjectsOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'trace-all-objects';
28
+ return OptionConstant_1.default.optionNames.TRACE_ALL_OBJECTS;
25
29
  }
26
30
  getDescription() {
27
31
  return 'dump retainer trace for all allocated objects (ignore the leak filter)';
@@ -17,11 +17,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  step((generator = generator.apply(thisArg, _arguments || [])).next());
18
18
  });
19
19
  };
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  const core_1 = require("@memlab/core");
25
+ const OptionConstant_1 = __importDefault(require("../../lib/OptionConstant"));
22
26
  class LeakFilterFileOption extends core_1.BaseOption {
23
27
  getOptionName() {
24
- return 'leak-filter';
28
+ return OptionConstant_1.default.optionNames.LEAK_FILTER;
25
29
  }
26
30
  getDescription() {
27
31
  return 'specify a definition JS file for leak filter';
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ * @oncall web_perf_infra
9
+ */
10
+ declare const optionConstants: {
11
+ optionNames: {
12
+ APP: string;
13
+ BASELINE: string;
14
+ CONTINUS_TEST: string;
15
+ DEVICE: string;
16
+ DISABLE_WEB_SECURITY: string;
17
+ DISABLE_XVFB: string;
18
+ ENGINE: string;
19
+ FINAL: string;
20
+ FULL: string;
21
+ HEADFUL: string;
22
+ HELP: string;
23
+ IGNORE_LEAK_CLUSTER_SIZE_BELOW: string;
24
+ INTERACTION: string;
25
+ LEAK_FILTER: string;
26
+ LOCAL_PUPPETEER: string;
27
+ LOG_SCRIPT: string;
28
+ ML_CLUSTERING: string;
29
+ ML_CLUSTERING_MAX_DF: string;
30
+ ML_LINKAGE_MAX_DIST: string;
31
+ NODE_ID: string;
32
+ REWRITE_JS: string;
33
+ RUN_MODE: string;
34
+ RUN_NUM: string;
35
+ SAVE_TRACE_AS_UNCLASSIFIED_CLUSTER: string;
36
+ SC: string;
37
+ SCENARIO: string;
38
+ SILENT: string;
39
+ SKIP_EXTRA_OP: string;
40
+ SKIP_EXTRA_OPS: string;
41
+ SKIP_GC: string;
42
+ SKIP_SCREENSHOT: string;
43
+ SKIP_SCROLL: string;
44
+ SKIP_SNAPSHOT: string;
45
+ SKIP_WARMUP: string;
46
+ SNAPSHOT: string;
47
+ SNAPSHOT_DIR: string;
48
+ TARGET: string;
49
+ TRACE_ALL_OBJECTS: string;
50
+ TRACE_OBJECT_SIZE_ABOVE: string;
51
+ USER_AGENT: string;
52
+ VERBOSE: string;
53
+ WORK_DIR: string;
54
+ DEBUG: string;
55
+ };
56
+ optionShortcuts: {
57
+ H: string;
58
+ S: string;
59
+ V: string;
60
+ };
61
+ };
62
+ export declare type OptionConstants = typeof optionConstants;
63
+ declare const _default: {
64
+ optionNames: {
65
+ APP: string;
66
+ BASELINE: string;
67
+ CONTINUS_TEST: string;
68
+ DEVICE: string;
69
+ DISABLE_WEB_SECURITY: string;
70
+ DISABLE_XVFB: string;
71
+ ENGINE: string;
72
+ FINAL: string;
73
+ FULL: string;
74
+ HEADFUL: string;
75
+ HELP: string;
76
+ IGNORE_LEAK_CLUSTER_SIZE_BELOW: string;
77
+ INTERACTION: string;
78
+ LEAK_FILTER: string;
79
+ LOCAL_PUPPETEER: string;
80
+ LOG_SCRIPT: string;
81
+ ML_CLUSTERING: string;
82
+ ML_CLUSTERING_MAX_DF: string;
83
+ ML_LINKAGE_MAX_DIST: string;
84
+ NODE_ID: string;
85
+ REWRITE_JS: string;
86
+ RUN_MODE: string;
87
+ RUN_NUM: string;
88
+ SAVE_TRACE_AS_UNCLASSIFIED_CLUSTER: string;
89
+ SC: string;
90
+ SCENARIO: string;
91
+ SILENT: string;
92
+ SKIP_EXTRA_OP: string;
93
+ SKIP_EXTRA_OPS: string;
94
+ SKIP_GC: string;
95
+ SKIP_SCREENSHOT: string;
96
+ SKIP_SCROLL: string;
97
+ SKIP_SNAPSHOT: string;
98
+ SKIP_WARMUP: string;
99
+ SNAPSHOT: string;
100
+ SNAPSHOT_DIR: string;
101
+ TARGET: string;
102
+ TRACE_ALL_OBJECTS: string;
103
+ TRACE_OBJECT_SIZE_ABOVE: string;
104
+ USER_AGENT: string;
105
+ VERBOSE: string;
106
+ WORK_DIR: string;
107
+ DEBUG: string;
108
+ };
109
+ optionShortcuts: {
110
+ H: string;
111
+ S: string;
112
+ V: string;
113
+ };
114
+ };
115
+ export default _default;
116
+ //# sourceMappingURL=OptionConstant.d.ts.map