Skip to content

Commit a3f66df

Browse files
committed
fixup! fixup! test: log more information in debugger tests
1 parent f8e6ee4 commit a3f66df

File tree

3 files changed

+75
-2
lines changed

3 files changed

+75
-2
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
const dns = require('dns');
3+
4+
const {
5+
setDeserializeMainFunction
6+
} = require('v8').startupSnapshot;
7+
8+
function query() {
9+
dns.resolve4('nodejs.org', (err, addresses) => {
10+
if (err) throw error;
11+
12+
console.log(`addresses: ${JSON.stringify(addresses)}`);
13+
14+
addresses.forEach((a) => {
15+
dns.reverse(a, (err, hostnames) => {
16+
if (err) throw error;
17+
18+
console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
19+
});
20+
});
21+
});
22+
}
23+
24+
query();
25+
26+
setDeserializeMainFunction(query);

test/internet/test-snapshot-dns.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
'use strict';
2+
3+
// This tests support for the dns module in snapshot.
4+
5+
require('../common');
6+
const assert = require('assert');
7+
const { spawnSync } = require('child_process');
8+
const tmpdir = require('../common/tmpdir');
9+
const fixtures = require('../common/fixtures');
10+
const path = require('path');
11+
const fs = require('fs');
12+
13+
tmpdir.refresh();
14+
const blobPath = path.join(tmpdir.path, 'snapshot.blob');
15+
const entry = fixtures.path('snapshot', 'dns-local.js');
16+
{
17+
const child = spawnSync(process.execPath, [
18+
'--snapshot-blob',
19+
blobPath,
20+
'--build-snapshot',
21+
entry,
22+
], {
23+
cwd: tmpdir.path
24+
});
25+
if (child.status !== 0) {
26+
console.log(child.stderr.toString());
27+
console.log(child.stdout.toString());
28+
assert.strictEqual(child.status, 0);
29+
}
30+
const stats = fs.statSync(path.join(tmpdir.path, 'snapshot.blob'));
31+
assert(stats.isFile());
32+
}
33+
34+
{
35+
const child = spawnSync(process.execPath, [
36+
'--snapshot-blob',
37+
blobPath,
38+
], {
39+
cwd: tmpdir.path,
40+
env: {
41+
...process.env,
42+
}
43+
});
44+
45+
const stdout = child.stdout.toString().trim();
46+
const file = fs.readFileSync(fixtures.path('x1024.txt'), 'utf8');
47+
assert.strictEqual(stdout, file);
48+
assert.strictEqual(child.status, 0);
49+
}

test/sequential/test-debugger-exec.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ const startCLI = require('../common/debugger');
88

99
const assert = require('assert');
1010

11-
process.env.NODE_DEBUG = 'inspect';
12-
1311
{
1412

1513
const cli = startCLI([fixtures.path('debugger/alive.js')]);

0 commit comments

Comments
 (0)