feat(gradle): change test glob to include Tests and Test (#26913)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
fa83b36131
commit
ccb0d7d244
@ -202,192 +202,233 @@ describe('@nx/gradle/plugin', () => {
|
|||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create nodes with atomized tests targets based on gradle for nested project root', async () => {
|
describe('with atomized tests targets', () => {
|
||||||
gradleReport = {
|
beforeEach(async () => {
|
||||||
gradleFileToGradleProjectMap: new Map<string, string>([
|
gradleReport = {
|
||||||
['nested/nested/proj/build.gradle', 'proj'],
|
gradleFileToGradleProjectMap: new Map<string, string>([
|
||||||
]),
|
['nested/nested/proj/build.gradle', 'proj'],
|
||||||
buildFileToDepsMap: new Map<string, string>(),
|
]),
|
||||||
gradleFileToOutputDirsMap: new Map<string, Map<string, string>>([
|
buildFileToDepsMap: new Map<string, string>(),
|
||||||
['nested/nested/proj/build.gradle', new Map([['build', 'build']])],
|
gradleFileToOutputDirsMap: new Map<string, Map<string, string>>([
|
||||||
]),
|
['nested/nested/proj/build.gradle', new Map([['build', 'build']])],
|
||||||
gradleProjectToTasksTypeMap: new Map<string, Map<string, string>>([
|
]),
|
||||||
['proj', new Map([['test', 'Test']])],
|
gradleProjectToTasksTypeMap: new Map<string, Map<string, string>>([
|
||||||
]),
|
['proj', new Map([['test', 'Test']])],
|
||||||
gradleProjectToProjectName: new Map<string, string>([['proj', 'proj']]),
|
]),
|
||||||
};
|
gradleProjectToProjectName: new Map<string, string>([['proj', 'proj']]),
|
||||||
await tempFs.createFiles({
|
};
|
||||||
'nested/nested/proj/build.gradle': ``,
|
await tempFs.createFiles({
|
||||||
});
|
'nested/nested/proj/build.gradle': ``,
|
||||||
await tempFs.createFiles({
|
});
|
||||||
'proj/src/test/java/test/rootTest.java': ``,
|
await tempFs.createFiles({
|
||||||
});
|
'proj/src/test/java/test/rootTest.java': ``,
|
||||||
await tempFs.createFiles({
|
});
|
||||||
'nested/nested/proj/src/test/java/test/test.java': ``,
|
await tempFs.createFiles({
|
||||||
});
|
'nested/nested/proj/src/test/java/test/aTest.java': ``,
|
||||||
await tempFs.createFiles({
|
});
|
||||||
'nested/nested/proj/src/test/java/test/test1.java': ``,
|
await tempFs.createFiles({
|
||||||
|
'nested/nested/proj/src/test/java/test/bTest.java': ``,
|
||||||
|
});
|
||||||
|
await tempFs.createFiles({
|
||||||
|
'nested/nested/proj/src/test/java/test/cTests.java': ``,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const results = await createNodesFunction(
|
it('should create nodes with atomized tests targets based on gradle for nested project root', async () => {
|
||||||
[
|
const results = await createNodesFunction(
|
||||||
'nested/nested/proj/build.gradle',
|
|
||||||
'proj/src/test/java/test/rootTest.java',
|
|
||||||
'nested/nested/proj/src/test/java/test/test.java',
|
|
||||||
'nested/nested/proj/src/test/java/test/test1.java',
|
|
||||||
],
|
|
||||||
{
|
|
||||||
buildTargetName: 'build',
|
|
||||||
ciTargetName: 'test-ci',
|
|
||||||
},
|
|
||||||
context
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(results).toMatchInlineSnapshot(`
|
|
||||||
[
|
|
||||||
[
|
[
|
||||||
"nested/nested/proj/build.gradle",
|
'nested/nested/proj/build.gradle',
|
||||||
{
|
'proj/src/test/java/test/rootTest.java',
|
||||||
"projects": {
|
'nested/nested/proj/src/test/java/test/aTest.java',
|
||||||
"nested/nested/proj": {
|
'nested/nested/proj/src/test/java/test/bTest.java',
|
||||||
"metadata": {
|
'nested/nested/proj/src/test/java/test/cTests.java',
|
||||||
"targetGroups": {
|
],
|
||||||
"Test": [
|
{
|
||||||
"test-ci--test",
|
buildTargetName: 'build',
|
||||||
"test-ci--test1",
|
ciTargetName: 'test-ci',
|
||||||
"test-ci",
|
},
|
||||||
"test",
|
context
|
||||||
],
|
);
|
||||||
},
|
|
||||||
"technologies": [
|
expect(results).toMatchInlineSnapshot(`
|
||||||
"gradle",
|
[
|
||||||
],
|
[
|
||||||
},
|
"nested/nested/proj/build.gradle",
|
||||||
"name": "proj",
|
{
|
||||||
"targets": {
|
"projects": {
|
||||||
"test": {
|
"nested/nested/proj": {
|
||||||
"cache": false,
|
"metadata": {
|
||||||
"command": "./gradlew proj:test",
|
"targetGroups": {
|
||||||
"dependsOn": [
|
"Test": [
|
||||||
"classes",
|
"test-ci--aTest",
|
||||||
],
|
"test-ci--bTest",
|
||||||
"inputs": [
|
"test-ci--cTests",
|
||||||
"default",
|
"test-ci",
|
||||||
"^production",
|
"test",
|
||||||
],
|
|
||||||
"metadata": {
|
|
||||||
"help": {
|
|
||||||
"command": "./gradlew help --task proj:test",
|
|
||||||
"example": {
|
|
||||||
"options": {
|
|
||||||
"args": [
|
|
||||||
"--rerun",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"technologies": [
|
|
||||||
"gradle",
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
"technologies": [
|
||||||
|
"gradle",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"test-ci": {
|
"name": "proj",
|
||||||
"cache": true,
|
"targets": {
|
||||||
"dependsOn": [
|
"test": {
|
||||||
{
|
"cache": false,
|
||||||
"params": "forward",
|
"command": "./gradlew proj:test",
|
||||||
"projects": "self",
|
"dependsOn": [
|
||||||
"target": "test-ci--test",
|
"classes",
|
||||||
},
|
],
|
||||||
{
|
"inputs": [
|
||||||
"params": "forward",
|
"default",
|
||||||
"projects": "self",
|
"^production",
|
||||||
"target": "test-ci--test1",
|
],
|
||||||
},
|
"metadata": {
|
||||||
],
|
"help": {
|
||||||
"executor": "nx:noop",
|
"command": "./gradlew help --task proj:test",
|
||||||
"inputs": [
|
"example": {
|
||||||
"default",
|
"options": {
|
||||||
"^production",
|
"args": [
|
||||||
],
|
"--rerun",
|
||||||
"metadata": {
|
],
|
||||||
"description": "Runs Gradle Tests in CI",
|
},
|
||||||
"help": {
|
|
||||||
"command": "./gradlew help --task proj:test",
|
|
||||||
"example": {
|
|
||||||
"options": {
|
|
||||||
"args": [
|
|
||||||
"--rerun",
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"technologies": [
|
||||||
|
"gradle",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"nonAtomizedTarget": "test",
|
|
||||||
"technologies": [
|
|
||||||
"gradle",
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
"test-ci": {
|
||||||
"test-ci--test": {
|
"cache": true,
|
||||||
"cache": true,
|
"dependsOn": [
|
||||||
"command": "./gradlew proj:test --tests test",
|
{
|
||||||
"dependsOn": [
|
"params": "forward",
|
||||||
"classes",
|
"projects": "self",
|
||||||
],
|
"target": "test-ci--aTest",
|
||||||
"inputs": [
|
},
|
||||||
"default",
|
{
|
||||||
"^production",
|
"params": "forward",
|
||||||
],
|
"projects": "self",
|
||||||
"metadata": {
|
"target": "test-ci--bTest",
|
||||||
"description": "Runs Gradle test nested/nested/proj/src/test/java/test/test.java in CI",
|
},
|
||||||
"help": {
|
{
|
||||||
"command": "./gradlew help --task proj:test",
|
"params": "forward",
|
||||||
"example": {
|
"projects": "self",
|
||||||
"options": {
|
"target": "test-ci--cTests",
|
||||||
"args": [
|
},
|
||||||
"--rerun",
|
],
|
||||||
],
|
"executor": "nx:noop",
|
||||||
|
"inputs": [
|
||||||
|
"default",
|
||||||
|
"^production",
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "Runs Gradle Tests in CI",
|
||||||
|
"help": {
|
||||||
|
"command": "./gradlew help --task proj:test",
|
||||||
|
"example": {
|
||||||
|
"options": {
|
||||||
|
"args": [
|
||||||
|
"--rerun",
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"nonAtomizedTarget": "test",
|
||||||
|
"technologies": [
|
||||||
|
"gradle",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"technologies": [
|
|
||||||
"gradle",
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
"test-ci--aTest": {
|
||||||
"test-ci--test1": {
|
"cache": true,
|
||||||
"cache": true,
|
"command": "./gradlew proj:test --tests aTest",
|
||||||
"command": "./gradlew proj:test --tests test1",
|
"dependsOn": [
|
||||||
"dependsOn": [
|
"classes",
|
||||||
"classes",
|
],
|
||||||
],
|
"inputs": [
|
||||||
"inputs": [
|
"default",
|
||||||
"default",
|
"^production",
|
||||||
"^production",
|
],
|
||||||
],
|
"metadata": {
|
||||||
"metadata": {
|
"description": "Runs Gradle test nested/nested/proj/src/test/java/test/aTest.java in CI",
|
||||||
"description": "Runs Gradle test nested/nested/proj/src/test/java/test/test1.java in CI",
|
"help": {
|
||||||
"help": {
|
"command": "./gradlew help --task proj:test",
|
||||||
"command": "./gradlew help --task proj:test",
|
"example": {
|
||||||
"example": {
|
"options": {
|
||||||
"options": {
|
"args": [
|
||||||
"args": [
|
"--rerun",
|
||||||
"--rerun",
|
],
|
||||||
],
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"technologies": [
|
||||||
|
"gradle",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
"technologies": [
|
},
|
||||||
"gradle",
|
"test-ci--bTest": {
|
||||||
|
"cache": true,
|
||||||
|
"command": "./gradlew proj:test --tests bTest",
|
||||||
|
"dependsOn": [
|
||||||
|
"classes",
|
||||||
],
|
],
|
||||||
|
"inputs": [
|
||||||
|
"default",
|
||||||
|
"^production",
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "Runs Gradle test nested/nested/proj/src/test/java/test/bTest.java in CI",
|
||||||
|
"help": {
|
||||||
|
"command": "./gradlew help --task proj:test",
|
||||||
|
"example": {
|
||||||
|
"options": {
|
||||||
|
"args": [
|
||||||
|
"--rerun",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"technologies": [
|
||||||
|
"gradle",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"test-ci--cTests": {
|
||||||
|
"cache": true,
|
||||||
|
"command": "./gradlew proj:test --tests cTests",
|
||||||
|
"dependsOn": [
|
||||||
|
"classes",
|
||||||
|
],
|
||||||
|
"inputs": [
|
||||||
|
"default",
|
||||||
|
"^production",
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "Runs Gradle test nested/nested/proj/src/test/java/test/cTests.java in CI",
|
||||||
|
"help": {
|
||||||
|
"command": "./gradlew help --task proj:test",
|
||||||
|
"example": {
|
||||||
|
"options": {
|
||||||
|
"args": [
|
||||||
|
"--rerun",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"technologies": [
|
||||||
|
"gradle",
|
||||||
|
],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
],
|
]
|
||||||
]
|
`);
|
||||||
`);
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -33,8 +33,10 @@ let gradleCurrentConfigHash: string;
|
|||||||
|
|
||||||
export const GRADLE_BUILD_FILES = new Set(['build.gradle', 'build.gradle.kts']);
|
export const GRADLE_BUILD_FILES = new Set(['build.gradle', 'build.gradle.kts']);
|
||||||
export const GRADLE_TEST_FILES = [
|
export const GRADLE_TEST_FILES = [
|
||||||
'**/src/test/java/**/*.java',
|
'**/src/test/java/**/*Test.java',
|
||||||
'**/src/test/kotlin/**/*.kt',
|
'**/src/test/kotlin/**/*Test.kt',
|
||||||
|
'**/src/test/java/**/*Tests.java',
|
||||||
|
'**/src/test/kotlin/**/*Tests.kt',
|
||||||
];
|
];
|
||||||
|
|
||||||
export const gradleConfigGlob = combineGlobPatterns(
|
export const gradleConfigGlob = combineGlobPatterns(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user