Skip to content

Commit 83ff8ca

Browse files
authored
Do not mutate args in ensure symlink tests (#1052)
1 parent 176ad6a commit 83ff8ca

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

lib/ensure/__tests__/symlink.test.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ describe('fse-ensure-symlink', () => {
102102
assert(dstDirContents.indexOf(dstBasename) >= 0)
103103
return done()
104104
}
105-
args.push(callback)
106-
return fn(...args)
105+
return fn(...args, callback)
107106
})
108107
}
109108

@@ -122,8 +121,7 @@ describe('fse-ensure-symlink', () => {
122121
assert.throws(() => fs.readFileSync(dstpath, 'utf8'), Error)
123122
return done()
124123
}
125-
args.push(callback)
126-
return fn(...args)
124+
return fn(...args, callback)
127125
})
128126
}
129127

@@ -139,8 +137,7 @@ describe('fse-ensure-symlink', () => {
139137
assert.strictEqual(dstdirExistsBefore, dstdirExistsAfter)
140138
return done()
141139
}
142-
args.push(callback)
143-
return fn(...args)
140+
return fn(...args, callback)
144141
})
145142
}
146143

@@ -162,8 +159,7 @@ describe('fse-ensure-symlink', () => {
162159
assert(dstDirContents.indexOf(dstBasename) >= 0)
163160
return done()
164161
}
165-
args.push(callback)
166-
return fn(...args)
162+
return fn(...args, callback)
167163
})
168164
}
169165

@@ -182,8 +178,7 @@ describe('fse-ensure-symlink', () => {
182178
assert.throws(() => fs.readdirSync(dstpath), Error)
183179
return done()
184180
}
185-
args.push(callback)
186-
return fn(...args)
181+
return fn(...args, callback)
187182
})
188183
}
189184

@@ -199,8 +194,7 @@ describe('fse-ensure-symlink', () => {
199194
assert.strictEqual(dstdirExistsBefore, dstdirExistsAfter)
200195
return done()
201196
}
202-
args.push(callback)
203-
return fn(...args)
197+
return fn(...args, callback)
204198
})
205199
}
206200

0 commit comments

Comments
 (0)