Skip to content

Commit

Permalink
Use docker (#9)
Browse files Browse the repository at this point in the history
* Add links

* Use docker

* Add newline
  • Loading branch information
rogervinas committed Nov 17, 2023
1 parent 0920557 commit cd18954
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 23 deletions.
74 changes: 51 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,32 @@

Java testing with [JUnit5](https://junit.org/junit5/), [Mockito](https://site.mockito.org/) and [AssertJ](https://assertj.github.io/doc/)

### Pre-requisites
### Run this project using 🐳 [docker](https://www.docker.com/)
* Go to [java](java) folder
* Execute `./docker-run.sh`
* Once inside the container:
* Test with `./gradlew test`
* Run with `./gradlew run`

### Run this project locally

#### Pre-requisites
* Install [Java](https://openjdk.org/) and [Gradle](https://gradle.org/) manually or ...
* Install [SdkMan](https://sdkman.io/) and ...
* Install **Java** using `sdk install java 21-tem` (use `sdk list java` to see all versions)
* Install **Gradle** using `sdk install grade 8.4` (use `sdk list gradle` to see all versions)
* Install **Gradle** using `sdk install grade 8.4` (use `sdk list gradle` to see all versions)

### Create project from scratch
#### Run locally
* Go to [java](java) folder
* Test with `./gradlew test`
* Run with `./gradlew run`

#### Create project from scratch
* Create project using `gradle init --type java-application --dsl kotlin --test-framework junit-jupiter`
* Add [Mockito](https://site.mockito.org/) and [AssertJ](https://assertj.github.io/doc/) dependencies in [build.gradle.kts](java/build.gradle.kts):
* `testImplementation("org.mockito:mockito-core:x.x.x")`
* `testImplementation("org.assertj:assertj-core:x.x.x")`

### Run this project
* Go to [java](java) folder
* Test with `./gradlew test`
* Run with `./gradlew run`

## Kotlin

[![CI](https://github.com/rogervinas/tests-everywhere/actions/workflows/kotlin.yml/badge.svg)](https://github.com/rogervinas/tests-everywhere/actions/workflows/kotlin.yml)
Expand All @@ -38,36 +47,61 @@ Java testing with [JUnit5](https://junit.org/junit5/), [Mockito](https://site.mo

Kotlin testing with [Kotest](https://kotest.io) and [MockK](https://mockk.io/)

### Pre-requisites
### Run this project using 🐳 [docker](https://www.docker.com/)
* Go to [kotlin](kotlin) folder
* Execute `./docker-run.sh`
* Once inside the container:
* Test with `./gradlew test`
* Run with `./gradlew run`

### Run this project locally

#### Pre-requisites
* Install [Java](https://openjdk.org/) and [Gradle](https://gradle.org/) manually or ...
* Install [SdkMan](https://sdkman.io/) and ...
* Install **Java** using `sdk install java 21-tem` (use `sdk list java` to see all versions)
* Install **Gradle** using `sdk install grade 8.4` (use `sdk list gradle` to see all versions)

### Create project from scratch
#### Run locally
* Go to [kotlin](kotlin) folder
* Test with `./gradlew test`
* Run with `./gradlew run`

#### Create project from scratch
* Create project using `gradle init --type kotlin-application --dsl kotlin --test-framework kotlintest`
* Add [Kotest](https://kotest.io) and [MockK](https://mockk.io/) dependencies in [build.gradle.kts](kotlin/build.gradle.kts):
* `testImplementation("io.kotest:kotest-runner-junit5:x.x.x")`
* `testImplementation("io.mockk:mockk:x.x.x")`

### Run this project
* Go to [kotlin](kotlin) folder
* Test with `./gradlew test`
* Run with `./gradlew run`

## JavaScript

[![CI](https://github.com/rogervinas/tests-everywhere/actions/workflows/javascript.yml/badge.svg)](https://github.com/rogervinas/tests-everywhere/actions/workflows/javascript.yml)
![Node](https://img.shields.io/badge/Node-18.x-blue?labelColor=black)

JavaScript testing with [Jest](https://jestjs.io/)

### Pre-requisites
### Run this project using 🐳 [docker](https://www.docker.com/)
* Go to [kotlin](kotlin) folder
* Execute `./docker-run.sh`
* Once inside the container:
* Only first time, install dependencies with `npm install`
* Test with `npm test`
* Run with `npm start`

### Run this project locally

#### Pre-requisites
* Install [Node.js](https://nodejs.org/en/) manually or ...
* Install [Node Version Manager](https://github.com/nvm-sh/nvm) and ...
* Install **Node.js** executing `nvm use v18` or `nvm use stable`

### Create project from scratch
#### Run locally
* Go to [javascript](javascript) folder
* Only first time, install dependencies with `npm install`
* Test with `npm test`
* Run with `npm start`

#### Create project from scratch
* Create project using `npm init`
* Install [Jest](https://jestjs.io/) using `npm install --save-dev jest`
* Configure scripts in [package.json](javascript/package.json):
Expand All @@ -77,9 +111,3 @@ JavaScript testing with [Jest](https://jestjs.io/)
"test": "jest"
}
```

### Run this project
* Go to [javascript](javascript) folder
* Only first time, install dependencies running `npm install`
* Test with `npm test`
* Run with `npm start`
6 changes: 6 additions & 0 deletions java/docker-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docker run -it --rm \
--name java \
--volume $PWD:/project \
--workdir /project \
--entrypoint "/usr/bin/bash" \
eclipse-temurin:21-jdk
6 changes: 6 additions & 0 deletions javascript/docker-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docker run -it --rm \
--name kotlin \
--volume $PWD:/project \
--workdir /project \
--entrypoint "/usr/bin/bash" \
node:18 \
6 changes: 6 additions & 0 deletions kotlin/docker-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docker run -it --rm \
--name kotlin \
--volume $PWD:/project \
--workdir /project \
--entrypoint "/usr/bin/bash" \
eclipse-temurin:21-jdk

0 comments on commit cd18954

Please sign in to comment.