@memlab/api 1.0.2 → 1.0.3
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 +75 -16
- package/dist/API.js +74 -15
- package/dist/__tests__/API/E2EFindMemoryLeaks.test.js +22 -1
- package/dist/__tests__/API/E2EShapeUnboundGrowthAnalysis.test.js +4 -2
- package/dist/__tests__/packages/heap-analysis.test.d.ts +11 -0
- package/dist/__tests__/packages/heap-analysis.test.js +82 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -3
- package/dist/result-reader/BaseResultReader.d.ts +30 -9
- package/dist/result-reader/BaseResultReader.js +30 -6
- package/dist/result-reader/BrowserInteractionResultReader.d.ts +64 -5
- package/dist/result-reader/BrowserInteractionResultReader.js +64 -5
- package/package.json +1 -1
- package/dist/API.d.ts.map +0 -1
- package/dist/__tests__/API/E2EBasicAnalysis.test.d.ts.map +0 -1
- package/dist/__tests__/API/E2EDetachedDOMAnalysis.test.d.ts.map +0 -1
- package/dist/__tests__/API/E2EDuplicateObjectAnalysis.test.d.ts.map +0 -1
- package/dist/__tests__/API/E2EFindLeaks.example.d.ts.map +0 -1
- package/dist/__tests__/API/E2EFindMemoryLeaks.test.d.ts.map +0 -1
- package/dist/__tests__/API/E2EResultReader.test.d.ts.map +0 -1
- package/dist/__tests__/API/E2ERunMultipleSnapshots.example.d.ts.map +0 -1
- package/dist/__tests__/API/E2ERunSingleSnapshot.example.d.ts.map +0 -1
- package/dist/__tests__/API/E2EShapeUnboundGrowthAnalysis.test.d.ts.map +0 -1
- package/dist/__tests__/API/E2EStringAnalysis.test.d.ts.map +0 -1
- package/dist/__tests__/API/lib/E2ETestSettings.d.ts.map +0 -1
- package/dist/__tests__/heap/E2EHeapParser.test.d.ts.map +0 -1
- package/dist/__tests__/heap/lib/HeapParserTestUtils.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/APIUtils.d.ts.map +0 -1
- package/dist/result-reader/BaseResultReader.d.ts.map +0 -1
- package/dist/result-reader/BrowserInteractionResultReader.d.ts.map +0 -1
package/dist/API.d.ts
CHANGED
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
import type { ParsedArgs } from 'minimist';
|
|
11
|
-
import type { AnyFunction,
|
|
11
|
+
import type { AnyFunction, ISerializedInfo, IScenario } from '@memlab/core';
|
|
12
12
|
import { MemLabConfig } from '@memlab/core';
|
|
13
13
|
import { TestPlanner } from '@memlab/e2e';
|
|
14
14
|
import { BaseAnalysis } from '@memlab/heap-analysis';
|
|
15
15
|
import BrowserInteractionResultReader from './result-reader/BrowserInteractionResultReader';
|
|
16
16
|
/**
|
|
17
|
-
* Options for configuring browser interaction run
|
|
17
|
+
* Options for configuring browser interaction run, all fields are optional
|
|
18
18
|
*/
|
|
19
19
|
export declare type RunOptions = {
|
|
20
20
|
/** test scenario definition */
|
|
21
21
|
scenario?: IScenario;
|
|
22
|
-
/** cookies file */
|
|
22
|
+
/** the absolute path of cookies file */
|
|
23
23
|
cookiesFile?: string;
|
|
24
24
|
/** function to be evaluated in browser context after the web page initial load */
|
|
25
25
|
evalInBrowserAfterInitLoad?: AnyFunction;
|
|
@@ -31,8 +31,8 @@ export declare type RunOptions = {
|
|
|
31
31
|
snapshotForEachStep?: boolean;
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
|
-
* @ignore
|
|
35
34
|
* Options for memlab inter-package API calls
|
|
35
|
+
* @internal
|
|
36
36
|
*/
|
|
37
37
|
export declare type APIOptions = {
|
|
38
38
|
testPlanner?: TestPlanner;
|
|
@@ -43,29 +43,61 @@ export declare type APIOptions = {
|
|
|
43
43
|
/**
|
|
44
44
|
* This API warms up web server, runs E2E interaction, and takes heap snapshots.
|
|
45
45
|
* This is equivalent to run `memlab warmup-and-snapshot` in CLI.
|
|
46
|
-
* This is also equivalent to
|
|
46
|
+
* This is also equivalent to warm up and call {@link takeSnapshots}.
|
|
47
47
|
*
|
|
48
48
|
* @param options configure browser interaction run
|
|
49
49
|
* @returns browser interaction results
|
|
50
|
+
* * **Examples**:
|
|
51
|
+
* ```javascript
|
|
52
|
+
* const {warmupAndTakeSnapshots} = require('@memlab/api');
|
|
53
|
+
*
|
|
54
|
+
* (async function () {
|
|
55
|
+
* const scenario = {
|
|
56
|
+
* url: () => 'https://www.facebook.com',
|
|
57
|
+
* };
|
|
58
|
+
* const result = await warmupAndTakeSnapshots({scenario});
|
|
59
|
+
* })();
|
|
60
|
+
* ```
|
|
50
61
|
*/
|
|
51
62
|
export declare function warmupAndTakeSnapshots(options?: RunOptions): Promise<BrowserInteractionResultReader>;
|
|
52
63
|
/**
|
|
53
64
|
* This API runs browser interaction and find memory leaks triggered in browser
|
|
54
65
|
* This is equivalent to run `memlab run` in CLI.
|
|
55
|
-
* This is also equivalent to
|
|
66
|
+
* This is also equivalent to warm up, and call {@link takeSnapshots}
|
|
56
67
|
* and {@link findLeaks}.
|
|
57
68
|
*
|
|
58
|
-
* @param
|
|
59
|
-
* @returns
|
|
60
|
-
*
|
|
69
|
+
* @param runOptions configure browser interaction run
|
|
70
|
+
* @returns leak traces detected and clustered from the browser interaction
|
|
71
|
+
* * **Examples**:
|
|
72
|
+
* ```javascript
|
|
73
|
+
* const {run} = require('@memlab/api');
|
|
74
|
+
*
|
|
75
|
+
* (async function () {
|
|
76
|
+
* const scenario = {
|
|
77
|
+
* url: () => 'https://www.facebook.com',
|
|
78
|
+
* };
|
|
79
|
+
* const leaks = await run({scenario});
|
|
80
|
+
* })();
|
|
81
|
+
* ```
|
|
61
82
|
*/
|
|
62
|
-
export declare function run(
|
|
83
|
+
export declare function run(runOptions?: RunOptions): Promise<ISerializedInfo[]>;
|
|
63
84
|
/**
|
|
64
85
|
* This API runs E2E interaction and takes heap snapshots.
|
|
65
86
|
* This is equivalent to run `memlab snapshot` in CLI.
|
|
66
87
|
*
|
|
67
88
|
* @param options configure browser interaction run
|
|
68
89
|
* @returns browser interaction results
|
|
90
|
+
* * **Examples**:
|
|
91
|
+
* ```javascript
|
|
92
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
93
|
+
*
|
|
94
|
+
* (async function () {
|
|
95
|
+
* const scenario = {
|
|
96
|
+
* url: () => 'https://www.facebook.com',
|
|
97
|
+
* };
|
|
98
|
+
* const result = await takeSnapshots({scenario});
|
|
99
|
+
* })();
|
|
100
|
+
* ```
|
|
69
101
|
*/
|
|
70
102
|
export declare function takeSnapshots(options?: RunOptions): Promise<BrowserInteractionResultReader>;
|
|
71
103
|
/**
|
|
@@ -73,8 +105,19 @@ export declare function takeSnapshots(options?: RunOptions): Promise<BrowserInte
|
|
|
73
105
|
* This is equivalent to `memlab find-leaks` in CLI.
|
|
74
106
|
*
|
|
75
107
|
* @param runResult return value of a browser interaction run
|
|
76
|
-
* @returns
|
|
77
|
-
*
|
|
108
|
+
* @returns leak traces detected and clustered from the browser interaction
|
|
109
|
+
* * **Examples**:
|
|
110
|
+
* ```javascript
|
|
111
|
+
* const {findLeaks, takeSnapshots} = require('@memlab/api');
|
|
112
|
+
*
|
|
113
|
+
* (async function () {
|
|
114
|
+
* const scenario = {
|
|
115
|
+
* url: () => 'https://www.facebook.com',
|
|
116
|
+
* };
|
|
117
|
+
* const result = await takeSnapshots({scenario});
|
|
118
|
+
* const leaks = findLeaks(result);
|
|
119
|
+
* })();
|
|
120
|
+
* ```
|
|
78
121
|
*/
|
|
79
122
|
export declare function findLeaks(runResult: BrowserInteractionResultReader): Promise<ISerializedInfo[]>;
|
|
80
123
|
/**
|
|
@@ -84,19 +127,35 @@ export declare function findLeaks(runResult: BrowserInteractionResultReader): Pr
|
|
|
84
127
|
* @param runResult return value of a browser interaction run
|
|
85
128
|
* @param heapAnalyzer instance of a heap analysis
|
|
86
129
|
* @param args other CLI arguments that needs to be passed to the heap analysis
|
|
87
|
-
* @returns
|
|
130
|
+
* @returns each analysis may have a different return type, please check out
|
|
131
|
+
* the type definition or the documentation for the `process` method of the
|
|
132
|
+
* analysis class you are using for `heapAnalyzer`.
|
|
133
|
+
* * **Examples**:
|
|
134
|
+
* ```javascript
|
|
135
|
+
* const {takeSnapshots, StringAnalysis} = require('@memlab/api');
|
|
136
|
+
*
|
|
137
|
+
* (async function () {
|
|
138
|
+
* const scenario = {
|
|
139
|
+
* url: () => 'https://www.facebook.com',
|
|
140
|
+
* };
|
|
141
|
+
* const result = await takeSnapshots({scenario});
|
|
142
|
+
* const analysis = new StringAnalysis();
|
|
143
|
+
* await analyze(result, analysis);
|
|
144
|
+
* })();
|
|
145
|
+
* ```
|
|
88
146
|
*/
|
|
89
|
-
export declare function analyze(runResult: BrowserInteractionResultReader, heapAnalyzer: BaseAnalysis, args?: ParsedArgs): Promise<
|
|
147
|
+
export declare function analyze(runResult: BrowserInteractionResultReader, heapAnalyzer: BaseAnalysis, args?: ParsedArgs): Promise<void>;
|
|
90
148
|
/**
|
|
91
|
-
* @ignore
|
|
92
149
|
* This warms up web server by sending web requests to the web sever.
|
|
93
150
|
* This is equivalent to run `memlab warmup` in CLI.
|
|
151
|
+
* @internal
|
|
94
152
|
*
|
|
95
153
|
* @param options configure browser interaction run
|
|
96
154
|
*/
|
|
97
155
|
export declare function warmup(options?: APIOptions): Promise<void>;
|
|
98
156
|
/**
|
|
99
|
-
*
|
|
157
|
+
* Browser interaction API used by MemLab API and MemLab CLI
|
|
158
|
+
* @internal
|
|
100
159
|
*/
|
|
101
160
|
export declare function testInBrowser(options?: APIOptions): Promise<void>;
|
|
102
161
|
//# sourceMappingURL=API.d.ts.map
|
package/dist/API.js
CHANGED
|
@@ -29,10 +29,21 @@ const BrowserInteractionResultReader_1 = __importDefault(require("./result-reade
|
|
|
29
29
|
/**
|
|
30
30
|
* This API warms up web server, runs E2E interaction, and takes heap snapshots.
|
|
31
31
|
* This is equivalent to run `memlab warmup-and-snapshot` in CLI.
|
|
32
|
-
* This is also equivalent to
|
|
32
|
+
* This is also equivalent to warm up and call {@link takeSnapshots}.
|
|
33
33
|
*
|
|
34
34
|
* @param options configure browser interaction run
|
|
35
35
|
* @returns browser interaction results
|
|
36
|
+
* * **Examples**:
|
|
37
|
+
* ```javascript
|
|
38
|
+
* const {warmupAndTakeSnapshots} = require('@memlab/api');
|
|
39
|
+
*
|
|
40
|
+
* (async function () {
|
|
41
|
+
* const scenario = {
|
|
42
|
+
* url: () => 'https://www.facebook.com',
|
|
43
|
+
* };
|
|
44
|
+
* const result = await warmupAndTakeSnapshots({scenario});
|
|
45
|
+
* })();
|
|
46
|
+
* ```
|
|
36
47
|
*/
|
|
37
48
|
function warmupAndTakeSnapshots(options = {}) {
|
|
38
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -51,21 +62,31 @@ exports.warmupAndTakeSnapshots = warmupAndTakeSnapshots;
|
|
|
51
62
|
/**
|
|
52
63
|
* This API runs browser interaction and find memory leaks triggered in browser
|
|
53
64
|
* This is equivalent to run `memlab run` in CLI.
|
|
54
|
-
* This is also equivalent to
|
|
65
|
+
* This is also equivalent to warm up, and call {@link takeSnapshots}
|
|
55
66
|
* and {@link findLeaks}.
|
|
56
67
|
*
|
|
57
|
-
* @param
|
|
58
|
-
* @returns
|
|
59
|
-
*
|
|
68
|
+
* @param runOptions configure browser interaction run
|
|
69
|
+
* @returns leak traces detected and clustered from the browser interaction
|
|
70
|
+
* * **Examples**:
|
|
71
|
+
* ```javascript
|
|
72
|
+
* const {run} = require('@memlab/api');
|
|
73
|
+
*
|
|
74
|
+
* (async function () {
|
|
75
|
+
* const scenario = {
|
|
76
|
+
* url: () => 'https://www.facebook.com',
|
|
77
|
+
* };
|
|
78
|
+
* const leaks = await run({scenario});
|
|
79
|
+
* })();
|
|
80
|
+
* ```
|
|
60
81
|
*/
|
|
61
|
-
function run(
|
|
82
|
+
function run(runOptions = {}) {
|
|
62
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
84
|
const config = core_1.MemLabConfig.resetConfigWithTranscientDir();
|
|
64
|
-
setConfigByRunOptions(config,
|
|
65
|
-
config.externalCookiesFile =
|
|
66
|
-
config.scenario =
|
|
85
|
+
setConfigByRunOptions(config, runOptions);
|
|
86
|
+
config.externalCookiesFile = runOptions.cookiesFile;
|
|
87
|
+
config.scenario = runOptions.scenario;
|
|
67
88
|
const testPlanner = new e2e_1.TestPlanner({ config });
|
|
68
|
-
const { evalInBrowserAfterInitLoad } =
|
|
89
|
+
const { evalInBrowserAfterInitLoad } = runOptions;
|
|
69
90
|
yield warmup({ testPlanner, config, evalInBrowserAfterInitLoad });
|
|
70
91
|
yield testInBrowser({ testPlanner, config, evalInBrowserAfterInitLoad });
|
|
71
92
|
const runResult = BrowserInteractionResultReader_1.default.from(config.workDir);
|
|
@@ -79,6 +100,17 @@ exports.run = run;
|
|
|
79
100
|
*
|
|
80
101
|
* @param options configure browser interaction run
|
|
81
102
|
* @returns browser interaction results
|
|
103
|
+
* * **Examples**:
|
|
104
|
+
* ```javascript
|
|
105
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
106
|
+
*
|
|
107
|
+
* (async function () {
|
|
108
|
+
* const scenario = {
|
|
109
|
+
* url: () => 'https://www.facebook.com',
|
|
110
|
+
* };
|
|
111
|
+
* const result = await takeSnapshots({scenario});
|
|
112
|
+
* })();
|
|
113
|
+
* ```
|
|
82
114
|
*/
|
|
83
115
|
function takeSnapshots(options = {}) {
|
|
84
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -98,8 +130,19 @@ exports.takeSnapshots = takeSnapshots;
|
|
|
98
130
|
* This is equivalent to `memlab find-leaks` in CLI.
|
|
99
131
|
*
|
|
100
132
|
* @param runResult return value of a browser interaction run
|
|
101
|
-
* @returns
|
|
102
|
-
*
|
|
133
|
+
* @returns leak traces detected and clustered from the browser interaction
|
|
134
|
+
* * **Examples**:
|
|
135
|
+
* ```javascript
|
|
136
|
+
* const {findLeaks, takeSnapshots} = require('@memlab/api');
|
|
137
|
+
*
|
|
138
|
+
* (async function () {
|
|
139
|
+
* const scenario = {
|
|
140
|
+
* url: () => 'https://www.facebook.com',
|
|
141
|
+
* };
|
|
142
|
+
* const result = await takeSnapshots({scenario});
|
|
143
|
+
* const leaks = findLeaks(result);
|
|
144
|
+
* })();
|
|
145
|
+
* ```
|
|
103
146
|
*/
|
|
104
147
|
function findLeaks(runResult) {
|
|
105
148
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -117,7 +160,22 @@ exports.findLeaks = findLeaks;
|
|
|
117
160
|
* @param runResult return value of a browser interaction run
|
|
118
161
|
* @param heapAnalyzer instance of a heap analysis
|
|
119
162
|
* @param args other CLI arguments that needs to be passed to the heap analysis
|
|
120
|
-
* @returns
|
|
163
|
+
* @returns each analysis may have a different return type, please check out
|
|
164
|
+
* the type definition or the documentation for the `process` method of the
|
|
165
|
+
* analysis class you are using for `heapAnalyzer`.
|
|
166
|
+
* * **Examples**:
|
|
167
|
+
* ```javascript
|
|
168
|
+
* const {takeSnapshots, StringAnalysis} = require('@memlab/api');
|
|
169
|
+
*
|
|
170
|
+
* (async function () {
|
|
171
|
+
* const scenario = {
|
|
172
|
+
* url: () => 'https://www.facebook.com',
|
|
173
|
+
* };
|
|
174
|
+
* const result = await takeSnapshots({scenario});
|
|
175
|
+
* const analysis = new StringAnalysis();
|
|
176
|
+
* await analyze(result, analysis);
|
|
177
|
+
* })();
|
|
178
|
+
* ```
|
|
121
179
|
*/
|
|
122
180
|
function analyze(runResult, heapAnalyzer, args = { _: [] }) {
|
|
123
181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -128,9 +186,9 @@ function analyze(runResult, heapAnalyzer, args = { _: [] }) {
|
|
|
128
186
|
}
|
|
129
187
|
exports.analyze = analyze;
|
|
130
188
|
/**
|
|
131
|
-
* @ignore
|
|
132
189
|
* This warms up web server by sending web requests to the web sever.
|
|
133
190
|
* This is equivalent to run `memlab warmup` in CLI.
|
|
191
|
+
* @internal
|
|
134
192
|
*
|
|
135
193
|
* @param options configure browser interaction run
|
|
136
194
|
*/
|
|
@@ -221,7 +279,8 @@ function initBrowserInfoInConfig(browser, options = {}) {
|
|
|
221
279
|
});
|
|
222
280
|
}
|
|
223
281
|
/**
|
|
224
|
-
*
|
|
282
|
+
* Browser interaction API used by MemLab API and MemLab CLI
|
|
283
|
+
* @internal
|
|
225
284
|
*/
|
|
226
285
|
function testInBrowser(options = {}) {
|
|
227
286
|
var _a, _b;
|
|
@@ -18,13 +18,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
22
21
|
const index_1 = require("../../index");
|
|
23
22
|
const E2ETestSettings_1 = require("./lib/E2ETestSettings");
|
|
24
23
|
beforeEach(E2ETestSettings_1.testSetup);
|
|
25
24
|
function injectDetachedDOMElements() {
|
|
26
25
|
// @ts-ignore
|
|
27
26
|
window.injectHookForLink4 = () => {
|
|
27
|
+
class TestObject {
|
|
28
|
+
}
|
|
28
29
|
const arr = [];
|
|
29
30
|
for (let i = 0; i < 23; ++i) {
|
|
30
31
|
arr.push(document.createElement('div'));
|
|
@@ -35,6 +36,8 @@ function injectDetachedDOMElements() {
|
|
|
35
36
|
window._path_1 = { x: { y: document.createElement('div') } };
|
|
36
37
|
// @ts-ignore
|
|
37
38
|
window._path_2 = new Set([document.createElement('div')]);
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
window._randomObject = [new TestObject()];
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
43
|
test('leak detector can find detached DOM elements', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -49,3 +52,21 @@ test('leak detector can find detached DOM elements', () => __awaiter(void 0, voi
|
|
|
49
52
|
expect(leaks.some(leak => JSON.stringify(leak).includes('_path_1')));
|
|
50
53
|
expect(leaks.some(leak => JSON.stringify(leak).includes('_path_2')));
|
|
51
54
|
}), E2ETestSettings_1.testTimeout);
|
|
55
|
+
test('self-defined leak detector can find TestObject', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
const selfDefinedScenario = {
|
|
57
|
+
app: () => 'test-spa',
|
|
58
|
+
url: () => '',
|
|
59
|
+
action: (page) => __awaiter(void 0, void 0, void 0, function* () { return yield page.click('[data-testid="link-4"]'); }),
|
|
60
|
+
leakFilter: (node) => {
|
|
61
|
+
return node.name === 'TestObject' && node.type === 'object';
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
const leaks = yield (0, index_1.run)({
|
|
65
|
+
scenario: selfDefinedScenario,
|
|
66
|
+
evalInBrowserAfterInitLoad: injectDetachedDOMElements,
|
|
67
|
+
});
|
|
68
|
+
// detected all different leak trace cluster
|
|
69
|
+
expect(leaks.length).toBe(1);
|
|
70
|
+
// expect all traces are found
|
|
71
|
+
expect(leaks.some(leak => JSON.stringify(leak).includes('_randomObject')));
|
|
72
|
+
}), E2ETestSettings_1.testTimeout);
|
|
@@ -47,12 +47,14 @@ test('Shape unbound analysis works as expected', () => __awaiter(void 0, void 0,
|
|
|
47
47
|
});
|
|
48
48
|
// test analysis from auto loading
|
|
49
49
|
let analysis = new index_1.ShapeUnboundGrowthAnalysis();
|
|
50
|
-
|
|
50
|
+
yield analysis.run();
|
|
51
|
+
let shapeSummary = analysis.getShapesWithUnboundGrowth();
|
|
51
52
|
expect(shapeSummary.reduce((acc, summary) => acc || summary.shape.includes('LeakObject'), false)).toBe(true);
|
|
52
53
|
// test analysis from file
|
|
53
54
|
const snapshotDir = result.getSnapshotFileDir();
|
|
54
55
|
analysis = new index_1.ShapeUnboundGrowthAnalysis();
|
|
55
|
-
|
|
56
|
+
yield analysis.analyzeSnapshotsInDirectory(snapshotDir);
|
|
57
|
+
shapeSummary = analysis.getShapesWithUnboundGrowth();
|
|
56
58
|
expect(shapeSummary.some((summary) => summary.shape.includes('LeakObject'))).toBe(true);
|
|
57
59
|
// expect incorrect use of heap analysis to throw
|
|
58
60
|
const snapshotFile = result.getSnapshotFiles().pop();
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
* @emails oncall+ws_labs
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=heap-analysis.test.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @emails oncall+ws_labs
|
|
9
|
+
* @format
|
|
10
|
+
*/
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
const heap_analysis_1 = require("@memlab/heap-analysis");
|
|
22
|
+
const index_1 = require("../../index");
|
|
23
|
+
const E2ETestSettings_1 = require("../API/lib/E2ETestSettings");
|
|
24
|
+
const API_1 = require("../../API");
|
|
25
|
+
beforeEach(E2ETestSettings_1.testSetup);
|
|
26
|
+
function injectTestObject() {
|
|
27
|
+
class TestObject {
|
|
28
|
+
}
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
window.injectHookForLink4 = () => {
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
const arr = (window.__injectedValue = window.__injectedValue || []);
|
|
33
|
+
arr.push(new TestObject());
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const selfDefinedScenario = {
|
|
37
|
+
app: () => 'test-spa',
|
|
38
|
+
url: () => '',
|
|
39
|
+
action: (page) => __awaiter(void 0, void 0, void 0, function* () { return yield page.click('[data-testid="link-4"]'); }),
|
|
40
|
+
repeat: () => 3,
|
|
41
|
+
};
|
|
42
|
+
class ExampleAnalysis extends heap_analysis_1.BaseAnalysis {
|
|
43
|
+
constructor() {
|
|
44
|
+
super(...arguments);
|
|
45
|
+
this.isMonotonicIncreasing = false;
|
|
46
|
+
}
|
|
47
|
+
getCommandName() {
|
|
48
|
+
return 'example-analysis';
|
|
49
|
+
}
|
|
50
|
+
getDescription() {
|
|
51
|
+
return 'an example analysis for demo';
|
|
52
|
+
}
|
|
53
|
+
process(options) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
// check if the number of TestObject keeps growing overtime
|
|
56
|
+
this.isMonotonicIncreasing = yield (0, heap_analysis_1.snapshotMapReduce)(heap => {
|
|
57
|
+
let cnt = 0;
|
|
58
|
+
heap.nodes.forEach(node => {
|
|
59
|
+
if (node.name === 'TestObject' && node.type === 'object') {
|
|
60
|
+
++cnt;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return cnt;
|
|
64
|
+
}, nodeCounts => nodeCounts[0] === 0 &&
|
|
65
|
+
nodeCounts[nodeCounts.length - 1] === 4 &&
|
|
66
|
+
nodeCounts.every((count, i) => i === 0 || count >= nodeCounts[i - 1]), options);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
test('snapshotMapReduce works as expected', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
const results = yield (0, API_1.takeSnapshots)({
|
|
72
|
+
scenario: selfDefinedScenario,
|
|
73
|
+
evalInBrowserAfterInitLoad: injectTestObject,
|
|
74
|
+
snapshotForEachStep: true,
|
|
75
|
+
});
|
|
76
|
+
let analysis = new ExampleAnalysis();
|
|
77
|
+
yield (0, index_1.analyze)(results, analysis);
|
|
78
|
+
expect(analysis.isMonotonicIncreasing).toBe(true);
|
|
79
|
+
analysis = new ExampleAnalysis();
|
|
80
|
+
yield analysis.analyzeSnapshotsInDirectory(results.getSnapshotFileDir());
|
|
81
|
+
expect(analysis.isMonotonicIncreasing).toBe(true);
|
|
82
|
+
}), E2ETestSettings_1.testTimeout);
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export * from './API';
|
|
11
11
|
export * from '@memlab/heap-analysis';
|
|
12
|
-
export { config } from '@memlab/core';
|
|
13
12
|
export { default as BrowserInteractionResultReader } from './result-reader/BrowserInteractionResultReader';
|
|
13
|
+
export { dumpNodeHeapSnapshot, getCurrentNodeHeap } from '@memlab/core';
|
|
14
|
+
/** @internal */
|
|
15
|
+
export { config } from '@memlab/core';
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -26,10 +26,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.config = exports.getCurrentNodeHeap = exports.dumpNodeHeapSnapshot = exports.BrowserInteractionResultReader = void 0;
|
|
30
30
|
__exportStar(require("./API"), exports);
|
|
31
31
|
__exportStar(require("@memlab/heap-analysis"), exports);
|
|
32
|
-
var core_1 = require("@memlab/core");
|
|
33
|
-
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return core_1.config; } });
|
|
34
32
|
var BrowserInteractionResultReader_1 = require("./result-reader/BrowserInteractionResultReader");
|
|
35
33
|
Object.defineProperty(exports, "BrowserInteractionResultReader", { enumerable: true, get: function () { return __importDefault(BrowserInteractionResultReader_1).default; } });
|
|
34
|
+
var core_1 = require("@memlab/core");
|
|
35
|
+
Object.defineProperty(exports, "dumpNodeHeapSnapshot", { enumerable: true, get: function () { return core_1.dumpNodeHeapSnapshot; } });
|
|
36
|
+
Object.defineProperty(exports, "getCurrentNodeHeap", { enumerable: true, get: function () { return core_1.getCurrentNodeHeap; } });
|
|
37
|
+
/** @internal */
|
|
38
|
+
var core_2 = require("@memlab/core");
|
|
39
|
+
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return core_2.config; } });
|
|
@@ -14,11 +14,8 @@ import { FileManager } from '@memlab/core';
|
|
|
14
14
|
* a memlab run
|
|
15
15
|
*/
|
|
16
16
|
export default class BaseResultReader {
|
|
17
|
-
/** @ignore */
|
|
18
17
|
protected workDir: string;
|
|
19
|
-
/** @ignore */
|
|
20
18
|
protected fileManager: FileManager;
|
|
21
|
-
/** @ignore */
|
|
22
19
|
private isValid;
|
|
23
20
|
/**
|
|
24
21
|
* build a result reader
|
|
@@ -26,23 +23,47 @@ export default class BaseResultReader {
|
|
|
26
23
|
* and generated files of the memlab run were stored
|
|
27
24
|
*/
|
|
28
25
|
protected constructor(workDir?: string);
|
|
29
|
-
/** @ignore */
|
|
30
26
|
protected check(): void;
|
|
31
27
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @param workDir
|
|
34
|
-
*
|
|
35
|
-
* @returns the ResultReader instance
|
|
28
|
+
* internal
|
|
29
|
+
* @param workDir
|
|
30
|
+
* @returns
|
|
36
31
|
*/
|
|
37
32
|
static from(workDir?: string): BaseResultReader;
|
|
38
33
|
/**
|
|
39
34
|
* get the directory where the data and generated files of
|
|
40
35
|
* the memlab run were stored
|
|
41
36
|
* @returns absolute path of the directory
|
|
37
|
+
* * **Examples**:
|
|
38
|
+
* ```javascript
|
|
39
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
40
|
+
*
|
|
41
|
+
* (async function () {
|
|
42
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
43
|
+
* const result = await takeSnapshots({scenario});
|
|
44
|
+
*
|
|
45
|
+
* // get the directory that stores all the files
|
|
46
|
+
* // generated from the takeSnapshots call
|
|
47
|
+
* const dataDir = result.getRootDirectory();
|
|
48
|
+
* })();
|
|
49
|
+
* ```
|
|
42
50
|
*/
|
|
43
51
|
getRootDirectory(): string;
|
|
44
52
|
/**
|
|
45
|
-
* clean up data/files generated from the memlab run
|
|
53
|
+
* clean up data/files generated from the memlab browser interaction run
|
|
54
|
+
* @returns no return value
|
|
55
|
+
* * **Examples**:
|
|
56
|
+
* ```javascript
|
|
57
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
58
|
+
*
|
|
59
|
+
* (async function () {
|
|
60
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
61
|
+
* const result = await takeSnapshots({scenario});
|
|
62
|
+
*
|
|
63
|
+
* // delete all data/files generated by takeSnapshots
|
|
64
|
+
* result.cleanup();
|
|
65
|
+
* })();
|
|
66
|
+
* ```
|
|
46
67
|
*/
|
|
47
68
|
cleanup(): void;
|
|
48
69
|
}
|
|
@@ -33,7 +33,6 @@ class BaseResultReader {
|
|
|
33
33
|
this.workDir = workDir;
|
|
34
34
|
this.check();
|
|
35
35
|
}
|
|
36
|
-
/** @ignore */
|
|
37
36
|
check() {
|
|
38
37
|
this.isValid = fs_extra_1.default.existsSync(this.workDir);
|
|
39
38
|
if (!this.isValid) {
|
|
@@ -41,10 +40,9 @@ class BaseResultReader {
|
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
/**
|
|
44
|
-
*
|
|
45
|
-
* @param workDir
|
|
46
|
-
*
|
|
47
|
-
* @returns the ResultReader instance
|
|
43
|
+
* internal
|
|
44
|
+
* @param workDir
|
|
45
|
+
* @returns
|
|
48
46
|
*/
|
|
49
47
|
static from(workDir = '') {
|
|
50
48
|
return new BaseResultReader(workDir);
|
|
@@ -53,13 +51,39 @@ class BaseResultReader {
|
|
|
53
51
|
* get the directory where the data and generated files of
|
|
54
52
|
* the memlab run were stored
|
|
55
53
|
* @returns absolute path of the directory
|
|
54
|
+
* * **Examples**:
|
|
55
|
+
* ```javascript
|
|
56
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
57
|
+
*
|
|
58
|
+
* (async function () {
|
|
59
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
60
|
+
* const result = await takeSnapshots({scenario});
|
|
61
|
+
*
|
|
62
|
+
* // get the directory that stores all the files
|
|
63
|
+
* // generated from the takeSnapshots call
|
|
64
|
+
* const dataDir = result.getRootDirectory();
|
|
65
|
+
* })();
|
|
66
|
+
* ```
|
|
56
67
|
*/
|
|
57
68
|
getRootDirectory() {
|
|
58
69
|
this.check();
|
|
59
70
|
return this.workDir;
|
|
60
71
|
}
|
|
61
72
|
/**
|
|
62
|
-
* clean up data/files generated from the memlab run
|
|
73
|
+
* clean up data/files generated from the memlab browser interaction run
|
|
74
|
+
* @returns no return value
|
|
75
|
+
* * **Examples**:
|
|
76
|
+
* ```javascript
|
|
77
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
78
|
+
*
|
|
79
|
+
* (async function () {
|
|
80
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
81
|
+
* const result = await takeSnapshots({scenario});
|
|
82
|
+
*
|
|
83
|
+
* // delete all data/files generated by takeSnapshots
|
|
84
|
+
* result.cleanup();
|
|
85
|
+
* })();
|
|
86
|
+
* ```
|
|
63
87
|
*/
|
|
64
88
|
cleanup() {
|
|
65
89
|
if (!this.isValid) {
|
|
@@ -16,30 +16,89 @@ import BaseResultReader from './BaseResultReader';
|
|
|
16
16
|
*/
|
|
17
17
|
export default class BrowserInteractionResultReader extends BaseResultReader {
|
|
18
18
|
/**
|
|
19
|
-
* build a result reader
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* build a result reader from a data directory where the data
|
|
20
|
+
* and generated files of a memlab run were stored
|
|
21
|
+
* @param workDir absolute path of the data directory
|
|
22
22
|
* @returns the ResultReader instance
|
|
23
|
+
*
|
|
24
|
+
* * **Examples**:
|
|
25
|
+
* ```javascript
|
|
26
|
+
* const {BrowserInteractionResultReader} = require('@memlab/api');
|
|
27
|
+
*
|
|
28
|
+
* const dataDir = '/tmp/memlab'; // where the last memlab run stores results
|
|
29
|
+
* const reader = BrowserInteractionResultReader.from(dataDir);
|
|
30
|
+
* reader.cleanup(); // clean up the results
|
|
31
|
+
* ```
|
|
23
32
|
*/
|
|
24
33
|
static from(workDir?: string): BrowserInteractionResultReader;
|
|
25
34
|
/**
|
|
26
|
-
* get all snapshot files
|
|
35
|
+
* get all snapshot files generated from last memlab browser interaction
|
|
27
36
|
* @returns an array of snapshot file's absolute path
|
|
37
|
+
* * **Examples**:
|
|
38
|
+
* ```javascript
|
|
39
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
40
|
+
*
|
|
41
|
+
* (async function () {
|
|
42
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
43
|
+
* const result = await takeSnapshots({scenario});
|
|
44
|
+
*
|
|
45
|
+
* // get absolute paths of all snapshot files
|
|
46
|
+
* const files = result.getSnapshotFiles();
|
|
47
|
+
* })();
|
|
48
|
+
* ```
|
|
28
49
|
*/
|
|
29
50
|
getSnapshotFiles(): string[];
|
|
30
51
|
/**
|
|
31
52
|
* get the directory holding all snapshot files
|
|
32
53
|
* @returns the absolute path of the directory
|
|
54
|
+
* * **Examples**:
|
|
55
|
+
* ```javascript
|
|
56
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
57
|
+
*
|
|
58
|
+
* (async function () {
|
|
59
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
60
|
+
* const result = await takeSnapshots({scenario});
|
|
61
|
+
*
|
|
62
|
+
* // get the absolute path the directory holding all snapshot files
|
|
63
|
+
* const files = result.getSnapshotFileDir();
|
|
64
|
+
* })();
|
|
65
|
+
* ```
|
|
33
66
|
*/
|
|
34
67
|
getSnapshotFileDir(): string;
|
|
35
68
|
/**
|
|
36
69
|
* browser interaction step sequence
|
|
37
|
-
* @returns an array of browser interaction step
|
|
70
|
+
* @returns an array of browser interaction step information
|
|
71
|
+
* * **Examples**:
|
|
72
|
+
* ```javascript
|
|
73
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
74
|
+
*
|
|
75
|
+
* (async function () {
|
|
76
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
77
|
+
* const result = await takeSnapshots({scenario});
|
|
78
|
+
*
|
|
79
|
+
* const steps = result.getInteractionSteps();
|
|
80
|
+
* // print each browser interaction's name and JavaScript heap size (in bytes)
|
|
81
|
+
* steps.forEach(step => console.log(step.name, step.JSHeapUsedSize))
|
|
82
|
+
* })();
|
|
83
|
+
* ```
|
|
38
84
|
*/
|
|
39
85
|
getInteractionSteps(): E2EStepInfo[];
|
|
40
86
|
/**
|
|
41
87
|
* general meta data of the browser interaction run
|
|
42
88
|
* @returns meta data about the entire browser interaction
|
|
89
|
+
* * **Examples**:
|
|
90
|
+
* ```javascript
|
|
91
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
92
|
+
*
|
|
93
|
+
* (async function () {
|
|
94
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
95
|
+
* const result = await takeSnapshots({scenario});
|
|
96
|
+
*
|
|
97
|
+
* const metaInfo = result.getRunMetaInfo();
|
|
98
|
+
* // print all browser web console output
|
|
99
|
+
* console.log(metaInfo.browserInfo._consoleMessages.join('\n'));
|
|
100
|
+
* })();
|
|
101
|
+
* ```
|
|
43
102
|
*/
|
|
44
103
|
getRunMetaInfo(): RunMetaInfo;
|
|
45
104
|
}
|
|
@@ -23,17 +23,38 @@ const BaseResultReader_1 = __importDefault(require("./BaseResultReader"));
|
|
|
23
23
|
*/
|
|
24
24
|
class BrowserInteractionResultReader extends BaseResultReader_1.default {
|
|
25
25
|
/**
|
|
26
|
-
* build a result reader
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* build a result reader from a data directory where the data
|
|
27
|
+
* and generated files of a memlab run were stored
|
|
28
|
+
* @param workDir absolute path of the data directory
|
|
29
29
|
* @returns the ResultReader instance
|
|
30
|
+
*
|
|
31
|
+
* * **Examples**:
|
|
32
|
+
* ```javascript
|
|
33
|
+
* const {BrowserInteractionResultReader} = require('@memlab/api');
|
|
34
|
+
*
|
|
35
|
+
* const dataDir = '/tmp/memlab'; // where the last memlab run stores results
|
|
36
|
+
* const reader = BrowserInteractionResultReader.from(dataDir);
|
|
37
|
+
* reader.cleanup(); // clean up the results
|
|
38
|
+
* ```
|
|
30
39
|
*/
|
|
31
40
|
static from(workDir = '') {
|
|
32
41
|
return new BrowserInteractionResultReader(workDir);
|
|
33
42
|
}
|
|
34
43
|
/**
|
|
35
|
-
* get all snapshot files
|
|
44
|
+
* get all snapshot files generated from last memlab browser interaction
|
|
36
45
|
* @returns an array of snapshot file's absolute path
|
|
46
|
+
* * **Examples**:
|
|
47
|
+
* ```javascript
|
|
48
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
49
|
+
*
|
|
50
|
+
* (async function () {
|
|
51
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
52
|
+
* const result = await takeSnapshots({scenario});
|
|
53
|
+
*
|
|
54
|
+
* // get absolute paths of all snapshot files
|
|
55
|
+
* const files = result.getSnapshotFiles();
|
|
56
|
+
* })();
|
|
57
|
+
* ```
|
|
37
58
|
*/
|
|
38
59
|
getSnapshotFiles() {
|
|
39
60
|
this.check();
|
|
@@ -46,6 +67,18 @@ class BrowserInteractionResultReader extends BaseResultReader_1.default {
|
|
|
46
67
|
/**
|
|
47
68
|
* get the directory holding all snapshot files
|
|
48
69
|
* @returns the absolute path of the directory
|
|
70
|
+
* * **Examples**:
|
|
71
|
+
* ```javascript
|
|
72
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
73
|
+
*
|
|
74
|
+
* (async function () {
|
|
75
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
76
|
+
* const result = await takeSnapshots({scenario});
|
|
77
|
+
*
|
|
78
|
+
* // get the absolute path the directory holding all snapshot files
|
|
79
|
+
* const files = result.getSnapshotFileDir();
|
|
80
|
+
* })();
|
|
81
|
+
* ```
|
|
49
82
|
*/
|
|
50
83
|
getSnapshotFileDir() {
|
|
51
84
|
this.check();
|
|
@@ -53,7 +86,20 @@ class BrowserInteractionResultReader extends BaseResultReader_1.default {
|
|
|
53
86
|
}
|
|
54
87
|
/**
|
|
55
88
|
* browser interaction step sequence
|
|
56
|
-
* @returns an array of browser interaction step
|
|
89
|
+
* @returns an array of browser interaction step information
|
|
90
|
+
* * **Examples**:
|
|
91
|
+
* ```javascript
|
|
92
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
93
|
+
*
|
|
94
|
+
* (async function () {
|
|
95
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
96
|
+
* const result = await takeSnapshots({scenario});
|
|
97
|
+
*
|
|
98
|
+
* const steps = result.getInteractionSteps();
|
|
99
|
+
* // print each browser interaction's name and JavaScript heap size (in bytes)
|
|
100
|
+
* steps.forEach(step => console.log(step.name, step.JSHeapUsedSize))
|
|
101
|
+
* })();
|
|
102
|
+
* ```
|
|
57
103
|
*/
|
|
58
104
|
getInteractionSteps() {
|
|
59
105
|
this.check();
|
|
@@ -65,6 +111,19 @@ class BrowserInteractionResultReader extends BaseResultReader_1.default {
|
|
|
65
111
|
/**
|
|
66
112
|
* general meta data of the browser interaction run
|
|
67
113
|
* @returns meta data about the entire browser interaction
|
|
114
|
+
* * **Examples**:
|
|
115
|
+
* ```javascript
|
|
116
|
+
* const {takeSnapshots} = require('@memlab/api');
|
|
117
|
+
*
|
|
118
|
+
* (async function () {
|
|
119
|
+
* const scenario = { url: () => 'https://www.npmjs.com'};
|
|
120
|
+
* const result = await takeSnapshots({scenario});
|
|
121
|
+
*
|
|
122
|
+
* const metaInfo = result.getRunMetaInfo();
|
|
123
|
+
* // print all browser web console output
|
|
124
|
+
* console.log(metaInfo.browserInfo._consoleMessages.join('\n'));
|
|
125
|
+
* })();
|
|
126
|
+
* ```
|
|
68
127
|
*/
|
|
69
128
|
getRunMetaInfo() {
|
|
70
129
|
this.check();
|
package/package.json
CHANGED
package/dist/API.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,WAAW,EACX,QAAQ,EACR,eAAe,EACf,SAAS,EAGV,MAAM,cAAc,CAAC;AAEtB,OAAO,EAML,YAAY,EAEb,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,WAAW,EAGZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAEnD,OAAO,8BAA8B,MAAM,gDAAgD,CAAC;AAE5F;;GAEG;AACH,oBAAY,UAAU,GAAG;IACvB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,0BAA0B,CAAC,EAAE,WAAW,CAAC;IACzC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF;;;GAGG;AACH,oBAAY,UAAU,GAAG;IAGvB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,0BAA0B,CAAC,EAAE,WAAW,CAAC;CAC1C,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,8BAA8B,CAAC,CAUzC;AAED;;;;;;;;;GASG;AACH,wBAAsB,GAAG,CACvB,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,eAAe,EAAE,CAAC,CAW5B;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,8BAA8B,CAAC,CASzC;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,8BAA8B,GACxC,OAAO,CAAC,eAAe,EAAE,CAAC,CAK5B;AAED;;;;;;;;GAQG;AACH,wBAAsB,OAAO,CAC3B,SAAS,EAAE,8BAA8B,EACzC,YAAY,EAAE,YAAY,EAC1B,IAAI,GAAE,UAAoB,GACzB,OAAO,CAAC,QAAQ,CAAC,CAInB;AAED;;;;;;GAMG;AACH,wBAAsB,MAAM,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAuCpE;AAsDD;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAkD3E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2EBasicAnalysis.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/API/E2EBasicAnalysis.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2EDetachedDOMAnalysis.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/API/E2EDetachedDOMAnalysis.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2EDuplicateObjectAnalysis.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/API/E2EDuplicateObjectAnalysis.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2EFindLeaks.example.d.ts","sourceRoot":"","sources":["../../../src/__tests__/API/E2EFindLeaks.example.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2EFindMemoryLeaks.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/API/E2EFindMemoryLeaks.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2EResultReader.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/API/E2EResultReader.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2ERunMultipleSnapshots.example.d.ts","sourceRoot":"","sources":["../../../src/__tests__/API/E2ERunMultipleSnapshots.example.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2ERunSingleSnapshot.example.d.ts","sourceRoot":"","sources":["../../../src/__tests__/API/E2ERunSingleSnapshot.example.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2EShapeUnboundGrowthAnalysis.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/API/E2EShapeUnboundGrowthAnalysis.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2EStringAnalysis.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/API/E2EStringAnalysis.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2ETestSettings.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/API/lib/E2ETestSettings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,WAAW,QAAgB,CAAC;AAEzC,eAAO,MAAM,mBAAmB;;;;CAAkB,CAAC;AAEnD,eAAO,MAAM,QAAQ;eACV,MAAM;eACN,MAAM;mBACM,IAAI,KAAG,QAAQ,IAAI,CAAC;CAE1C,CAAC;AAEF,eAAO,MAAM,SAAS,QAAO,IAK5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"E2EHeapParser.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/heap/E2EHeapParser.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAA2B,MAAM,cAAc,CAAC;AAOrE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,QAAQ,EAAE,QAAQ,CAAC;KACpB;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HeapParserTestUtils.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/heap/lib/HeapParserTestUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAUhD,wBAAsB,kBAAkB,CACtC,YAAY,EAAE,MAAM,IAAI,EACxB,eAAe,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,OAAO,GACpD,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,OAAO,IAAI,8BAA8B,EAAC,MAAM,gDAAgD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"APIUtils.d.ts","sourceRoot":"","sources":["../../src/lib/APIUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAU/C,iBAAe,UAAU,CACvB,OAAO,GAAE;IAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAM,GACtD,OAAO,CAAC,OAAO,CAAC,CAmBlB;;;;AAED,wBAEE"}
|
|
@@ -1 +0,0 @@
|
|
|
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,cAAc;IACd,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,cAAc;IACd,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,cAAc;IACd,OAAO,CAAC,OAAO,CAAU;IAEzB;;;;OAIG;IACH,SAAS,aAAa,OAAO,SAAK;IASlC,cAAc;IACd,SAAS,CAAC,KAAK,IAAI,IAAI;IAOvB;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,SAAK,GAAG,gBAAgB;IAI3C;;;;OAIG;IACI,gBAAgB,IAAI,MAAM;IAKjC;;OAEG;IACI,OAAO,IAAI,IAAI;CAOvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserInteractionResultReader.d.ts","sourceRoot":"","sources":["../../src/result-reader/BrowserInteractionResultReader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAK3D,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,8BAA+B,SAAQ,gBAAgB;IAC1E;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,SAAK,GAAG,8BAA8B;IAIzD;;;OAGG;IACI,gBAAgB,IAAI,MAAM,EAAE;IASnC;;;OAGG;IACI,kBAAkB,IAAI,MAAM;IAKnC;;;OAGG;IACI,mBAAmB,IAAI,WAAW,EAAE;IAQ3C;;;OAGG;IACI,cAAc,IAAI,WAAW;CAOrC"}
|