angular2_testing 2.0.0-beta.17

  • Installing
  • Versions
  • 0

Contains helpers to run unit tests for angular2 components and injectables, backed by the package:test library.


Update the dev dependencies in your pubspec.yaml to include the angular testing and test packages:

  test: '^0.12.6'
  angular2_testing: any

Then in your test files, use angular2_testing helpers in place of setUp and test:

import 'package:test/test.dart';
import 'package:angular2_testing/angular2_testing.dart';

void main() {
  // This must be called at the beginning of your tests.

  // Initialize the injection tokens you will use in your tests.
  setUpProviders(() => [provide(MyToken, useValue: 'my string'), TestService]);

  // You can then get tokens from the injector via ngSetUp and ngTest.
  ngSetUp((TestService testService) {

  ngTest('can grab injected values', (@Inject(MyToken) token, TestService testService) {
    expect(token, equals('my string'));
    expect(testService.status, equals('ready'));


A sample test is available in test/angular2_testing_test.dart.

1. Depend on it

Add this to your package's pubspec.yaml file:

  angular2_testing: "^2.0.0-beta.17"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:angular2_testing/angular2_testing.dart';
Version Uploaded Documentation Archive
2.0.0-beta.17 Apr 28, 2016 Go to the documentation of angular2_testing 2.0.0-beta.17 Download angular2_testing 2.0.0-beta.17 archive
2.0.0-beta.16 Apr 26, 2016 failed Download angular2_testing 2.0.0-beta.16 archive
2.0.0-beta.15 Apr 13, 2016 failed Download angular2_testing 2.0.0-beta.15 archive
2.0.0-beta.14 Apr 7, 2016 failed Download angular2_testing 2.0.0-beta.14 archive
2.0.0-beta.13 Mar 31, 2016 failed Download angular2_testing 2.0.0-beta.13 archive
2.0.0-beta.12 Mar 24, 2016 failed Download angular2_testing 2.0.0-beta.12 archive
2.0.0-beta.11 Mar 18, 2016 failed Download angular2_testing 2.0.0-beta.11 archive
2.0.0-beta.10 Mar 17, 2016 failed Download angular2_testing 2.0.0-beta.10 archive
2.0.0-beta.9 Mar 9, 2016 failed Download angular2_testing 2.0.0-beta.9 archive
2.0.0-beta.8 Mar 2, 2016 failed Download angular2_testing 2.0.0-beta.8 archive

All 25 versions...


We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
0 / 100
Reflects how tidy and up-to-date the package is. [more]
0 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: unsure

Error(s) prevent platform classification:

Error(s) in lib/angular2_testing.dart: Target of URI doesn't exist: 'package:test/test.dart'.


  • Fix platform conflicts.

    Error(s) prevent platform classification:

    Error(s) in lib/angular2_testing.dart: Target of URI doesn't exist: 'package:test/test.dart'.

  • Maintain

    Changelog entries help clients to follow the progress in your code.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 8 errors 1 hint.

    Make sure that the imported libraries are not in conflict. Error(s) in lib/angular2_testing.dart: Target of URI doesn't exist: 'package:test/test.dart'.

  • Package is pre-release.

    Pre-release versions should be used with caution, their API may change in breaking ways.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use angular2_testing.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.10.0 <2.0.0
angular2 2.0.0-beta.17 2.0.0-beta.17 3.1.0+1
Transitive dependencies
analyzer 0.27.3 0.31.1
args 0.13.7 1.4.2
async 2.0.6
barback 0.15.2+15
build 0.12.2
charcode 1.1.1
cli_util 0.0.1+2 0.1.2+1
code_transformers 0.4.2+3 0.5.1+4
collection 1.14.9
convert 1.1.1 2.0.1
crypto 0.9.2+1 2.0.2+1
csslib 0.13.7+1 0.14.1
dart_style 0.2.4 1.0.10
fixnum 0.10.7
func 0.1.1 1.0.0
glob 1.1.5
html 0.12.2+2 0.13.3
intl 0.12.7+1 0.15.6
logging 0.11.3+1
matcher 0.12.2
observe 0.13.5 0.15.1
package_config 0.1.5 1.0.3
path 1.5.1
petitparser 1.7.6
plugin 0.1.0 0.2.0+2
pool 1.3.4
protobuf 0.5.1 0.7.2
smoke 0.3.6+3
source_maps 0.10.4
source_span 1.4.0
stack_trace 1.9.2
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+7
when 0.2.0
which 0.1.3
yaml 2.1.13
Dev dependencies
quiver ^0.21.4
test ^0.12.6