Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

JS Test Examples: Move from gradle plugin com.moowork.node to de.solugo.gradle.nodejs #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gradle/js-tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build
.idea
*.iml
node_modules
package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
19 changes: 6 additions & 13 deletions gradle/js-tests/jasmine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ buildscript {
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.20'
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
classpath 'gradle.plugin.de.solugo.gradle:gradle-nodejs-plugin:0.2.1'
}
}

apply plugin: 'kotlin2js'
apply plugin: 'com.moowork.node'
apply plugin: 'de.solugo.gradle.nodejs'

repositories {
jcenter()
Expand All @@ -34,17 +34,10 @@ task populateNodeModules(type: Copy, dependsOn: compileKotlin2Js) {
into "${buildDir}/node_modules"
}

node {
download = true
}

task installJasmine(type: NpmTask) {
args = ['install', 'jasmine']
}

task runJasmine(type: NodeTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, installJasmine]) {
script = file('node_modules/jasmine/bin/jasmine.js')
args = [compileTestKotlin2Js.outputFile]
task runJasmine(type: NodeJsTask, dependsOn: [compileTestKotlin2Js, populateNodeModules]) {
require = ["jasmine"]
executable = "node_modules/jasmine/bin/jasmine.js"
args = [projectDir.toPath().relativize(file(compileTestKotlin2Js.outputFile).toPath())]
}

test.dependsOn runJasmine
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
19 changes: 6 additions & 13 deletions gradle/js-tests/jest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ buildscript {
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.20'
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
classpath 'gradle.plugin.de.solugo.gradle:gradle-nodejs-plugin:0.2.1'
}
}

apply plugin: 'kotlin2js'
apply plugin: 'com.moowork.node'
apply plugin: 'de.solugo.gradle.nodejs'

repositories {
jcenter()
Expand All @@ -34,17 +34,10 @@ task populateNodeModules(type: Copy, dependsOn: compileKotlin2Js) {
into "${buildDir}/node_modules"
}

node {
download = true
}

task installJest(type: NpmTask) {
args = ['install', 'jest']
}

task runJest(type: NodeTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, installJest]) {
script = file('node_modules/jest/bin/jest.js')
args = [projectDir.toURI().relativize(compileTestKotlin2Js.outputFile.toURI())]
task runJest(type: NodeJsTask, dependsOn: [compileTestKotlin2Js, populateNodeModules]) {
require = ["jest"]
executable = "node_modules/jest/bin/jest.js"
args = [projectDir.toPath().relativize(file(compileTestKotlin2Js.outputFile).toPath())]
}

test.dependsOn runJest
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
5 changes: 4 additions & 1 deletion gradle/js-tests/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"test": "./gradlew test"
},
"jest": {
"testRegex": "_test\\.js$"
"testRegex": "_test\\.js$"
},
"dependencies": {
"jest": "^23.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
19 changes: 6 additions & 13 deletions gradle/js-tests/mocha/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ buildscript {
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.20'
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
classpath 'gradle.plugin.de.solugo.gradle:gradle-nodejs-plugin:0.2.1'
}
}

apply plugin: 'kotlin2js'
apply plugin: 'com.moowork.node'
apply plugin: 'de.solugo.gradle.nodejs'

repositories {
jcenter()
Expand All @@ -34,17 +34,10 @@ task populateNodeModules(type: Copy, dependsOn: compileKotlin2Js) {
into "${buildDir}/node_modules"
}

node {
download = true
}

task installMocha(type: NpmTask) {
args = ['install', 'mocha']
}

task runMocha(type: NodeTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, installMocha]) {
script = file('node_modules/mocha/bin/mocha')
args = [compileTestKotlin2Js.outputFile]
task runMocha(type: NodeJsTask, dependsOn: [compileTestKotlin2Js, populateNodeModules]) {
require = ["mocha"]
executable = "node_modules/mocha/bin/mocha"
args = [projectDir.toPath().relativize(file(compileTestKotlin2Js.outputFile).toPath())]
}

test.dependsOn runMocha
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
17 changes: 5 additions & 12 deletions gradle/js-tests/qunit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ buildscript {
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.20'
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
classpath 'gradle.plugin.de.solugo.gradle:gradle-nodejs-plugin:0.2.1'
}
}

apply plugin: 'kotlin2js'
apply plugin: 'com.moowork.node'
apply plugin: 'de.solugo.gradle.nodejs'

repositories {
jcenter()
Expand All @@ -34,16 +34,9 @@ task populateNodeModules(type: Copy, dependsOn: compileKotlin2Js) {
into "${buildDir}/node_modules"
}

node {
download = true
}

task installQunit(type: NpmTask) {
args = ['install', 'qunitjs']
}

task runQunit(type: NodeTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, installQunit]) {
script = file('node_modules/qunitjs/bin/qunit')
task runQunit(type: NodeJsTask, dependsOn: [compileTestKotlin2Js, populateNodeModules]) {
require = ["qunit"]
executable = "node_modules/qunit/bin/qunit"
args = [projectDir.toPath().relativize(file(compileTestKotlin2Js.outputFile).toPath())]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
27 changes: 11 additions & 16 deletions gradle/js-tests/tape/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ buildscript {
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.20'
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
classpath 'gradle.plugin.de.solugo.gradle:gradle-nodejs-plugin:0.2.1'
}
}

apply plugin: 'kotlin2js'
apply plugin: 'com.moowork.node'
apply plugin: 'de.solugo.gradle.nodejs'

repositories {
jcenter()
Expand All @@ -24,25 +24,20 @@ dependencies {
kotlinOptions.moduleKind = "commonjs"
}

task populateNodeModules(type: Copy) {
task populateNodeModules(type: Copy, dependsOn: compileKotlin2Js) {
from compileKotlin2Js.destinationDir

configurations.testCompile.each { from zipTree(it.absolutePath) }
include '*.js'
into "${buildDir}/node_modules"
}
configurations.testCompile.each {
from zipTree(it.absolutePath).matching { include '*.js' }
}

node {
download = true
}

task installTape(type: NpmTask) {
args = ['install', 'tape']
into "${buildDir}/node_modules"
}

task testTape(type: NodeTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, installTape]) {
script = file('node_modules/tape/bin/tape')
args = ['tape-plugin.js', compileTestKotlin2Js.outputFile]
task("testTape", type: NodeJsTask, dependsOn: [compileTestKotlin2Js, populateNodeModules]) {
require = ["tape"]
executable = "node_modules/tape/bin/tape"
args = ['tape-plugin.js', projectDir.toPath().relativize(file(compileTestKotlin2Js.outputFile).toPath())]
}

test.dependsOn testTape
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip