@diffblue/java-combiner
Advanced tools
Comparing version 0.1.5-rc2 to 0.1.5-rc4
@@ -82,11 +82,9 @@ "use strict"; | ||
const reservedShortNames = new Set(existingImports.map(simpleClassName)); | ||
const classRules = new Set(); | ||
let imports = []; | ||
let staticImports = []; | ||
const testMethods = []; | ||
let classRules = new Set(); | ||
for (const test of standardisedTests) { | ||
if (test.classRules) { | ||
test.classRules.forEach((i) => { | ||
classRules.add(i); | ||
}); | ||
classRules = new Set([...classRules, ...test.classRules]); | ||
} | ||
@@ -93,0 +91,0 @@ if (test.imports) { |
@@ -106,14 +106,13 @@ "use strict"; | ||
} | ||
if (classRules.size > 0 && (testImports.indexOf('org.junit.Rule') === -1)) { | ||
if (classRules.size && !testImports.includes('org.junit.Rule')) { | ||
testImports.push('org.junit.Rule'); | ||
} | ||
let rulesString = ''; | ||
for (const s of combinedTests.classRules) { | ||
rulesString = rulesString + ' ' + s.replace(/^(@[\w.]+)\s+/, ' $1\n ') + '\n\n'; | ||
let rules = ''; | ||
// map the rules. Add a newline after the @rule and indent both lines | ||
const mapRules = Array.from(combinedTests.classRules).map((rule) => ' ' + rule.replace(/^(@[\w.]+)\s+/, ' $1\n ')); | ||
rules = mapRules.join('\n\n'); | ||
rules = combineTests_1.shortenClassNames({ imports: testImports, body: rules }); | ||
if (rules !== '') { | ||
rules = '\n' + rules + '\n'; | ||
} | ||
rulesString = rulesString.slice(0, -2); | ||
rulesString = combineTests_1.shortenClassNames({ imports: testImports, body: rulesString }); | ||
if (rulesString !== '') { | ||
rulesString = '\n' + rulesString + '\n'; | ||
} | ||
if (!staticImports) { | ||
@@ -129,3 +128,3 @@ staticImports = []; | ||
public class ${classNameModified} { | ||
${rulesString} | ||
${rules} | ||
${content} | ||
@@ -132,0 +131,0 @@ } |
{ | ||
"name": "@diffblue/java-combiner", | ||
"description": "Java test combining library", | ||
"version": "0.1.5-rc2", | ||
"version": "0.1.5-rc4", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90532
1486