Skip to content

Commit

Permalink
fix(e2e): fix broken test pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva committed Nov 3, 2016
1 parent 86f2a1b commit 052e2d2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/angular-cli/blueprints/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ module.exports = {
const returns = [];
const className = stringUtils.classify(`${options.entity.name}Component`);
const fileName = stringUtils.dasherize(`${options.entity.name}.component`);
const componentDir = path.relative(path.dirname(this.pathToModule), this.generatePath).toLowerCase();
const componentDir = path.relative(path.dirname(this.pathToModule), this.generatePath);
const importPath = componentDir ? `./${componentDir}/${fileName}` : `./${fileName}`;

if (!options['skip-import']) {
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-cli/blueprints/directive/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module.exports = {
const fileName = stringUtils.dasherize(`${options.entity.name}.directive`);
const fullGeneratePath = path.join(this.project.root, this.generatePath);
const moduleDir = path.parse(this.pathToModule).dir;
const relativeDir = path.relative(moduleDir, fullGeneratePath).toLowerCase();
const relativeDir = path.relative(moduleDir, fullGeneratePath);
const importPath = relativeDir ? `./${relativeDir}/${fileName}` : `./${fileName}`;

if (!options['skip-import']) {
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-cli/blueprints/pipe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module.exports = {
const fileName = stringUtils.dasherize(`${options.entity.name}.pipe`);
const fullGeneratePath = path.join(this.project.root, this.generatePath);
const moduleDir = path.parse(this.pathToModule).dir;
const relativeDir = path.relative(moduleDir, fullGeneratePath).toLowerCase();
const relativeDir = path.relative(moduleDir, fullGeneratePath);
const importPath = relativeDir ? `./${relativeDir}/${fileName}` : `./${fileName}`;

if (!options['skip-import']) {
Expand Down
7 changes: 3 additions & 4 deletions tests/e2e/tests/build/styles/styles-array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ export default function() {
.then(() => expectFileToMatch('dist/styles.bundle.js', /.upper.*.lower.*background.*#def/))

.then(() => ng('build', '--prod'))
.then(() => new Promise<string>(() =>
glob.sync('dist/styles.*.bundle.css').find(file => !!file)))
.then(() => glob.sync('dist/styles.*.bundle.css').find(file => !!file))
.then((styles) =>
expectFileToMatch(styles, 'body { background-color: blue; }')
.then(() => expectFileToMatch(styles, 'p { background-color: red; }')
expectFileToMatch(styles, /body\s*\{\s*background-color:\s*blue\s*\}/)
.then(() => expectFileToMatch(styles, /p\s*\{\s*background-color:\s*red\s*\}/)
.then(() => expectFileToMatch(styles, /.outer.*.inner.*background:\s*#[fF]+/))
.then(() => expectFileToMatch(styles, /.upper.*.lower.*background.*#def/)))
);
Expand Down
12 changes: 9 additions & 3 deletions tests/e2e/tests/generate/component/component-path-case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,22 @@ import {expectFileToExist, createDir} from '../../../utils/fs';


export default function() {
const rootDir = join('src', 'app', 'upper-dir');
const componentDir = join(rootDir.toLowerCase(), 'test-component');
const rootDir = join('src', 'app', 'Upper-Dir');
createDir(rootDir);
const componentDir = join(rootDir, 'test-component');
const componentTwoDir = join(rootDir, 'test-component-two');

return ng('generate', 'component', 'Upper-Dir', 'test-component')
return ng('generate', 'component', 'Upper-Dir/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', 'Upper-Dir/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')))

// Try to run the unit tests.
.then(() => ng('test', '--watch=false'));
Expand Down

0 comments on commit 052e2d2

Please sign in to comment.