-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular/cli): favor project in cwd when running architect commands
When running architect command such as `ng build`, `ng test`, `ng lint`... and no project is provided as a positional argument. The project in the current working directory is favored instead of the configured as default project.
- Loading branch information
1 parent
ca40125
commit 054ae02
Showing
2 changed files
with
25 additions
and
8 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
21 changes: 21 additions & 0 deletions
21
tests/legacy-cli/e2e/tests/commands/builder-project-by-cwd.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,21 @@ | ||
import { join } from 'path'; | ||
import { expectFileToExist } from '../../utils/fs'; | ||
import { ng } from '../../utils/process'; | ||
|
||
export default async function () { | ||
await ng('generate', 'app', 'second-app', '--skip-install'); | ||
await ng('generate', 'app', 'third-app', '--skip-install'); | ||
const startCwd = process.cwd(); | ||
|
||
try { | ||
// When no project is provided it should favor the project that is located in the current working directory. | ||
process.chdir(join(startCwd, 'projects/second-app')); | ||
await ng('build', '--configuration=development'); | ||
|
||
process.chdir(startCwd); | ||
await expectFileToExist('dist/second-app'); | ||
} finally { | ||
// restore path | ||
process.chdir(startCwd); | ||
} | ||
} |