Trying to adopt unit tests to Js target. When runn...
# javascript
p
Trying to adopt unit tests to Js target. When running got
Copy code
jsBrowserTest: java.lang.IllegalStateException: command '/home/user/.gradle/nodejs/node-v22.0.0-linux-x64/bin/node' exited with errors (exit code: 1)
Any ideas where to dig? Part of Gradle build script:
Copy code
js {
  browser {
     testTask {
        useKarma {
           useFirefoxHeadless()
        }
     }
  }
  useEsModules()
  binaries.library()
}
e
What happens if you remove:
Copy code
testTask {
  useKarma {
    useFirefoxHeadless()
  }
}
?
p
The same with such script:
Copy code
js {
  browser {
  }
  useEsModules()
  binaries.library()
}
e
Switch to
useCommonJs()
and try again
p
The same:
Copy code
js {
  browser {
  }
  useCommonJs()
  binaries.library()
}
e
And looking at the full build log you can't see any longer error message?
p
Have stack trace. Many repeating causes like this:
Copy code
Cause 2: java.lang.Error: java.lang.IllegalStateException: command '/home/p/.gradle/nodejs/node-v22.0.0-linux-x64/bin/node' exited with errors (exit code: 1)
	at org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesTestExecutor$execute$1.invoke(TCServiceMessagesTestExecutor.kt:108)
	at org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesTestExecutor$execute$1.invoke(TCServiceMessagesTestExecutor.kt:54)
	at org.jetbrains.kotlin.gradle.targets.js.testing.karma.KotlinKarma$createTestExecutionSpec$4$wrapExecute$1.invoke(KotlinKarma.kt:464)
	at org.jetbrains.kotlin.gradle.targets.js.testing.karma.KotlinKarma$createTestExecutionSpec$4$wrapExecute$1.invoke(KotlinKarma.kt:462)
	at org.jetbrains.kotlin.gradle.internal.ProgressKt.operation(progress.kt:21)
	at org.jetbrains.kotlin.gradle.internal.ProgressKt.operation$default(progress.kt:12)
	at org.jetbrains.kotlin.gradle.targets.js.testing.karma.KotlinKarma$createTestExecutionSpec$4.wrapExecute$kotlin_gradle_plugin_common(KotlinKarma.kt:462)
	at org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesTestExecutor.execute(TCServiceMessagesTestExecutor.kt:54)
	at org.jetbrains.kotlin.gradle.internal.testing.TCServiceMessagesTestExecutor.execute(TCServiceMessagesTestExecutor.kt:41)
	at org.gradle.api.tasks.testing.AbstractTestTask.executeTests(AbstractTestTask.java:520)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
e
I'd say, go back to your original configuration, and try to swich to
useMocha
Just trying to understand where the issue might be here.
p
The same with this script:
Copy code
js {
  browser {
     testTask {
        useMocha {
        }
     }
  }
  useEsModules()
  binaries.library()
}
e
Are you running on 2.0.20-Beta2?
p
2.0.0
e
Could you switch to the latest Beta? A lot of stuff has been fixed since 2.0.0.
p
The same with 2.0.20-Beta2.
e
Do you have any custom configuration? I'll have a go on my sample project
p
No custom configuration. All I have for JS target is the script in original message.
e
Seems to work fine on Windows 10. I had to use Chrome headless just because I haven't got Firefox installed.
Did you do a clean / temporarily disable caching?
p
Try with clean. And deleting .gradle folder. The same.
Will try on another pc
✔️ 1
On another pc it is working.
Need to find out the cause of not working for particular PC. Can't find logs with detailed message for process exit code 1.
@Edoardo Luppi thanks for helping!
e
No problem!