-
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.
ci: fix component-path-case E2E test on Windows CI
Windows CI is failing when trying to use the common test cleanup routine for the `generate/component/component-path-case` E2E test. This fix manually removes the newly created directory within the test. (cherry picked from commit aec0078)
- Loading branch information
1 parent
fff75bd
commit b7a7c6c
Showing
1 changed file
with
31 additions
and
20 deletions.
There are no files selected for viewing
51 changes: 31 additions & 20 deletions
51
tests/legacy-cli/e2e/tests/generate/component/component-path-case.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 |
---|---|---|
@@ -1,27 +1,38 @@ | ||
import {join} from 'path'; | ||
import {ng} from '../../../utils/process'; | ||
import {expectFileToExist} from '../../../utils/fs'; | ||
import { join } from 'path'; | ||
import { ng } from '../../../utils/process'; | ||
import { expectFileToExist, rimraf } from '../../../utils/fs'; | ||
|
||
|
||
export default function() { | ||
export default async function () { | ||
const upperDirs = join('non', 'existing', 'dir'); | ||
const rootDir = join('src', 'app', upperDirs); | ||
|
||
const componentDir = join(rootDir, 'test-component'); | ||
const componentTwoDir = join(rootDir, 'test-component-two'); | ||
const componentDirectory = join(rootDir, 'test-component'); | ||
const componentTwoDirectory = join(rootDir, 'test-component-two'); | ||
|
||
try { | ||
// Generate a component | ||
await ng('generate', 'component', `${upperDirs}/test-component`) | ||
|
||
// Ensure component is created in the correct location relative to the workspace root | ||
await expectFileToExist(join(componentDirectory, 'test-component.component.ts')); | ||
await expectFileToExist(join(componentDirectory, 'test-component.component.spec.ts')); | ||
await expectFileToExist(join(componentDirectory, 'test-component.component.html')); | ||
await expectFileToExist(join(componentDirectory, 'test-component.component.css')); | ||
|
||
// Generate another component | ||
await ng('generate', 'component', `${upperDirs}/Test-Component-Two`); | ||
|
||
return ng('generate', 'component', `${upperDirs}/test-component`) | ||
.then(() => expectFileToExist(componentDir)) | ||
.then(() => expectFileToExist(join(componentDir, 'test-component.component.ts'))) | ||
.then(() => expectFileToExist(join(componentDir, 'test-component.component.spec.ts'))) | ||
.then(() => expectFileToExist(join(componentDir, 'test-component.component.html'))) | ||
.then(() => expectFileToExist(join(componentDir, 'test-component.component.css'))) | ||
.then(() => ng('generate', 'component', `${upperDirs}/Test-Component-Two`)) | ||
.then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.ts'))) | ||
.then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.spec.ts'))) | ||
.then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.html'))) | ||
.then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.css'))) | ||
// Ensure component is created in the correct location relative to the workspace root | ||
await expectFileToExist(join(componentTwoDirectory, 'test-component-two.component.ts')); | ||
await expectFileToExist(join(componentTwoDirectory, 'test-component-two.component.spec.ts')); | ||
await expectFileToExist(join(componentTwoDirectory, 'test-component-two.component.html')); | ||
await expectFileToExist(join(componentTwoDirectory, 'test-component-two.component.css')); | ||
|
||
// Try to run the unit tests. | ||
.then(() => ng('test', '--watch=false')); | ||
// Ensure unit test execute and pass | ||
await ng('test', '--watch=false'); | ||
} finally { | ||
// Windows CI may fail to clean up the created directory | ||
// Resolves: "Error: Running "cmd.exe /c git clean -df" returned error code 1" | ||
await rimraf(rootDir); | ||
} | ||
} |