-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathscenario.ts
30 lines (24 loc) · 1.04 KB
/
scenario.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { execSync } from 'node:child_process';
import * as path from 'node:path';
import { loggingTransport } from '@sentry-internal/node-integration-tests';
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: 'https://[email protected]/1337',
release: '1.0',
transport: loggingTransport,
});
import { runSentry } from './other-file';
runSentry();
const lsofOutput = execSync(`lsof -p ${process.pid}`, { encoding: 'utf8' });
const lsofTable = lsofOutput.split('\n');
const mainPath = __dirname.replace(`${path.sep}suites${path.sep}contextLines${path.sep}memory-leak`, '');
const numberOfLsofEntriesWithMainPath = lsofTable.filter(entry => entry.includes(mainPath));
// There should only be a single entry with the main path, otherwise we are leaking file handles from the
// context lines integration.
if (numberOfLsofEntriesWithMainPath.length > 1) {
// eslint-disable-next-line no-console
console.error('Leaked file handles detected');
// eslint-disable-next-line no-console
console.error(lsofTable);
process.exit(1);
}