Skip to content

Commit 8a6fdca

Browse files
TG199mark-wiemer
andauthored
docs: migrate to global leak wiki page to docs (#5437)
Co-authored-by: Mark Wiemer <[email protected]>
1 parent 876247a commit 8a6fdca

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

docs-next/astro.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ export default defineConfig({
9494
label: "Detecting multiple calls to done()",
9595
slug: "explainers/detecting-multiple-calls-to-done",
9696
},
97+
{
98+
label: "Find global leaks",
99+
slug: "explainers/find-global-leaks",
100+
},
97101
{
98102
label: "Node.js native ESM support",
99103
slug: "explainers/nodejs-native-esm-support",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description: How to find a global leak.
3+
title: Find global leaks
4+
---
5+
6+
Detecting which module is causing a global leak can be tedious. Add these lines at the very beginning of your tests, or in a file which is included via `--require`:
7+
8+
```javascript
9+
Object.defineProperty(global, 'name_of_leaking_property', {
10+
set: function (value) {
11+
throw new Error('Found the leak!');
12+
}
13+
});
14+
```
15+
16+
This will print a stacktrace that shows which module caused the leak. And if it's not yours--go open a pull request! :)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Detecting which module is causing a global leak can be tedious. Add these lines at the very beginning of your tests, or in a file which is included via `--require`:
2+
3+
```javascript
4+
Object.defineProperty(global, 'name_of_leaking_property', {
5+
set: function (value) {
6+
throw new Error('Found the leak!');
7+
}
8+
});
9+
```
10+
11+
This will print a stacktrace that shows which module caused the leak. And if it's not yours--go open a pull request! :)

docs/api-tutorials/jsdoc.tutorials.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"custom-reporter": {
33
"title": "Create a Custom Reporter"
44
},
5+
"find-global-leaks": {
6+
"title": "Find global leaks"
7+
},
58
"shared-behaviours": {
69
"title": "Shared behaviours"
710
},

0 commit comments

Comments
 (0)