Skip to content

Commit 26d00c4

Browse files
nlfwraithgar
authored andcommitted
fix(tests): mock writeFile in pack tests so we dont create 0 byte files in the repo
PR-URL: #3364 Credit: @nlf Close: #3364 Reviewed-by: @wraithgar
1 parent 3654890 commit 26d00c4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/lib/pack.js

+21
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ t.test('should pack current directory with no arguments', (t) => {
3434
showProgress: () => {},
3535
clearProgress: () => {},
3636
},
37+
fs: {
38+
writeFile: (file, data, cb) => cb(),
39+
},
3740
})
3841
const npm = mockNpm({
3942
config: {
@@ -69,6 +72,9 @@ t.test('should pack given directory', (t) => {
6972
showProgress: () => {},
7073
clearProgress: () => {},
7174
},
75+
fs: {
76+
writeFile: (file, data, cb) => cb(),
77+
},
7278
})
7379
const npm = mockNpm({
7480
config: {
@@ -104,6 +110,9 @@ t.test('should pack given directory for scoped package', (t) => {
104110
showProgress: () => {},
105111
clearProgress: () => {},
106112
},
113+
fs: {
114+
writeFile: (file, data, cb) => cb(),
115+
},
107116
})
108117
const npm = mockNpm({
109118
config: {
@@ -138,6 +147,9 @@ t.test('should log pack contents', (t) => {
138147
showProgress: () => {},
139148
clearProgress: () => {},
140149
},
150+
fs: {
151+
writeFile: (file, data, cb) => cb(),
152+
},
141153
})
142154
const npm = mockNpm({
143155
config: {
@@ -209,6 +221,9 @@ t.test('should log output as valid json', (t) => {
209221
showProgress: () => {},
210222
clearProgress: () => {},
211223
},
224+
fs: {
225+
writeFile: (file, data, cb) => cb(),
226+
},
212227
})
213228
const npm = mockNpm({
214229
config: {
@@ -259,6 +274,9 @@ t.test('invalid packument', (t) => {
259274
showProgress: () => {},
260275
clearProgress: () => {},
261276
},
277+
fs: {
278+
writeFile: (file, data, cb) => cb(),
279+
},
262280
})
263281
const npm = mockNpm({
264282
config: {
@@ -305,6 +323,9 @@ t.test('workspaces', (t) => {
305323
showProgress: () => {},
306324
clearProgress: () => {},
307325
},
326+
fs: {
327+
writeFile: (file, data, cb) => cb(),
328+
},
308329
})
309330
const npm = mockNpm({
310331
localPrefix: testDir,

0 commit comments

Comments
 (0)