Avoid dirty state after unit-test execution

This commit is contained in:
daz 2024-03-12 22:04:01 +13:00
parent 9b415aef98
commit 60b8089f55
No known key found for this signature in database
4 changed files with 8 additions and 5 deletions

1
sources/test/jest/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
tmp

View file

@ -2,11 +2,14 @@ import {GradleStateCache} from "../../src/cache-base"
import * as path from 'path'
import * as fs from 'fs'
const testTmp = 'test/jest/tmp'
fs.rmSync(testTmp, {recursive: true, force: true})
describe("--info and --stacktrace", () => {
describe("will be created", () => {
it("when gradle.properties does not exists", async () => {
const emptyGradleHome = 'test/jest/resources/gradle-home/empty'
fs.rmSync(path.resolve(emptyGradleHome, "gradle.properties"), {force: true})
const emptyGradleHome = `${testTmp}/empty-gradle-home`
fs.mkdirSync(emptyGradleHome, {recursive: true})
const stateCache = new GradleStateCache("ignored", emptyGradleHome)
stateCache.configureInfoLogLevel()
@ -17,7 +20,8 @@ describe("--info and --stacktrace", () => {
})
describe("will be added", () => {
it("and gradle.properties does exists", async () => {
const existingGradleHome = 'test/jest/resources/gradle-home/existing'
const existingGradleHome = `${testTmp}/existing-gradle-home`
fs.mkdirSync(existingGradleHome, {recursive: true})
fs.writeFileSync(path.resolve(existingGradleHome, "gradle.properties"), "org.gradle.logging.level=debug\n")
const stateCache = new GradleStateCache("ignored", existingGradleHome)

View file

@ -1 +0,0 @@
gradle.properties

View file

@ -1 +0,0 @@
org.gradle.logging.level=debug