Unable to generate test file for a simple Maven project
Opened this issue · 4 comments
If I run it from right clicking the java file. Nothing happens and nothing in extension logs.
If I try it from command pallete
Running the contributed command: 'extension.generateTest' failed.
- Did u check the version of extension?
- If (1) doesn't work, please comment your project directory structure. I'll fix it asap
Structure
trunk
branches
lib
pom.xml
Extension Info
Name: Junit Testfile Generator
Id: marcolee.testfile-generator-for-junit
Description: it provide context menu for generating junit test file
Version: 0.0.7
Publisher: marcoLee
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=marcoLee.testfile-generator-for-junit
Same here
RangeError: Maximum call stack size exceeded
at existsSync (fs.js:231:20)
at fs.existsSync (electron/js2c/asar.js:395:27)
at Object.fs.existsSync (electron/js2c/asar.js:395:27)
at recursiveMkdir (~/.vscode/extensions/marcolee.testfile-generator-for-junit-0.0.7/src/generator/testGenerator.js:42:10)
at recursiveMkdir (~/.vscode/extensions/marcolee.testfile-generator-for-junit-0.0.7/src/generator/testGenerator.js:49:19)
....
...
at recursiveMkdir (~/.vscode/extensions/marcolee.testfile-generator-for-junit-0.0.7/src/generator/testGenerator.js:49:19)
at recursiveMkdir (~/.vscode/extensions/marcolee.testfile-generator-for-junit-0.0.7/src/generator/testGenerator.js:49:19)
at recursiveMkdir (~/.vscode/extensions/marcolee.testfile-generator-for-junit-0.0.7/src/generator/testGenerator.js:49:19) extension.generateTest
Mac OS Mojave : Version 10.14.6 (18G4032)
FIY I changed my current installed version at testGenerator.js by replacing the delimiter to be os specific
const path = require('path')
const delimiter = path.sep;
and use delimiter instead of '\\'
across the file
let testfileURL = testfileURI.split(delimiter);
That fixed
and then I changed the package name generation code
fs.appendFileSync(
testfileURI,
testfile.taggedJunitTestfile( className, getPackageName(testfileURL)) // `${className} ${"default"}`
);
and the getPackageName
function
function getPackageName(s){
const reducer = (memo, item) => (item === 'java') ? {found: true, items: []} : !memo.found ? memo : { found:true, items: memo.items.concat(item) }
return s.split(delimiter).reduce(reducer, {}).items.join('.');
}
I tried to create a pull request but you got rid of the ../resource/junitTestfileTemplate
so it doesn't compile. I will try to fix it all when I have time.
I hope that helps