-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e74bcb
commit 2f753b9
Showing
11 changed files
with
227 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...x-gradle/src/generators/init/files/gradle/catalog/kotlin-multiplatform/libs.versions.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[versions] | ||
|
||
[libraries] | ||
|
||
[plugins] |
5 changes: 5 additions & 0 deletions
5
packages/nx-gradle/src/generators/init/files/gradle/catalog/micronaut/libs.versions.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[versions] | ||
|
||
[libraries] | ||
|
||
[plugins] |
5 changes: 5 additions & 0 deletions
5
packages/nx-gradle/src/generators/init/files/gradle/catalog/none/libs.versions.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[versions] | ||
|
||
[libraries] | ||
|
||
[plugins] |
5 changes: 5 additions & 0 deletions
5
packages/nx-gradle/src/generators/init/files/gradle/catalog/quarkus/libs.versions.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[versions] | ||
|
||
[libraries] | ||
|
||
[plugins] |
5 changes: 5 additions & 0 deletions
5
packages/nx-gradle/src/generators/init/files/gradle/catalog/spring-boot/libs.versions.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[versions] | ||
|
||
[libraries] | ||
|
||
[plugins] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
displayName: 'nx-gradle-catalog-e2e', | ||
preset: '../../../jest.preset.js', | ||
globals: {}, | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.[tj]s$': [ | ||
'ts-jest', | ||
{ | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
}, | ||
], | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'html'], | ||
coverageDirectory: | ||
'../../../coverage/e2e/nx-gradle-catalog-e2e', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "nx-gradle-catalog-e2e", | ||
"$schema": "../../../node_modules/nx/schemas/project-schema.json", | ||
"projectType": "application", | ||
"sourceRoot": "testing-projects/e2e/nx-gradle-catalog-e2e/src", | ||
"targets": { | ||
"e2e": { | ||
"executor": "@nx/jest:jest", | ||
"options": { | ||
"jestConfig": "testing-projects/e2e/nx-gradle-catalog-e2e/jest.config.js", | ||
"runInBand": true | ||
}, | ||
"dependsOn": ["nx-gradle:build"] | ||
} | ||
}, | ||
"tags": [], | ||
"implicitDependencies": ["nx-gradle"] | ||
} |
139 changes: 139 additions & 0 deletions
139
testing-projects/e2e/nx-gradle-catalog-e2e/tests/nx-gradle-catalog.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
import { names, workspaceRoot } from '@nx/devkit'; | ||
import { | ||
checkFilesExist, | ||
cleanup, | ||
readFile, | ||
readJson, | ||
runNxCommandAsync, | ||
tmpProjPath, | ||
uniq, | ||
updateFile, | ||
} from '@nx/plugin/testing'; | ||
import * as fse from 'fs-extra'; | ||
import * as path from 'path'; | ||
|
||
import { checkstyleVersion } from '@jnxplus/common'; | ||
import { | ||
addTmpToGitignore, | ||
patchPackageJson, | ||
patchRootPackageJson, | ||
removeTmpFromGitignore, | ||
runNxNewCommand, | ||
runPackageManagerInstallLinks, | ||
} from '@jnxplus/internal/testing'; | ||
|
||
describe('nx-gradle version-catalog e2e', () => { | ||
const isCI = | ||
process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true'; | ||
const isWin = process.platform === 'win32'; | ||
const isMacOs = process.platform === 'darwin'; | ||
const rootProjectName = uniq('boot-root-project-'); | ||
|
||
beforeAll(async () => { | ||
fse.ensureDirSync(tmpProjPath()); | ||
cleanup(); | ||
runNxNewCommand('', true); | ||
|
||
const pluginName = '@jnxplus/nx-gradle'; | ||
const nxGradleDistAbsolutePath = path.join( | ||
workspaceRoot, | ||
'dist', | ||
'packages', | ||
'nx-gradle' | ||
); | ||
|
||
const commonDistAbsolutePath = path.join( | ||
workspaceRoot, | ||
'dist', | ||
'packages', | ||
'common' | ||
); | ||
|
||
const gradleDistAbsolutePath = path.join( | ||
workspaceRoot, | ||
'dist', | ||
'packages', | ||
'gradle' | ||
); | ||
|
||
patchRootPackageJson(pluginName, nxGradleDistAbsolutePath); | ||
patchRootPackageJson('@jnxplus/common', commonDistAbsolutePath); | ||
patchRootPackageJson('@jnxplus/gradle', gradleDistAbsolutePath); | ||
|
||
patchPackageJson( | ||
gradleDistAbsolutePath, | ||
'@jnxplus/common', | ||
commonDistAbsolutePath | ||
); | ||
|
||
patchPackageJson( | ||
nxGradleDistAbsolutePath, | ||
'@jnxplus/common', | ||
commonDistAbsolutePath | ||
); | ||
patchPackageJson( | ||
nxGradleDistAbsolutePath, | ||
'@jnxplus/gradle', | ||
gradleDistAbsolutePath | ||
); | ||
|
||
runPackageManagerInstallLinks(); | ||
|
||
await runNxCommandAsync( | ||
`generate @jnxplus/nx-gradle:init --dsl kotlin --rootProjectName ${rootProjectName} --preset spring-boot --versionManagement version-catalog` | ||
); | ||
|
||
if (isCI) { | ||
removeTmpFromGitignore(); | ||
} | ||
}, 120000); | ||
|
||
afterAll(async () => { | ||
if (isCI) { | ||
addTmpToGitignore(); | ||
} | ||
|
||
// `nx reset` kills the daemon, and performs | ||
// some work which can help clean up e2e leftovers | ||
await runNxCommandAsync('reset'); | ||
}); | ||
|
||
it('should set NX_VERBOSE_LOGGING to true', async () => { | ||
expect(process.env['NX_VERBOSE_LOGGING']).toBe('true'); | ||
}, 120000); | ||
|
||
it('should use dsl option when initiating the workspace', async () => { | ||
// Making sure the package.json file contains the @jnxplus/nx-gradle dependency | ||
const packageJson = readJson('package.json'); | ||
expect(packageJson.devDependencies['@jnxplus/nx-gradle']).toBeTruthy(); | ||
|
||
// Making sure the nx.json file contains the @jnxplus/nx-gradle inside the plugins section | ||
const nxJson = readJson('nx.json'); | ||
expect(nxJson.plugins.includes('@jnxplus/nx-gradle')).toBeTruthy(); | ||
|
||
expect(() => | ||
checkFilesExist( | ||
'gradle/wrapper/gradle-wrapper.jar', | ||
'gradle/wrapper/gradle-wrapper.properties', | ||
'gradlew', | ||
'gradlew.bat', | ||
'gradle.properties', | ||
'settings.gradle.kts', | ||
'tools/linters/checkstyle.xml' | ||
) | ||
).not.toThrow(); | ||
|
||
expect(() => | ||
checkFilesExist( | ||
`node_modules/@jnxplus/tools/linters/checkstyle/checkstyle-${checkstyleVersion}-all.jar`, | ||
`node_modules/@jnxplus/tools/linters/ktlint/ktlint` | ||
) | ||
).not.toThrow(); | ||
}, 120000); | ||
|
||
it('shoud works', async () => { | ||
const name = uniq('app-'); | ||
|
||
await runNxCommandAsync(`generate @jnxplus/nx-gradle:app ${name}`); | ||
}, 240000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
testing-projects/e2e/nx-gradle-catalog-e2e/tsconfig.spec.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["jest", "node"] | ||
}, | ||
"include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] | ||
} |