@memlab/api 2.0.4 → 2.0.5
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.js
CHANGED
|
@@ -127,7 +127,7 @@ function takeSnapshots() {
|
|
|
127
127
|
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
128
128
|
const config = getConfigFromRunOptions(options);
|
|
129
129
|
const state = APIStateManager_1.default.getAndUpdateState(config, options);
|
|
130
|
-
const testPlanner = new e2e_1.TestPlanner();
|
|
130
|
+
const testPlanner = new e2e_1.TestPlanner({ config });
|
|
131
131
|
const { evalInBrowserAfterInitLoad } = options;
|
|
132
132
|
yield testInBrowser({ testPlanner, config, evalInBrowserAfterInitLoad });
|
|
133
133
|
const ret = BrowserInteractionResultReader_1.default.from(config.workDir);
|
|
@@ -287,9 +287,9 @@ function getConfigFromRunOptions(options) {
|
|
|
287
287
|
if ('webWorker' in options) {
|
|
288
288
|
config.isAnalyzingMainThread = false;
|
|
289
289
|
const value = options.webWorker;
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
// config is a singleton shared by all API calls in the process, so the
|
|
291
|
+
// title has to be cleared when this run targets any web worker
|
|
292
|
+
config.targetWorkerTitle = typeof value === 'string' ? value : null;
|
|
293
293
|
}
|
|
294
294
|
else {
|
|
295
295
|
config.isAnalyzingMainThread = true;
|
|
@@ -53,9 +53,9 @@ function checkResultReader(result) {
|
|
|
53
53
|
expect(runMeta.app).toBe('test-spa');
|
|
54
54
|
result.cleanup();
|
|
55
55
|
expect(fs_1.default.existsSync(workDir)).toBe(false);
|
|
56
|
-
expect(() => result.getRootDirectory()).
|
|
57
|
-
expect(() => result.getSnapshotFileDir()).
|
|
58
|
-
expect(() => result.getSnapshotFiles()).
|
|
56
|
+
expect(() => result.getRootDirectory()).toThrow();
|
|
57
|
+
expect(() => result.getSnapshotFileDir()).toThrow();
|
|
58
|
+
expect(() => result.getSnapshotFiles()).toThrow();
|
|
59
59
|
}
|
|
60
60
|
test('result data/file reader is working as expected', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
61
|
const result = yield (0, index_1.warmupAndTakeSnapshots)({
|
|
@@ -84,7 +84,7 @@ function testIncorrectUseage(result) {
|
|
|
84
84
|
// expect incorrect use of heap analysis to throw
|
|
85
85
|
const snapshotFile = result.getSnapshotFiles().pop();
|
|
86
86
|
const analysis = new index_1.ShapeUnboundGrowthAnalysis();
|
|
87
|
-
expect(() => __awaiter(this, void 0, void 0, function* () { return yield analysis.analyzeSnapshotFromFile(snapshotFile); })).rejects.
|
|
87
|
+
expect(() => __awaiter(this, void 0, void 0, function* () { return yield analysis.analyzeSnapshotFromFile(snapshotFile); })).rejects.toThrow();
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
function testAnalysisWithSpecifiedWorkDir(result) {
|
|
@@ -54,7 +54,7 @@ test('String analysis works as expected', () => __awaiter(void 0, void 0, void 0
|
|
|
54
54
|
// expect incorrect use of heap analysis to throw
|
|
55
55
|
const snapshotDir = result.getSnapshotFileDir();
|
|
56
56
|
analysis = new index_1.StringAnalysis();
|
|
57
|
-
expect(() => __awaiter(void 0, void 0, void 0, function* () { return yield analysis.analyzeSnapshotsInDirectory(snapshotDir); })).rejects.
|
|
57
|
+
expect(() => __awaiter(void 0, void 0, void 0, function* () { return yield analysis.analyzeSnapshotsInDirectory(snapshotDir); })).rejects.toThrow();
|
|
58
58
|
}), E2ETestSettings_1.testTimeout);
|
|
59
59
|
test('analyze function works as expected', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
60
|
const result = yield (0, index_1.warmupAndTakeSnapshots)({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memlab/api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "memlab API",
|
|
6
6
|
"author": "Liang Gong <lgong@meta.com>",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@memlab/core": "^2.0.
|
|
31
|
-
"@memlab/e2e": "^2.0.
|
|
32
|
-
"@memlab/heap-analysis": "^2.0.
|
|
30
|
+
"@memlab/core": "^2.0.5",
|
|
31
|
+
"@memlab/e2e": "^2.0.5",
|
|
32
|
+
"@memlab/heap-analysis": "^2.0.5",
|
|
33
33
|
"ansi": "^0.3.1",
|
|
34
34
|
"babar": "^0.2.0",
|
|
35
35
|
"chalk": "^4.0.0",
|