Skip to content

Commit a8df756

Browse files
committed
chore: fix tests
1 parent 502ec5e commit a8df756

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/lib/helpers/handleFileTracking.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { join } = require('path')
22

33
const findCacheDir = require('find-cache-dir')
4-
const { existsSync, readdirSync, readFileSync, rmdirSync, removeSync, writeFileSync } = require('fs-extra')
4+
const { existsSync, readdirSync, readFileSync, removeSync, writeFileSync } = require('fs-extra')
55

66
const { NETLIFY_PUBLISH_PATH, NETLIFY_FUNCTIONS_PATH } = require('../config')
77

@@ -22,15 +22,13 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {
2222
const trackingFile = readFileSync(trackingFilePath, 'utf8')
2323
const [trackedFunctions, trackedPublish] = trackingFile.split(TRACKING_FILE_SEPARATOR)
2424
const cleanConfiguredFiles = (trackedFiles, dirPath) => {
25-
trackedFiles.forEach((file) => {
26-
const filePath = join(dirPath, file.trim('\r'))
27-
if (file !== '') {
28-
if (process.platform === 'win32') {
29-
rmdirSync(filePath, { recursive: true })
30-
}
25+
trackedFiles
26+
.map((file) => file.trim())
27+
.filter(Boolean)
28+
.forEach((file) => {
29+
const filePath = join(dirPath, file)
3130
removeSync(filePath)
32-
}
33-
})
31+
})
3432
}
3533

3634
if (isConfiguredPublishDir) {

src/tests/configurableDirs.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('next-on-netlify', () => {
5454
expect(existsSync(join(functionsDir, 'next_getServerSideProps_id', 'next_getServerSideProps_id.js'))).toBe(true)
5555
})
5656

57-
test('copies static pages to output directory', () => {
57+
test.only('copies static pages to output directory', () => {
5858
const OUTPUT_PATH = join(PROJECT_PATH, PUBLISH_DIR)
5959

6060
expect(existsSync(join(OUTPUT_PATH, 'static.html'))).toBe(true)

0 commit comments

Comments
 (0)