Skip to content

Commit

Permalink
fix(tests): mock writeFile in pack tests so we dont create 0 byte fil…
Browse files Browse the repository at this point in the history
…es in the repo

PR-URL: #3364
Credit: @nlf
Close: #3364
Reviewed-by: @wraithgar
  • Loading branch information
nlf authored and wraithgar committed Jun 4, 2021
1 parent e01149c commit efaf6f6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/lib/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ t.test('should pack current directory with no arguments', (t) => {
showProgress: () => {},
clearProgress: () => {},
},
fs: {
writeFile: (file, data, cb) => cb(),
},
})
const npm = mockNpm({
config: {
Expand Down Expand Up @@ -69,6 +72,9 @@ t.test('should pack given directory', (t) => {
showProgress: () => {},
clearProgress: () => {},
},
fs: {
writeFile: (file, data, cb) => cb(),
},
})
const npm = mockNpm({
config: {
Expand Down Expand Up @@ -104,6 +110,9 @@ t.test('should pack given directory for scoped package', (t) => {
showProgress: () => {},
clearProgress: () => {},
},
fs: {
writeFile: (file, data, cb) => cb(),
},
})
const npm = mockNpm({
config: {
Expand Down Expand Up @@ -138,6 +147,9 @@ t.test('should log pack contents', (t) => {
showProgress: () => {},
clearProgress: () => {},
},
fs: {
writeFile: (file, data, cb) => cb(),
},
})
const npm = mockNpm({
config: {
Expand Down Expand Up @@ -209,6 +221,9 @@ t.test('should log output as valid json', (t) => {
showProgress: () => {},
clearProgress: () => {},
},
fs: {
writeFile: (file, data, cb) => cb(),
},
})
const npm = mockNpm({
config: {
Expand Down Expand Up @@ -259,6 +274,9 @@ t.test('invalid packument', (t) => {
showProgress: () => {},
clearProgress: () => {},
},
fs: {
writeFile: (file, data, cb) => cb(),
},
})
const npm = mockNpm({
config: {
Expand Down Expand Up @@ -305,6 +323,9 @@ t.test('workspaces', (t) => {
showProgress: () => {},
clearProgress: () => {},
},
fs: {
writeFile: (file, data, cb) => cb(),
},
})
const npm = mockNpm({
localPrefix: testDir,
Expand Down

0 comments on commit efaf6f6

Please sign in to comment.