automutate-tests
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -19,2 +19,6 @@ import { IMutationsProviderFactory } from "./mutationsProviderFactory"; | ||
/** | ||
* Endlines to normalize \r\n|\n to, if anything. | ||
*/ | ||
normalizeEndlines?: string; | ||
/** | ||
* File name for the original file contents. | ||
@@ -21,0 +25,0 @@ */ |
@@ -75,2 +75,5 @@ "use strict"; | ||
actualContents = (_a.sent()).toString(); | ||
if (settings.normalizeEndlines !== undefined) { | ||
actualContents = actualContents.replace(/\r\n|\n/g, settings.normalizeEndlines); | ||
} | ||
if (!settings.accept) return [3 /*break*/, 6]; | ||
@@ -77,0 +80,0 @@ return [4 /*yield*/, fs.writeFile(settings.expected, actualContents)]; |
@@ -118,2 +118,3 @@ "use strict"; | ||
expected: path.join(casePath, settings.expected), | ||
normalizeEndlines: settings.normalizeEndlines, | ||
original: matches[0], | ||
@@ -120,0 +121,0 @@ settings: path.join(casePath, settings.settings) |
{ | ||
"name": "automutate-tests", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Test harness for automutators.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -27,2 +27,7 @@ import { FileMutationsApplier, Logger, runMutations } from "automutate"; | ||
/** | ||
* Endlines to normalize \r\n|\n to, if anything. | ||
*/ | ||
normalizeEndlines?: string; | ||
/** | ||
* File name for the original file contents. | ||
@@ -62,4 +67,8 @@ */ | ||
// Assert | ||
const actualContents: string = (await fs.readFile(settings.actual)).toString(); | ||
let actualContents: string = (await fs.readFile(settings.actual)).toString(); | ||
if (settings.normalizeEndlines !== undefined) { | ||
actualContents = actualContents.replace(/\r\n|\n/g, settings.normalizeEndlines); | ||
} | ||
if (settings.accept) { | ||
@@ -66,0 +75,0 @@ await fs.writeFile(settings.expected, actualContents); |
@@ -107,2 +107,3 @@ import chalk from "chalk"; | ||
expected: path.join(casePath, settings.expected), | ||
normalizeEndlines: settings.normalizeEndlines, | ||
original: matches[0], | ||
@@ -109,0 +110,0 @@ settings: path.join(casePath, settings.settings), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
54231
1040