Skip to content

Commit

Permalink
build: work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
khalilou88 committed Jan 17, 2024
1 parent c0bec7a commit 3fcafca
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 193 deletions.
1 change: 1 addition & 0 deletions .github/workflows/plugin-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- nx-gradle micronaut e2e
- nx-gradle micronaut kotlin dsl e2e
- nx-gradle all e2e
- nx-gradle version-catalog e2e
- nx-gradle all kotlin dsl e2e
- nx-gradle quarkus e2e
- nx-gradle quarkus kotlin dsl e2e
Expand Down
17 changes: 0 additions & 17 deletions testing-projects/e2e/nx-gradle-catalog-e2e/jest.config.js

This file was deleted.

18 changes: 0 additions & 18 deletions testing-projects/e2e/nx-gradle-catalog-e2e/project.json

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions testing-projects/e2e/nx-gradle-catalog-e2e/tsconfig.json

This file was deleted.

9 changes: 0 additions & 9 deletions testing-projects/e2e/nx-gradle-catalog-e2e/tsconfig.spec.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import {
addTmpToGitignore,
createTestWorkspace,
removeTmpFromGitignore,
} from '@jnxplus/internal/testing';
import {
checkFilesExist,
readJson,
runNxCommandAsync,
uniq,
} from '@nx/plugin/testing';
import { execSync } from 'child_process';
import { rmSync } from 'fs';

describe('nx-gradle version-catalog e2e', () => {
let workspaceDirectory: string;
const isCI =
process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true';
const rootProjectName = uniq('root-project-');

beforeAll(async () => {
workspaceDirectory = createTestWorkspace();

// The plugin has been built and published to a local registry in the jest globalSetup
// Install the plugin built with the latest source code into the test repo
execSync(`npm install -D @jnxplus/nx-gradle@e2e`, {
cwd: workspaceDirectory,
stdio: 'inherit',
env: process.env,
});

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();
}
// Cleanup the test project
rmSync(workspaceDirectory, {
recursive: true,
force: true,
});
});

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();
}, 120000);

it('shoud works', async () => {
const name = uniq('app-');

await runNxCommandAsync(`generate @jnxplus/nx-gradle:app ${name}`);
}, 240000);
});

0 comments on commit 3fcafca

Please sign in to comment.