@memlab/api 1.0.27 → 1.0.29
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.
package/dist/API.d.ts
CHANGED
|
@@ -28,7 +28,10 @@ export type RunOptions = {
|
|
|
28
28
|
cookiesFile?: string;
|
|
29
29
|
/**
|
|
30
30
|
* function to be evaluated in browser context after
|
|
31
|
-
* the web page initial load
|
|
31
|
+
* the web page initial load.
|
|
32
|
+
* Note that this function is defined in node.js context but it will be
|
|
33
|
+
* evaluated in browser context so the function should not use any closure
|
|
34
|
+
* variables outside of the browser context.
|
|
32
35
|
*/
|
|
33
36
|
evalInBrowserAfterInitLoad?: AnyFunction;
|
|
34
37
|
/**
|
|
@@ -55,7 +58,7 @@ export type RunOptions = {
|
|
|
55
58
|
*/
|
|
56
59
|
webWorker?: Optional<string>;
|
|
57
60
|
/**
|
|
58
|
-
* skip
|
|
61
|
+
* skip the initial page loading warmup for the web application being tested
|
|
59
62
|
*/
|
|
60
63
|
skipWarmup?: boolean;
|
|
61
64
|
/**
|
|
@@ -64,7 +67,11 @@ export type RunOptions = {
|
|
|
64
67
|
*/
|
|
65
68
|
consoleMode?: ConsoleMode;
|
|
66
69
|
/**
|
|
67
|
-
*
|
|
70
|
+
* if not specified, memlab will use the Chromium binary installed
|
|
71
|
+
* by Puppeteer. Use this option to specify a different binary if
|
|
72
|
+
* Puppeteer does not install the Chromium binary correctly (e.g., in a
|
|
73
|
+
* environtment Docker) or when you may want to use a different version of
|
|
74
|
+
* Chromium binary.
|
|
68
75
|
*/
|
|
69
76
|
chromiumBinary?: string;
|
|
70
77
|
};
|
package/dist/API.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"API.d.ts","sourceRoot":"","sources":["../src/API.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EACV,WAA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;GAcG;AACH,wBAAsB,4BAA4B,CAChD,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CAAM,GAC1D,OAAO,CAAC,eAAe,EAAE,CAAC,CAa5B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,OAAO,CAC3B,SAAS,EAAE,gBAAgB,EAC3B,YAAY,EAAE,YAAY,EAC1B,IAAI,GAAE,UAAoB,GACzB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED;;;;;;GAMG;AACH,wBAAsB,MAAM,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAuCpE;AA4DD;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAqD3E"}
|
|
@@ -49,6 +49,32 @@ export default class BaseResultReader {
|
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
getRootDirectory(): string;
|
|
52
|
+
/**
|
|
53
|
+
* This method gets the backup file of the console output.
|
|
54
|
+
*
|
|
55
|
+
* The memlab CLI commands (e.g., `memlab find-leaks`) outputs a
|
|
56
|
+
* non-structured string representation for easy reading, while the
|
|
57
|
+
* APIs (e.g., <code>{@link findLeaks}</code>) return structured leaks
|
|
58
|
+
* representation that is handy for post-processing. If you need to
|
|
59
|
+
* obtain all the string output from the CLI in the current working directory,
|
|
60
|
+
* you can read them from the CLI output backup file returned by this method.
|
|
61
|
+
*
|
|
62
|
+
* @returns the absolute path of the backup file
|
|
63
|
+
* * **Examples**:
|
|
64
|
+
* ```javascript
|
|
65
|
+
* const {takeSnapshots, findLeaks} = require('@memlab/api');
|
|
66
|
+
*
|
|
67
|
+
* (async function () {
|
|
68
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
69
|
+
* const result = await takeSnapshots({scenario});
|
|
70
|
+
* const leaks = await findLeaks(result);
|
|
71
|
+
*
|
|
72
|
+
* // get the console output backup file
|
|
73
|
+
* const consoleBackupFile = result.getConsoleBackupFile();
|
|
74
|
+
* })();
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
getConsoleBackupFile(): string;
|
|
52
78
|
/**
|
|
53
79
|
* clean up data/files generated from the memlab browser interaction run
|
|
54
80
|
* @returns no return value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseResultReader.d.ts","sourceRoot":"","sources":["../../src/result-reader/BaseResultReader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAQ,WAAW,EAAC,MAAM,cAAc,CAAC;AAGhD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,OAAO,CAAC,OAAO,CAAU;IAEzB;;;;OAIG;IACH,SAAS,aAAa,OAAO,SAAK;IASlC,SAAS,CAAC,KAAK,IAAI,IAAI;IAOvB;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,SAAK,GAAG,gBAAgB;IAI3C;;;;;;;;;;;;;;;;;OAiBG;IACI,gBAAgB,IAAI,MAAM;IAKjC;;;;;;;;;;;;;;;OAeG;IACI,OAAO,IAAI,IAAI;CAOvB"}
|
|
1
|
+
{"version":3,"file":"BaseResultReader.d.ts","sourceRoot":"","sources":["../../src/result-reader/BaseResultReader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAQ,WAAW,EAAC,MAAM,cAAc,CAAC;AAGhD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,OAAO,CAAC,OAAO,CAAU;IAEzB;;;;OAIG;IACH,SAAS,aAAa,OAAO,SAAK;IASlC,SAAS,CAAC,KAAK,IAAI,IAAI;IAOvB;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,SAAK,GAAG,gBAAgB;IAI3C;;;;;;;;;;;;;;;;;OAiBG;IACI,gBAAgB,IAAI,MAAM;IAKjC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACI,oBAAoB,IAAI,MAAM;IAIrC;;;;;;;;;;;;;;;OAeG;IACI,OAAO,IAAI,IAAI;CAOvB"}
|
|
@@ -69,6 +69,34 @@ class BaseResultReader {
|
|
|
69
69
|
this.check();
|
|
70
70
|
return this.workDir;
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* This method gets the backup file of the console output.
|
|
74
|
+
*
|
|
75
|
+
* The memlab CLI commands (e.g., `memlab find-leaks`) outputs a
|
|
76
|
+
* non-structured string representation for easy reading, while the
|
|
77
|
+
* APIs (e.g., <code>{@link findLeaks}</code>) return structured leaks
|
|
78
|
+
* representation that is handy for post-processing. If you need to
|
|
79
|
+
* obtain all the string output from the CLI in the current working directory,
|
|
80
|
+
* you can read them from the CLI output backup file returned by this method.
|
|
81
|
+
*
|
|
82
|
+
* @returns the absolute path of the backup file
|
|
83
|
+
* * **Examples**:
|
|
84
|
+
* ```javascript
|
|
85
|
+
* const {takeSnapshots, findLeaks} = require('@memlab/api');
|
|
86
|
+
*
|
|
87
|
+
* (async function () {
|
|
88
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
89
|
+
* const result = await takeSnapshots({scenario});
|
|
90
|
+
* const leaks = await findLeaks(result);
|
|
91
|
+
*
|
|
92
|
+
* // get the console output backup file
|
|
93
|
+
* const consoleBackupFile = result.getConsoleBackupFile();
|
|
94
|
+
* })();
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
getConsoleBackupFile() {
|
|
98
|
+
return this.fileManager.getConsoleBackupFile({ workDir: this.workDir });
|
|
99
|
+
}
|
|
72
100
|
/**
|
|
73
101
|
* clean up data/files generated from the memlab browser interaction run
|
|
74
102
|
* @returns no return value
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memlab/api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "memlab API",
|
|
6
6
|
"author": "Liang Gong <lgong@fb.com>",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@memlab/core": "^1.1.
|
|
31
|
-
"@memlab/e2e": "^1.0.
|
|
32
|
-
"@memlab/heap-analysis": "^1.0.
|
|
30
|
+
"@memlab/core": "^1.1.30",
|
|
31
|
+
"@memlab/e2e": "^1.0.30",
|
|
32
|
+
"@memlab/heap-analysis": "^1.0.27",
|
|
33
33
|
"ansi": "^0.3.1",
|
|
34
34
|
"babar": "^0.2.0",
|
|
35
35
|
"chalk": "^4.0.0",
|
|
36
36
|
"fs-extra": "^4.0.2",
|
|
37
|
-
"minimist": "^1.2.
|
|
37
|
+
"minimist": "^1.2.8",
|
|
38
38
|
"puppeteer": "^21.0.3",
|
|
39
39
|
"puppeteer-core": "^21.0.3",
|
|
40
40
|
"string-width": "^4.2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/fs-extra": "^9.0.3",
|
|
46
46
|
"@types/jest": "^27.4.1",
|
|
47
|
-
"@types/minimist": "^1.2.
|
|
47
|
+
"@types/minimist": "^1.2.5",
|
|
48
48
|
"@types/node": "^12.16.3",
|
|
49
49
|
"@types/puppeteer": "^5.4.4",
|
|
50
50
|
"jest": "^29.6.2",
|