Skip to content

Commit 9a3bfc1

Browse files
committed
add leak test scaffolding
1 parent 9d56906 commit 9a3bfc1

File tree

4 files changed

+438
-0
lines changed

4 files changed

+438
-0
lines changed

test/leaks/index.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<html>
2+
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Leak Test Bed</title>
6+
</head>
7+
8+
<body>
9+
<button id="alloc">Alloc</button>
10+
<button id="dealloc">Dealloc</button>
11+
12+
<script src="/static/vs/loader.js"></script>
13+
<script>
14+
require.config({ baseUrl: '/static' });
15+
16+
require(['vs/base/browser/event'], ({ domEvent }) => {
17+
let event;
18+
let listener;
19+
20+
function alloc() {
21+
event = domEvent(document.body, 'mousemove');
22+
listener = event(e => console.log(e));
23+
}
24+
25+
function dealloc() {
26+
listener.dispose();
27+
listener = null;
28+
event = null;
29+
}
30+
31+
const allocBtn = document.getElementById('alloc');
32+
allocBtn.onclick = alloc;
33+
34+
const deallocBtn = document.getElementById('dealloc');
35+
deallocBtn.onclick = dealloc;
36+
});
37+
</script>
38+
</body>
39+
40+
</html>

test/leaks/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "leaks",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"devDependencies": {
7+
"koa": "^2.13.1",
8+
"koa-mount": "^4.0.0",
9+
"koa-static": "^5.0.0"
10+
}
11+
}

test/leaks/server.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
const Koa = require('koa');
7+
const serve = require('koa-static');
8+
const mount = require('koa-mount');
9+
10+
const app = new Koa();
11+
12+
app.use(serve('.'));
13+
app.use(mount('/static', serve('../../out')));
14+
15+
app.listen(3000);
16+
console.log('👉 http://localhost:3000');

0 commit comments

Comments
 (0)