mirror of
https://github.com/sasjs/adapter.git
synced 2025-12-11 01:14:36 +00:00
fix(path): make log file path platform-agnostic
This commit is contained in:
@@ -8,7 +8,8 @@ export const getFileStream = async (job: Job, filePath?: string) => {
|
||||
const isFolderPath = await isFolder(logPath)
|
||||
if (isFolderPath) {
|
||||
const logFileName = `${job.name || 'job'}-${generateTimestamp()}.log`
|
||||
const logFilePath = `${filePath || process.cwd()}/${logFileName}`
|
||||
const path = require('path')
|
||||
const logFilePath = path.join(filePath || process.cwd(), logFileName)
|
||||
return await createWriteStream(logFilePath)
|
||||
} else {
|
||||
return await createWriteStream(logPath)
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('getFileStream', () => {
|
||||
|
||||
expect(createWriteStream).not.toHaveBeenCalledWith(__dirname)
|
||||
expect(createWriteStream).toHaveBeenCalledWith(
|
||||
expect.stringContaining(__dirname + '/test job-20')
|
||||
expect.stringContaining(path.join(__dirname, '/test job-20'))
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user