@@ -32,8 +32,7 @@ const testMe = repl.start({
32
32
testMe . _domain . on ( 'error' , assert . ifError ) ;
33
33
34
34
// Tab complete provides built in libs for import()
35
- testMe . complete ( 'import(\'' , common . mustCall ( ( error , data ) => {
36
- assert . strictEqual ( error , null ) ;
35
+ testMe . complete ( 'import(\'' , common . mustSucceed ( ( data ) => {
37
36
publicUnprefixedModules . forEach ( ( lib ) => {
38
37
assert (
39
38
data [ 0 ] . includes ( lib ) && data [ 0 ] . includes ( `node:${ lib } ` ) ,
@@ -43,15 +42,14 @@ testMe.complete('import(\'', common.mustCall((error, data) => {
43
42
const newModule = 'foobar' ;
44
43
assert ( ! builtinModules . includes ( newModule ) ) ;
45
44
repl . builtinModules . push ( newModule ) ;
46
- testMe . complete ( 'import(\'' , common . mustCall ( ( _ , [ modules ] ) => {
45
+ testMe . complete ( 'import(\'' , common . mustSucceed ( ( [ modules ] ) => {
47
46
assert . strictEqual ( data [ 0 ] . length + 1 , modules . length ) ;
48
47
assert ( modules . includes ( newModule ) &&
49
48
! modules . includes ( `node:${ newModule } ` ) ) ;
50
49
} ) ) ;
51
50
} ) ) ;
52
51
53
- testMe . complete ( "import\t( 'n" , common . mustCall ( ( error , data ) => {
54
- assert . strictEqual ( error , null ) ;
52
+ testMe . complete ( "import\t( 'n" , common . mustSucceed ( ( data ) => {
55
53
assert . strictEqual ( data . length , 2 ) ;
56
54
assert . strictEqual ( data [ 1 ] , 'n' ) ;
57
55
const completions = data [ 0 ] ;
@@ -77,16 +75,14 @@ testMe.complete("import\t( 'n", common.mustCall((error, data) => {
77
75
// Import calls should handle all types of quotation marks.
78
76
for ( const quotationMark of [ "'" , '"' , '`' ] ) {
79
77
putIn . run ( [ '.clear' ] ) ;
80
- testMe . complete ( 'import(`@nodejs' , common . mustCall ( ( err , data ) => {
81
- assert . strictEqual ( err , null ) ;
78
+ testMe . complete ( 'import(`@nodejs' , common . mustSucceed ( ( data ) => {
82
79
assert . deepStrictEqual ( data , [ expected , '@nodejs' ] ) ;
83
80
} ) ) ;
84
81
85
82
putIn . run ( [ '.clear' ] ) ;
86
83
// Completions should not be greedy in case the quotation ends.
87
84
const input = `import(${ quotationMark } @nodejsscope${ quotationMark } ` ;
88
- testMe . complete ( input , common . mustCall ( ( err , data ) => {
89
- assert . strictEqual ( err , null ) ;
85
+ testMe . complete ( input , common . mustSucceed ( ( data ) => {
90
86
assert . deepStrictEqual ( data , [ [ ] , undefined ] ) ;
91
87
} ) ) ;
92
88
}
@@ -96,8 +92,7 @@ testMe.complete("import\t( 'n", common.mustCall((error, data) => {
96
92
putIn . run ( [ '.clear' ] ) ;
97
93
// Completions should find modules and handle whitespace after the opening
98
94
// bracket.
99
- testMe . complete ( 'import \t("no_ind' , common . mustCall ( ( err , data ) => {
100
- assert . strictEqual ( err , null ) ;
95
+ testMe . complete ( 'import \t("no_ind' , common . mustSucceed ( ( data ) => {
101
96
assert . deepStrictEqual ( data , [ [ 'no_index' , 'no_index/' ] , 'no_ind' ] ) ;
102
97
} ) ) ;
103
98
}
@@ -110,8 +105,7 @@ testMe.complete("import\t( 'n", common.mustCall((error, data) => {
110
105
process . chdir ( __dirname ) ;
111
106
112
107
[ 'import(\'.' , 'import(".' ] . forEach ( ( input ) => {
113
- testMe . complete ( input , common . mustCall ( ( err , data ) => {
114
- assert . strictEqual ( err , null ) ;
108
+ testMe . complete ( input , common . mustSucceed ( ( data ) => {
115
109
assert . strictEqual ( data . length , 2 ) ;
116
110
assert . strictEqual ( data [ 1 ] , '.' ) ;
117
111
assert . strictEqual ( data [ 0 ] . length , 2 ) ;
@@ -121,16 +115,14 @@ testMe.complete("import\t( 'n", common.mustCall((error, data) => {
121
115
} ) ;
122
116
123
117
[ 'import(\'..' , 'import("..' ] . forEach ( ( input ) => {
124
- testMe . complete ( input , common . mustCall ( ( err , data ) => {
125
- assert . strictEqual ( err , null ) ;
118
+ testMe . complete ( input , common . mustSucceed ( ( data ) => {
126
119
assert . deepStrictEqual ( data , [ [ '../' ] , '..' ] ) ;
127
120
} ) ) ;
128
121
} ) ;
129
122
130
123
[ './' , './test-' ] . forEach ( ( path ) => {
131
124
[ `import('${ path } ` , `import("${ path } ` ] . forEach ( ( input ) => {
132
- testMe . complete ( input , common . mustCall ( ( err , data ) => {
133
- assert . strictEqual ( err , null ) ;
125
+ testMe . complete ( input , common . mustSucceed ( ( data ) => {
134
126
assert . strictEqual ( data . length , 2 ) ;
135
127
assert . strictEqual ( data [ 1 ] , path ) ;
136
128
assert . ok ( data [ 0 ] . includes ( './test-repl-tab-complete.js' ) ) ;
@@ -140,8 +132,7 @@ testMe.complete("import\t( 'n", common.mustCall((error, data) => {
140
132
141
133
[ '../parallel/' , '../parallel/test-' ] . forEach ( ( path ) => {
142
134
[ `import('${ path } ` , `import("${ path } ` ] . forEach ( ( input ) => {
143
- testMe . complete ( input , common . mustCall ( ( err , data ) => {
144
- assert . strictEqual ( err , null ) ;
135
+ testMe . complete ( input , common . mustSucceed ( ( data ) => {
145
136
assert . strictEqual ( data . length , 2 ) ;
146
137
assert . strictEqual ( data [ 1 ] , path ) ;
147
138
assert . ok ( data [ 0 ] . includes ( '../parallel/test-repl-tab-complete.js' ) ) ;
0 commit comments