Rémi Rousselet
Rémi Rousselet

Reputation: 276881

Running tests on angulardart 5

Im trying angulardart 5 (alpha).

To have a "good enough" base, I started of by cloning the example from angular_examples

The problem is that README and docs are currently not updated with the new command to use.

Considering pub serve became pub run build_runner serve, I expected the test command to be pub run build_runner test. But when I use this on angular_examples I either get a "No tests ran". Or a crash saying :

Unable to spawn isolate: The built-in library 'dart:html' is not available on the stand-alone VM.

Same goes for pub run angular_test --verbose. Which gives the same crash on dart:html.


So, what is the correct command you need to use to run tests on angulardart 5 ?

Upvotes: 1

Views: 255

Answers (1)

Patrice Chalin
Patrice Chalin

Reputation: 16100

To run tests use:

pub run build_runner test -- -p chrome

Here is an example of running tests for toh-0:

toh-0 > pub run build_runner test -- -p chrome
[INFO] Entrypoint: Generating build script completed, took 220ms
[INFO] BuildDefinition: Reading cached asset graph completed, took 264ms
[INFO] BuildDefinition: Checking for updates since last build completed, took 377ms
[INFO] Build: Running build completed, took 112ms
[INFO] Build: Caching finalized dependency graph completed, took 114ms
[INFO] CreateOutputDir: Creating merged output dir `/var/folders/cl/hfrjvtvx6bl6t3m8tc1v9xf40000gq/T/build_runner_testoMQzB9/` completed, took 1.8s
[INFO] CreateOutputDir: Writing asset manifest completed, took 2ms
[INFO] Build: Succeeded after 2.0s with 0 outputs
Running tests...

00:01 +3: All tests passed!   

Tests for the other tutorial parts cannot currently be run. You can use https://github.com/dart-lang/site-webdev/issues/1277 to track the progress for those tests.

Upvotes: 4

Related Questions