File tree Expand file tree Collapse file tree 3 files changed +75
-2
lines changed Expand file tree Collapse file tree 3 files changed +75
-2
lines changed Original file line number Diff line number Diff line change
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 ) ;
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -8,8 +8,6 @@ const startCLI = require('../common/debugger');
8
8
9
9
const assert = require ( 'assert' ) ;
10
10
11
- process . env . NODE_DEBUG = 'inspect' ;
12
-
13
11
{
14
12
15
13
const cli = startCLI ( [ fixtures . path ( 'debugger/alive.js' ) ] ) ;
You can’t perform that action at this time.
0 commit comments