Skip to content

chore(test): add --single-run option #2841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ or `ng serve --prod` will also make use of uglifying and tree-shaking functional
ng test
```

Tests will execute after a build is executed via [Karma](http://karma-runner.github.io/0.13/index.html), and it will automatically watch your files for changes. You can run tests a single time via `--watch=false`.
Tests will execute after a build is executed via [Karma](http://karma-runner.github.io/0.13/index.html), and it will automatically watch your files for changes. You can run tests a single time via `--watch=false` or `--single-run`.

### Running end-to-end tests

Expand Down
1 change: 1 addition & 0 deletions packages/angular-cli/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const NgCliTestCommand = TestCommand.extend({
{ name: 'watch', type: Boolean, default: true, aliases: ['w'] },
{ name: 'code-coverage', type: Boolean, default: false, aliases: ['cc'] },
{ name: 'lint', type: Boolean, default: false, aliases: ['l'] },
{ name: 'single-run', type: Boolean, default: false, aliases: ['sr'] },
{ name: 'browsers', type: String },
{ name: 'colors', type: Boolean },
{ name: 'log-level', type: String },
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/tests/generate/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ export default function() {
.then(() => expectFileToExist(join(classDir, 'test-class.spec.ts')))

// Try to run the unit tests.
.then(() => ng('test', '--watch=false'));
.then(() => ng('test', '--single-run'));
}
2 changes: 1 addition & 1 deletion tests/e2e/tests/generate/component/component-basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ export default function() {
.then(() => expectFileToExist(join(componentDir, 'test-component.component.css')))

// Try to run the unit tests.
.then(() => ng('test', '--watch=false'));
.then(() => ng('test', '--single-run'));
}
2 changes: 1 addition & 1 deletion tests/e2e/tests/generate/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export default function() {
.then(() => expectFileToExist(join(interfaceDir, 'test-interface.model.ts')))

// Try to run the unit tests.
.then(() => ng('test', '--watch=false'));
.then(() => ng('test', '--single-run'));
}
2 changes: 1 addition & 1 deletion tests/e2e/tests/generate/module/module-basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export default function() {
.then(() => expectFileToExist(join(moduleDir, 'test-module.component.css')))

// Try to run the unit tests.
.then(() => ng('test', '--watch=false'));
.then(() => ng('test', '--single-run'));
}
2 changes: 1 addition & 1 deletion tests/e2e/tests/generate/module/module-routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ export default function() {
.then(() => expectFileToExist(join(moduleDir, 'test-module.component.css')))

// Try to run the unit tests.
.then(() => ng('test', '--watch=false'));
.then(() => ng('test', '--single-run'));
}
2 changes: 1 addition & 1 deletion tests/e2e/tests/generate/pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export default function() {
.then(() => expectFileToExist(join(pipeDir, 'test-pipe.pipe.spec.ts')))

// Try to run the unit tests.
.then(() => ng('test', '--watch=false'));
.then(() => ng('test', '--single-run'));
}
2 changes: 1 addition & 1 deletion tests/e2e/tests/generate/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export default function() {
.then(() => expectFileToExist(join(serviceDir, 'test-service.service.spec.ts')))

// Try to run the unit tests.
.then(() => ng('test', '--watch=false'));
.then(() => ng('test', '--single-run'));
}
2 changes: 1 addition & 1 deletion tests/e2e/tests/misc/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {ng} from '../../utils/process';


export default function() {
return ng('test', '--watch=false', '--code-coverage')
return ng('test', '--single-run', '--code-coverage')
.then(() => expectFileToExist('coverage/src/app'))
.then(() => expectFileToExist('coverage/coverage.lcov'));
}
4 changes: 3 additions & 1 deletion tests/e2e/tests/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ import {ng} from '../../utils/process';


export default function() {
return ng('test', '--watch=false');
// make sure both --watch=false and --single-run work
return ng('test', '--single-run')
.then(() => ng('test', '--watch=false'));
}