-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Showing
11 changed files
with
750 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { | ||
e2eCwd, | ||
exists, | ||
getPackageManagerCommand, | ||
getPublishedVersion, | ||
runCLI, | ||
} from '@nrwl/e2e/utils'; | ||
import { execSync } from 'child_process'; | ||
import { removeSync } from 'fs-extra'; | ||
|
||
describe('nx init (for NestCLI)', () => { | ||
const pmc = getPackageManagerCommand({ | ||
packageManager: 'npm', | ||
}); | ||
const projectName = 'nest-app'; | ||
const projectRoot = `${e2eCwd}/${projectName}`; | ||
const cliOptions = { cwd: projectRoot }; | ||
|
||
afterEach(() => { | ||
removeSync(projectRoot); | ||
}); | ||
|
||
it('should convert NestCLI application to Nx standalone', () => { | ||
execSync( | ||
`${pmc.runUninstalledPackage} @nestjs/cli new ${projectName} --package-manager=npm`, | ||
{ | ||
cwd: e2eCwd, | ||
encoding: 'utf-8', | ||
env: process.env, | ||
stdio: ['pipe', 'pipe', 'pipe'], | ||
} | ||
); | ||
|
||
const output = execSync( | ||
`${ | ||
pmc.runUninstalledPackage | ||
} nx@${getPublishedVersion()} init -y --cacheable=format`, | ||
{ | ||
cwd: projectRoot, | ||
encoding: 'utf-8', | ||
env: process.env, | ||
stdio: ['pipe', 'pipe', 'pipe'], | ||
} | ||
); | ||
|
||
expect(output).toContain('Enabled computation caching'); | ||
|
||
// nest-cli.json is removed | ||
expect(exists(`${projectRoot}/nest-cli.json`)).toBeFalsy(); | ||
|
||
// root nx.json exists | ||
expect(exists(`${projectRoot}/nx.json`)).toBeTruthy(); | ||
// root project.json exists | ||
expect(exists(`${projectRoot}/project.json`)).toBeTruthy(); | ||
|
||
runCLI('build', cliOptions); | ||
expect( | ||
exists(`${projectRoot}/dist/${projectName}/src/main.js`) | ||
).toBeTruthy(); | ||
|
||
// run build again for cache | ||
const buildOutput = runCLI('build', cliOptions); | ||
expect(buildOutput).toContain('Nx read the output from the cache'); | ||
}, 10000); | ||
}); |
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
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
Oops, something went wrong.