diff --git a/src/createTeardown.ts b/src/createTeardown.ts index c35f963..90ebbd5 100644 --- a/src/createTeardown.ts +++ b/src/createTeardown.ts @@ -34,12 +34,12 @@ export function addFile( await fsExtra.createFile(absoluteFilePath) if (content) { - const writeContent = - typeof content === 'string' - ? util.promisify(fs.writeFile) - : fsExtra.writeJSON - - await writeContent(absoluteFilePath, content) + if (typeof content === 'string') { + const normalizedContent = content.trim() + await fs.promises.writeFile(absoluteFilePath, normalizedContent) + } else { + await fsExtra.writeJSON(absoluteFilePath, content) + } } return absoluteFilePath