@memlab/core 1.1.10 → 1.1.11
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/lib/NodeHeap.js +1 -1
- package/dist/lib/Types.d.ts +32 -1
- package/package.json +1 -1
package/dist/lib/NodeHeap.js
CHANGED
|
@@ -93,7 +93,7 @@ exports.tagObject = tagObject;
|
|
|
93
93
|
* ```
|
|
94
94
|
*/
|
|
95
95
|
function dumpNodeHeapSnapshot() {
|
|
96
|
-
const randomID =
|
|
96
|
+
const randomID = `${Math.random()}`.replace('0.', '');
|
|
97
97
|
const file = path_1.default.join(FileManager_1.default.generateTmpHeapDir(), `nodejs-${randomID}.heapsnapshot`);
|
|
98
98
|
if (fs_extra_1.default.existsSync(file)) {
|
|
99
99
|
fs_extra_1.default.removeSync(file);
|
package/dist/lib/Types.d.ts
CHANGED
|
@@ -431,6 +431,35 @@ export interface IScenario {
|
|
|
431
431
|
* for memory leak filtering.
|
|
432
432
|
*/
|
|
433
433
|
url: () => string;
|
|
434
|
+
/**
|
|
435
|
+
* `setup` is the callback function that will be called only once
|
|
436
|
+
* after the initial page load. This callback can be used to log in
|
|
437
|
+
* if you have to (we recommend using {@link cookies})
|
|
438
|
+
* or to prepare data before the {@link action} call.
|
|
439
|
+
*
|
|
440
|
+
* * **Parameters**:
|
|
441
|
+
* * page: `Page` | the puppeteer [`Page`](https://pptr.dev/api/puppeteer.page)
|
|
442
|
+
* object, which provides APIs to interact with the web browser
|
|
443
|
+
*
|
|
444
|
+
* * **Examples**:
|
|
445
|
+
* ```typescript
|
|
446
|
+
* const scenario = {
|
|
447
|
+
* url: () => 'https://www.npmjs.com/',
|
|
448
|
+
* setup: async (page) => {
|
|
449
|
+
* // log in or prepare data for the interaction
|
|
450
|
+
* },
|
|
451
|
+
* action: async (page) => {
|
|
452
|
+
* await page.click('a[href="/link"]');
|
|
453
|
+
* },
|
|
454
|
+
* back: async (page) => {
|
|
455
|
+
* await page.click('a[href="/back"]');
|
|
456
|
+
* },
|
|
457
|
+
* }
|
|
458
|
+
*
|
|
459
|
+
* module.exports = scenario;
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
setup?: InteractionsCallback;
|
|
434
463
|
/**
|
|
435
464
|
* `action` is the callback function that defines the interaction
|
|
436
465
|
* where you want to trigger memory leaks after the initial page load.
|
|
@@ -473,7 +502,7 @@ export interface IScenario {
|
|
|
473
502
|
* }
|
|
474
503
|
*
|
|
475
504
|
* module.exports = scenario;
|
|
476
|
-
```
|
|
505
|
+
* ```
|
|
477
506
|
*/
|
|
478
507
|
action?: InteractionsCallback;
|
|
479
508
|
/**
|
|
@@ -728,10 +757,12 @@ export interface IE2EScenarioVisitPlan {
|
|
|
728
757
|
numOfWarmup: number;
|
|
729
758
|
dataBuilder: Optional<IDataBuilder>;
|
|
730
759
|
isPageLoaded?: CheckPageLoadCallback;
|
|
760
|
+
scenario?: IScenario;
|
|
731
761
|
}
|
|
732
762
|
/** @internal */
|
|
733
763
|
export declare type OperationArgs = {
|
|
734
764
|
isPageLoaded?: CheckPageLoadCallback;
|
|
765
|
+
scenario?: Optional<IScenario>;
|
|
735
766
|
showProgress?: boolean;
|
|
736
767
|
failedURLs?: AnyRecord;
|
|
737
768
|
pageHistoryLength?: number[];
|