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(
113
113
)
114
114
context.packageJson = PackageJsonService (
115
115
sourceFilePath,
116
- projectPath,
116
+ File ( projectPath) ,
117
117
).findClosestConfig()
118
118
val paramNames = mutableMapOf<ExecutableId , List <String >>()
119
119
val testSets = mutableListOf<CgMethodTestSet >()
Original file line number Diff line number Diff line change @@ -15,20 +15,20 @@ data class PackageJson(
15
15
16
16
class PackageJsonService (
17
17
private val filePathToInference : String ,
18
- private val projectPath : String
18
+ private val projectDir : File
19
19
) {
20
20
21
21
fun findClosestConfig (): PackageJson {
22
- var currDir = File (filePathToInference.substringBeforeLast( " / " ) )
22
+ var currDir = File (filePathToInference)
23
23
do {
24
+ currDir = currDir.parentFile
24
25
val matchingFiles: Array <File > = currDir.listFiles(
25
26
FilenameFilter { _, name ->
26
27
return @FilenameFilter name == " package.json"
27
28
}
28
29
) ? : throw IllegalStateException (" Error occurred while scanning file system" )
29
30
if (matchingFiles.isNotEmpty()) return parseConfig(matchingFiles.first())
30
- currDir = currDir.parentFile
31
- } while (currDir.path != projectPath)
31
+ } while (currDir != projectDir)
32
32
return PackageJson .defaultConfig
33
33
}
34
34
Original file line number Diff line number Diff line change 1
1
package settings
2
2
3
+ import java.io.File
3
4
import org.utbot.common.PathUtil.replaceSeparator
4
5
import service.PackageJsonService
5
6
import settings.JsPackagesSettings.mochaData
@@ -51,7 +52,7 @@ class PackageDataService(
51
52
private val projectPath : String ,
52
53
private val pathToNpm : String ,
53
54
) {
54
- private val packageJson = PackageJsonService (filePathToInference, projectPath).findClosestConfig()
55
+ private val packageJson = PackageJsonService (filePathToInference, File ( projectPath) ).findClosestConfig()
55
56
56
57
companion object {
57
58
var nycPath: String = " "
You can’t perform that action at this time.
0 commit comments