Skip to content

Commit 3b42a8f

Browse files
author
Lukas Holzer
committed
chore: tests were writing on the real fs avoid that
1 parent 3064f6e commit 3b42a8f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/functions/server.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const { join } = require('path')
44
const zisi = require('@netlify/zip-it-and-ship-it')
55
const test = require('ava')
66
const express = require('express')
7+
const mock = require('mock-fs')
78
const mockRequire = require('mock-require')
89
const sinon = require('sinon')
910
const request = require('supertest')
@@ -17,6 +18,9 @@ const functionsPath = `functions`
1718
/** @type { express.Express} */
1819
let app
1920

21+
// mock the file-system to not write on the real one with `mkdir` inside the registry.js
22+
mock({ node_modules: mock.load(join(__dirname, '../../../node_modules')) })
23+
2024
test.before(async (t) => {
2125
const mainFile = join(projectRoot, functionsPath, 'hello.js')
2226
t.context.zisiStub = sinon.stub(zisi, 'listFunctions').returns(

0 commit comments

Comments
 (0)