Gunslingor
03/24/2020, 6:17 AMjs("frontend") {
compilations {
create(environment) {
browser {
tasks {
val backendJar by getting {
dependsOn("frontendBrowserWebpack")
}
webpackTask {
setProperty("mode", environment)
//sourceMaps = false // Set 'true' if need debug
//report = true // Enable execute tests src/jsTest
}
testTask {
dependsOn("backendJar", "npmInstall")
useKarma {
//useIe()
//useSafari()
//useFirefox()
//useChrome()
//useChromeCanary()
useChromeHeadless()
//usePhantomJS()
//useOpera()
}
}
}
}
}
}
}
Task :frontendBrowserTest FAILEDFAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':frontendBrowserTest'.
command 'C:\Users\gunsl\.gradle\nodejs\node-v12.14.0-win-x64\node.exe' exited with errors (exit code: 1)* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 7s 8 actionable tasks: 1 executed, 7 up-to-date
Ilya Goncharov [JB]
03/24/2020, 7:02 AMimplementation(npm("three", "0.114.0"))
Gunslingor
03/24/2020, 7:26 AMgetByName("frontendTest") {
kotlin.srcDir("test/frontend/kotlin")
resources.srcDir("test/frontend/resources")
dependencies {
implementation(kotlin("test-js"))
implementation(npm("three", "0.114.0"))
}
}
Ilya Goncharov [JB]
03/24/2020, 7:39 AM@JsModule
on your external declarations?
Or you include three
to html
explicitly via <script>
?Gunslingor
03/24/2020, 7:40 AMIlya Goncharov [JB]
03/24/2020, 7:41 AMGunslingor
03/24/2020, 7:43 AMIlya Goncharov [JB]
03/24/2020, 7:44 AMthreejs-wrapper
in yout project?Gunslingor
03/24/2020, 7:44 AMgetByName("commonMain") {
kotlin.srcDir("src/common/kotlin")
resources.srcDir("src/common/resources")
dependencies {
implementation(kotlin("stdlib-common", version = kotlinVersion))
implementation(kotlin("gradle-plugin", version = kotlinVersion))
implementation("org.jetbrains.kotlinx:kotlinx-html-common:$kotlinxHtmlVersion")
}
}
getByName("backendMain") {
kotlin.srcDir("src/backend/kotlin")
resources.srcDir("src/backend/resources")
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("io.ktor:ktor-server-core:$ktorVersion")
implementation("io.ktor:ktor-server-netty:$ktorVersion")
implementation("io.ktor:ktor-html-builder:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinxHtmlVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
}
}
getByName("frontendMain") {
kotlin.srcDir("src/frontend/kotlin")
resources.srcDir("src/frontend/resources")
dependencies {
implementation(kotlin("stdlib-js"))
implementation("com.github.markaren:three-kt-wrapper:v0.88-ALPHA-7")
implementation("org.jetbrains.kotlinx:kotlinx-html-js:$kotlinxHtmlVersion")
implementation(npm("three", "0.114.0"))
}
}
getByName("commonTest") {
kotlin.srcDir("test/common/kotlin")
resources.srcDir("test/common/resources")
dependencies {
implementation(kotlin("test-common", version = kotlinVersion))
implementation(kotlin("test-annotations-common", version = kotlinVersion))
}
}
getByName("backendTest") {
kotlin.srcDir("test/backend/kotlin")
resources.srcDir("test/backend/resources")
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
getByName("frontendTest") {
kotlin.srcDir("test/frontend/kotlin")
resources.srcDir("test/frontend/resources")
dependencies {
implementation(kotlin("test-js"))
implementation(npm("three", "0.114.0"))
}
}
Task :frontendBrowserTest FAILED
Ilya Goncharov [JB]
03/24/2020, 7:54 AMthree-kt-wrapper
frontendBrowserTests... does that make sense?In fact it tries to build your javascript file with all dependencies inside. But in
three-kt-wrapper
threejs is external non module class
It makes sense, if you want to run your tests in browser
I’ll check, if you can include custom script to testsGunslingor
03/24/2020, 7:57 AMIlya Goncharov [JB]
03/24/2020, 8:08 AMkarma.config.d
folder in your project, and put js file with any name with next content
config.files.unshift(require('path').resolve(__dirname, "../../../../base/build/processedResources/js/main/test.js"))
Path is relative, and you need to set it with base of root-build/js/packages/module-test
So if you have multi-module project, it is similar with my sample
If it is single module project, you may get rid of several levels
Something like
config.files.unshift(require('path').resolve(__dirname, "../../../processedResources/js/main/test.js"))
Gunslingor
03/24/2020, 8:09 AMIlya Goncharov [JB]
03/24/2020, 8:11 AMthree.js
in this fileGunslingor
03/24/2020, 8:13 AMIlya Goncharov [JB]
03/24/2020, 8:17 AMbuild/processedResources
tooGunslingor
03/24/2020, 8:17 AMIlya Goncharov [JB]
03/24/2020, 8:20 AM*.js
so config.js
And fix path please, it should be
../../../processedResources/js/main/three.min.js
or you can try to use one from dirstibutions
, but this folder should be created after task distributeResources
and there is no guarantee, that it would be run before testsGunslingor
03/24/2020, 8:22 AMTask :frontendTest UP-TO-DATE
Task :allTests UP-TO-DATEBUILD SUCCESSFUL in 8s further up HeadlessChrome 80.0.3987 (Windows 10.0.0) ERROR Uncaught ReferenceError: THREE is not defined at C/Users/gunsl/IdeaProjects/FL/build/js/packages/FL frontend test/adapter browser.js76725:15 ReferenceError: THREE is not defined
Ilya Goncharov [JB]
03/24/2020, 8:24 AMGunslingor
03/24/2020, 8:29 AMIlya Goncharov [JB]
03/24/2020, 8:39 AMGunslingor
03/24/2020, 5:07 PM* What went wrong:
Execution failed for task ':frontendBrowserTest'.
> command 'C:\Users\gunsl\.gradle\nodejs\node-v12.14.0-win-x64\node.exe' exited with errors (exit code: 1)
when I add this:
testTask {
dependsOn("npmInstall")
useKarma {
There error changes to this:
Execution failed for task ':nodeSetup'.
> Could not resolve all files for configuration ':detachedConfiguration1'.
> Could not find org.nodejs:node:10.16.0.
Note the different version numbders, isnt that wierd> command 'C:\Users\gunsl\.gradle\nodejs\node-v12.14.0-win-x64\node.exe' exited with errors (exit code: 1)
a common reoccurring error, but that folder doesn't exist. When I run the presumably related kotlinNodeJsSetup task it says
Task :kotlinNodeJsSetup SKIPPED
Ilya Goncharov [JB]
03/24/2020, 6:36 PMnpmInstall
task? Is it from com.moowork.node
plugin?
Now kotlin-gradle-plugin can work with node and do install of modules with its ownGunslingor
03/24/2020, 6:37 PMIlya Goncharov [JB]
03/24/2020, 8:02 PMGunslingor
03/24/2020, 8:06 PMgetByName("frontendMain") {
kotlin.srcDir("src/frontend/kotlin")
resources.srcDir("src/frontend/resources")
dependencies {
implementation(kotlin("stdlib-js"))
implementation("com.github.markaren:three-kt-wrapper:v0.88-ALPHA-7")
implementation("org.jetbrains.kotlinx:kotlinx-html-js:$kotlinxHtmlVersion")
implementation(npm("three", "0.114.0"))
}
}