Skip to content
This repository was archived by the owner on Sep 16, 2022. It is now read-only.

Commit 073e728

Browse files
committed
Add automated testing of _tests and angular_test to travis.
* Only test on Dart stable for now. Let's get this working 1st. * Start XVFB (thanks Gary!) and download/"install" Dartium. Misc changes necessary to land this: * Renamed the generated files in test_files from .dart -> .check * Otherwise the analyzer would scream about these files locally * Reflection remover considers "main()" to be an entry-point * Removes the need for explicit @AngularEntrypoint() in tests Closes #534. PiperOrigin-RevId: 162556261
1 parent 703e5d2 commit 073e728

File tree

19 files changed

+90
-54
lines changed

19 files changed

+90
-54
lines changed

.travis.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: dart
2-
sudo: false
32

43
dart:
5-
- dev
4+
# Temporarily disabled. We only have the stable release of Dartium installed.
5+
# - dev
66
- stable
77

88
env:
@@ -12,6 +12,27 @@ env:
1212
- PKG=angular_router
1313
- PKG=angular_test
1414

15+
# We don't use the dart_task model yet (mono-repo), so this will have to do.
16+
before_install:
17+
# Add a local `bin` folder and add it to the PATH.
18+
- mkdir -p bin
19+
- export PATH="$PATH:$PWD/bin"
20+
21+
# Start UI (required for Dartium).
22+
- export DISPLAY=:99.0
23+
- sh -e /etc/init.d/xvfb start &
24+
- sleep 3
25+
26+
# Download the latest stable release of Dartium, extract it, and add a symlink to bin.
27+
- wget http://gsdview.appspot.com/dart-archive/channels/stable/release/latest/dartium/dartium-linux-x64-release.zip
28+
- unzip dartium-linux-x64-release.zip
29+
- rm dartium-linux-x64-release.zip
30+
- PATH_TO_DARTIUM=`pwd`/`echo dartium-linux-*`/chrome
31+
- ln -sv "$PATH_TO_DARTIUM" "bin/dartium"
32+
33+
# Sanity check for terminal output.
34+
- echo `which dartium`
35+
1536
script: ./tool/travis.sh
1637

1738
# Only building master means that we don't run two builds for each pull request.

_tests/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Ignore files generated by test/source_gen/template_compiler/generate.dart
2-
test/source_gen/template_compiler/test_files/**/*.template_*.dart
2+
test/source_gen/template_compiler/test_files/**/*.template_*.check

_tests/dart_test.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
presets:
22
travis:
3-
exclude_tags: codegen || failing_i302 || known_ff_failure
3+
exclude_tags: known_pub_serve_failure || failing_i302 || known_ff_failure
44
tags:
5-
# See https://github.com/dart-lang/angular2/issues/272
6-
codegen:
7-
# See https://github.com/dart-lang/angular2/issues/302
5+
# Tests that fail with pub serve/pub run test.
6+
known_pub_serve_failure:
7+
# See https://github.com/dart-lang/angular2/issues/302.
88
failing_i302:
9-
# TODO(kevmoo): Need note here
9+
# TODO(kevmoo): Need note here.
1010
known_ff_failure:

_tests/pubspec.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,17 @@ dependency_overrides:
2020
path: ../angular_compiler
2121
angular_test:
2222
path: ../angular_test
23+
# TODO: Publish a new `build_runner` to remove this override.
24+
build_barback: 0.3.0
25+
26+
transformers:
27+
- angular:
28+
entry_points: test/**_test.dart
29+
$exclude:
30+
- test/**.template.dart
31+
- test/core/reflection/reflector_test.dart
32+
- test/source_gen/template_compiler/test_files/**
33+
34+
# Allow test to proxy-load files so we can run tests w/ pub serve.
35+
- test/pub_serve:
36+
$include: test/**_test.dart

_tests/test/core/application_ref_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ void main() {
161161
throwsWith('Cannot bootstrap as there are still '
162162
'asynchronous initializers running. Wait for them using '
163163
'waitForAsyncInitializers().'));
164-
});
164+
}, tags: 'known_pub_serve_failure');
165165
});
166166
});
167167
}

_tests/test/core/linker/component_loader_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:test/test.dart';
55
import 'package:angular/angular.dart';
66
import 'package:angular_test/angular_test.dart';
77

8+
// ignore: uri_has_not_been_generated
89
import 'component_loader_test.template.dart' as ng;
910

1011
void main() {

_tests/test/core/linker/host_events_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@Tags(const ['codegen'])
1+
@Tags(const ['codegen', 'known_pub_serve_failure'])
22
@TestOn('browser && !js')
33
import 'dart:async';
44
import 'dart:html';

_tests/test/source_gen/template_compiler/generate.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Future main(List<String> args) async {
3232
],
3333
generatedExtension: updateGoldens
3434
? '.template_release.golden'
35-
: '.template_release.dart',
35+
: '.template_release.check',
3636
isStandalone: true),
3737
inputs)
3838
..addAction(
@@ -42,7 +42,7 @@ Future main(List<String> args) async {
4242
],
4343
generatedExtension: updateGoldens
4444
? '.template_debug.golden'
45-
: '.template_debug.dart',
45+
: '.template_debug.check',
4646
isStandalone: true),
4747
inputs));
4848
await build(phaseGroup, deleteFilesByDefault: updateGoldens);

_tests/test/source_gen/template_compiler/generate_template_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:test/test.dart';
66

77
import 'compare_to_golden.dart' as golden;
88

9-
String summaryExtension(String codegenMode) => '.template_$codegenMode.dart';
9+
String summaryExtension(String codegenMode) => '.template_$codegenMode.check';
1010
String goldenExtension(String codegenMode) => '.template_$codegenMode.golden';
1111

1212
/// To update the golden files, in the root angular2 directory, run

angular/lib/src/transform/reflection_remover/entrypoint_matcher.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class EntrypointMatcher {
2323
(node is! FunctionDeclaration && node is! MethodDeclaration)) {
2424
return false;
2525
}
26-
return node.metadata
27-
.any((a) => _annotationMatcher.isEntrypoint(a, _assetId));
26+
return node is FunctionDeclaration && node.name.name == 'main' ||
27+
node.metadata.any((a) => _annotationMatcher.isEntrypoint(a, _assetId));
2828
}
2929

3030
/// Gets the name assigned to the `AngularEntrypoint`.

0 commit comments

Comments
 (0)