@diffblue/java-combiner
Advanced tools
Comparing version 0.1.7 to 0.1.8-temp-bugfix-test
@@ -224,6 +224,6 @@ "use strict"; | ||
const staticImportsToAdd = []; | ||
// Sort new tests into reverse order, as we will add them last first and work upwards, | ||
// Sort new tests by unique id in reverse order, as we will add them last first and work upwards, | ||
// to ensure insertion positions are not modified by previous insertions | ||
tests.sort((a, b) => a.name > b.name ? -1 : 1); | ||
/** Position of funcion we want to insert before, start after last function */ | ||
tests.sort((a, b) => -(utils_1.cmp(a.id, b.id))); | ||
/** Position of function we want to insert before, start after last function */ | ||
let currFunc = functionLocations.length; | ||
@@ -230,0 +230,0 @@ for (const test of tests) { |
@@ -21,3 +21,3 @@ /** Generated test data from test-gen, supporting legacy field names */ | ||
imports: string[]; | ||
id?: string; | ||
id: string; | ||
name: string; | ||
@@ -24,0 +24,0 @@ staticImports: string[]; |
@@ -65,5 +65,11 @@ "use strict"; | ||
const testName = test.name; | ||
const numberTestOccurances = testNames.get(testName) || 0; | ||
let numberTestOccurances = testNames.get(testName) || 0; | ||
testNames.set(testName, numberTestOccurances + 1); | ||
const newTestName = numberTestOccurances > 0 ? `${testName}${numberTestOccurances}` : testName; | ||
let newTestName = numberTestOccurances > 0 ? `${testName}${numberTestOccurances}` : testName; | ||
// if the new test name already occurs | ||
while (numberTestOccurances > 0) { | ||
numberTestOccurances = testNames.get(newTestName) || 0; | ||
testNames.set(newTestName, numberTestOccurances + 1); | ||
newTestName = numberTestOccurances > 0 ? `${newTestName}${numberTestOccurances}` : newTestName; | ||
} | ||
test.body = test.body.replace(test.id, newTestName); | ||
@@ -70,0 +76,0 @@ dedupedTests.push(test); |
@@ -28,5 +28,5 @@ "use strict"; | ||
return tests.map((test) => ({ | ||
id: test.id || test.testId || undefined, | ||
id: test.id || test.testId || undefinedThrowError('No test id found'), | ||
body: test.body || test.testBody || test.test || undefinedThrowError('No test body found'), | ||
name: test.name || test.testName || undefinedThrowError('No test name'), | ||
name: test.name || test.testName || undefinedThrowError('No test name found'), | ||
classAnnotations: test.classAnnotations || [], | ||
@@ -33,0 +33,0 @@ coveredLines: test.coveredLines || [], |
@@ -0,1 +1,7 @@ | ||
0.1.8 (2019-09-19) | ||
================== | ||
* Ensure test sorting in mergeTests is deterministic | ||
* Make id a required property of the ITestData interface | ||
0.1.7 (2019-09-18) | ||
@@ -2,0 +8,0 @@ ================== |
{ | ||
"name": "@diffblue/java-combiner", | ||
"description": "Java test combining library", | ||
"version": "0.1.7", | ||
"version": "0.1.8-temp-bugfix-test", | ||
"main": "build/index.js", | ||
@@ -6,0 +6,0 @@ "types": "build/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
95757
1563