File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ class JsTestGenerator(
113113 )
114114 context.packageJson = PackageJsonService (
115115 sourceFilePath,
116- projectPath,
116+ File ( projectPath) ,
117117 ).findClosestConfig()
118118 val paramNames = mutableMapOf<ExecutableId , List <String >>()
119119 val testSets = mutableListOf<CgMethodTestSet >()
Original file line number Diff line number Diff line change @@ -15,20 +15,20 @@ data class PackageJson(
1515
1616class PackageJsonService (
1717 private val filePathToInference : String ,
18- private val projectPath : String
18+ private val projectDir : File
1919) {
2020
2121 fun findClosestConfig (): PackageJson {
22- var currDir = File (filePathToInference.substringBeforeLast( " / " ) )
22+ var currDir = File (filePathToInference)
2323 do {
24+ currDir = currDir.parentFile
2425 val matchingFiles: Array <File > = currDir.listFiles(
2526 FilenameFilter { _, name ->
2627 return @FilenameFilter name == " package.json"
2728 }
2829 ) ? : throw IllegalStateException (" Error occurred while scanning file system" )
2930 if (matchingFiles.isNotEmpty()) return parseConfig(matchingFiles.first())
30- currDir = currDir.parentFile
31- } while (currDir.path != projectPath)
31+ } while (currDir != projectDir)
3232 return PackageJson .defaultConfig
3333 }
3434
Original file line number Diff line number Diff line change 11package settings
22
3+ import java.io.File
34import org.utbot.common.PathUtil.replaceSeparator
45import service.PackageJsonService
56import settings.JsPackagesSettings.mochaData
@@ -51,7 +52,7 @@ class PackageDataService(
5152 private val projectPath : String ,
5253 private val pathToNpm : String ,
5354) {
54- private val packageJson = PackageJsonService (filePathToInference, projectPath).findClosestConfig()
55+ private val packageJson = PackageJsonService (filePathToInference, File ( projectPath) ).findClosestConfig()
5556
5657 companion object {
5758 var nycPath: String = " "
You can’t perform that action at this time.
0 commit comments