-
Notifications
You must be signed in to change notification settings - Fork 16
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
5c91425
commit 1ec2d39
Showing
6 changed files
with
221 additions
and
26 deletions.
There are no files selected for viewing
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
140 changes: 140 additions & 0 deletions
140
testing-projects/jnxplus-smoke/tests/nx-maven/micronaut-bom.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,140 @@ | ||
import { uniq } from '@nx/plugin/testing'; | ||
import { readJson } from 'fs-extra'; | ||
|
||
import { execSync, ExecSyncOptions } from 'child_process'; | ||
import { join } from 'path'; | ||
|
||
import { dirSync } from 'tmp'; | ||
|
||
let smokeDirectory: string; | ||
let cleanup: () => void; | ||
|
||
const execSyncOptions: () => ExecSyncOptions = () => ({ | ||
cwd: join(smokeDirectory, 'test'), | ||
env: { | ||
...process.env, | ||
GIT_COMMITTER_NAME: 'Smoke Test CI', | ||
GIT_COMMITTER_EMAIL: '[email protected]', | ||
GIT_AUTHOR_NAME: 'Smoke Test CI', | ||
GIT_AUTHOR_EMAIL: '[email protected]', | ||
}, | ||
stdio: 'inherit', | ||
}); | ||
|
||
const libsParentProject = uniq('libs-parent-project-'); | ||
const appsParentProject = uniq('apps-parent-project-'); | ||
|
||
const testApp = uniq('test-app-'); | ||
const testLib = uniq('test-lib-'); | ||
|
||
const testApp2 = uniq('test-app2-'); | ||
const testLib2 = uniq('test-lib2-'); | ||
const testApp3 = uniq('test-app3-'); | ||
const testApp4 = uniq('test-app4-'); | ||
const testApp5 = uniq('test-app5-'); | ||
const testLib5 = uniq('test-lib5-'); | ||
const testApp6 = uniq('test-app6-'); | ||
|
||
describe('nx-maven micronaut bom smoke', () => { | ||
beforeEach(async () => { | ||
({ name: smokeDirectory, removeCallback: cleanup } = dirSync({ | ||
unsafeCleanup: true, | ||
})); | ||
}); | ||
|
||
afterEach(async () => { | ||
cleanup(); | ||
}); | ||
|
||
it('should work', async () => { | ||
execSync( | ||
'npx create-nx-workspace@latest test --preset empty --nxCloud false', | ||
{ | ||
cwd: smokeDirectory, | ||
env: process.env, | ||
stdio: 'inherit', | ||
}, | ||
); | ||
|
||
execSync('git init', execSyncOptions()); | ||
|
||
execSync('npm i --save-dev @jnxplus/nx-maven', execSyncOptions()); | ||
|
||
execSync('npx nx generate @jnxplus/nx-maven:init', execSyncOptions()); | ||
|
||
execSync( | ||
`npx nx generate @jnxplus/nx-maven:parent-project ${libsParentProject} --projectType library --framework micronaut`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync( | ||
`npx nx generate @jnxplus/nx-maven:parent-project ${appsParentProject} --parentProject ${libsParentProject} --framework none`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync( | ||
`npx nx g @jnxplus/nx-maven:application ${testApp} --parentProject ${appsParentProject} --framework micronaut`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync( | ||
`npx nx g @jnxplus/nx-maven:lib ${testLib} --parentProject ${libsParentProject} --projects ${testApp} --framework micronaut`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync( | ||
`npx nx g @jnxplus/nx-maven:application ${testApp2} --parentProject ${appsParentProject} --framework micronaut`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync( | ||
`npx nx g @jnxplus/nx-maven:application ${testApp3} --parentProject ${appsParentProject} --framework micronaut`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync( | ||
`npx nx g @jnxplus/nx-maven:application ${testApp4} --parentProject ${appsParentProject} --framework micronaut`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync( | ||
`npx nx g @jnxplus/nx-maven:lib ${testLib2} --parentProject ${libsParentProject} --projects ${testApp2},${testApp3},${testApp4} --framework micronaut`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync( | ||
`npx nx g @jnxplus/nx-maven:application ${testApp5} --parentProject ${appsParentProject} --framework micronaut --language kotlin`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync( | ||
`npx nx g @jnxplus/nx-maven:application ${testApp6} --parentProject ${appsParentProject} --framework micronaut --language kotlin`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync( | ||
`npx nx g @jnxplus/nx-maven:lib ${testLib5} --parentProject ${libsParentProject} --framework micronaut --language kotlin --projects ${testApp5},${testApp6}`, | ||
execSyncOptions(), | ||
); | ||
|
||
execSync(`npx nx test ${testLib}`, execSyncOptions()); | ||
|
||
execSync(`npx nx run-many --target=build --parallel=1`, execSyncOptions()); | ||
|
||
execSync(`npx nx graph --file=dep-graph.json`, execSyncOptions()); | ||
|
||
const depGraphJson = await readJson( | ||
join(smokeDirectory, 'test', 'dep-graph.json'), | ||
); | ||
expect(depGraphJson.graph.nodes[testApp]).toBeDefined(); | ||
expect(depGraphJson.graph.nodes[testLib]).toBeDefined(); | ||
|
||
expect(depGraphJson.graph.dependencies[testApp]).toContainEqual({ | ||
type: 'static', | ||
source: testApp, | ||
target: testLib, | ||
}); | ||
|
||
execSync(`git commit -am "chore: scaffold projects"`, execSyncOptions()); | ||
}, 1500000); | ||
}); |
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
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