memlab 1.0.0-alpha → 1.0.1-alpha

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 (2) hide show
  1. package/README.md +55 -5
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,11 +1,61 @@
1
- # `memlab`
1
+ # memlab
2
2
 
3
- > TODO: description
3
+ memlab is an E2E testing and analysis framework for finding memory leaks
4
+ in-browser JavaScript Code. The CLI Toolbox and library provide extensible
5
+ interfaces for analyzing heap snapshots taken from Chrome, Node.js, Hermes,
6
+ and Electron.js.
4
7
 
5
- ## Usage
8
+ ## CLI Usage
6
9
 
10
+ Install the CLI
11
+
12
+ ```bash
13
+ npm install -g @memlab
14
+ ```
15
+
16
+ Find memory leaks in Google Maps:
17
+
18
+ ```bash
19
+ wget -q -O test-google-maps.js https://tinyurl.com/4yr5watu
20
+ memlab run --scenario test-google-maps.js
21
+ ```
22
+
23
+ View which object keeps growing in size during interaction in the previous run:
24
+ ```bash
25
+ memlab analyze unbound-object
26
+ ```
27
+
28
+ Analyze pre-fetched v8/hermes `.heapsnapshot` files:
29
+
30
+ ```bash
31
+ memlab analyze unbound-object --snapshot-dir <DIR_OF_SNAPSHOT_FILES>
7
32
  ```
8
- const api = require('memlab');
9
33
 
10
- // TODO: DEMONSTRATE API
34
+ Use `memlab analyze` to view all memory analyses. For extension, view the [doc site](/tba).
35
+
36
+ View retain trace of a particular object:
37
+ ```bash
38
+ memlab report --nodeId <HEAP_OBJECT_ID>
39
+ ```
40
+
41
+ Use `memlab help` to view all CLI commands.
42
+
43
+ ## APIs
44
+
45
+ Use the `memlab` library to start a E2E run in browser and detect memory leaks.
46
+
47
+ ```javascript
48
+ const memlab = require('memlab');
49
+
50
+ const scenario = {
51
+ // initial page load url
52
+ url: () => 'https://www.google.com/maps/@37.386427,-122.0428214,11z',
53
+
54
+ // action where we want to detect memory leaks
55
+ action: async (page) => await page.click('button[aria-label="Hotels"]'),
56
+
57
+ // action where we want to go back to the step before
58
+ back: async (page) => await page.click('[aria-label="Clear search"]'),
59
+ }
60
+ memlab.run({scenario});
11
61
  ```
package/package.json CHANGED
@@ -1,10 +1,6 @@
1
1
  {
2
2
  "name": "memlab",
3
- "version": "1.0.0-alpha",
4
- "repository": {
5
- "type": "git",
6
- "url": "git+https://github.com/facebookincubator/memlab.git"
7
- },
3
+ "version": "1.0.1-alpha",
8
4
  "license": "MIT",
9
5
  "description": "memlab is a framework that analyzes memory and finds memory leaks in JavaScript applications.",
10
6
  "main": "dist/index.js",
@@ -68,6 +64,10 @@
68
64
  "./packages/api",
69
65
  "./packages/cli"
70
66
  ],
67
+ "repository": {
68
+ "type": "git",
69
+ "url": "git+https://github.com/facebookincubator/memlab.git"
70
+ },
71
71
  "bugs": {
72
72
  "url": "https://github.com/facebookincubator/memlab/issues"
73
73
  },