feat(tests): add a test injector
fixes #614 Asynchronous test should inject an AsyncTestCompleter: Before: it("async test", (done) => { // ... done(); }); After: it("async test", inject([AsyncTestCompleter], (async) => { // ... async.done(); })); Note: inject() is currently a function and the first parameter is the array of DI tokens to inject as the test function parameters. This construct is linked to Traceur limitations. The planned syntax is: it("async test", @Inject (async: AsyncTestCompleter) => { // ... async.done(); });
This commit is contained in:
@ -2,6 +2,8 @@ import 'package:guinness/guinness.dart';
|
||||
import 'package:unittest/unittest.dart' as unit;
|
||||
import 'package:angular2/src/dom/browser_adapter.dart';
|
||||
|
||||
import 'package:angular2/src/test_lib/test_lib.dart' show testSetup;
|
||||
|
||||
main() {
|
||||
BrowserDomAdapter.makeCurrent();
|
||||
unit.filterStacks = true;
|
||||
@ -12,6 +14,8 @@ main() {
|
||||
|
||||
guinness.autoInit = false;
|
||||
guinness.initSpecs();
|
||||
|
||||
testSetup();
|
||||
}
|
||||
|
||||
_printWarnings () {
|
||||
@ -24,4 +28,4 @@ _printWarnings () {
|
||||
if (info.exclusiveDescribes.isNotEmpty) {
|
||||
print("WARN: ddescribe caused some tests to be excluded");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user