build(bazel): re-enable packages/upgrade/test:test_web test with static_files in ts_web_test_suite (#24214)

PR Close #24214
This commit is contained in:
Greg Magolan 2018-05-30 23:49:37 -07:00 committed by Victor Berchet
parent 5f178f3a5a
commit 68a799e950
4 changed files with 17 additions and 10 deletions

View File

@ -48,10 +48,11 @@ filegroup(
) )
filegroup( filegroup(
name = "angularjs", name = "angularjs_scripts",
# do not sort
srcs = [ srcs = [
"//:node_modules/angular/angular.js", "//:node_modules/angular-1.5/angular.js",
"//:node_modules/angular-mocks-1.5/angular-mocks.js",
"//:node_modules/angular-mocks/angular-mocks.js", "//:node_modules/angular-mocks/angular-mocks.js",
"//:node_modules/angular/angular.js",
], ],
) )

View File

@ -94,6 +94,16 @@ module.exports = function(config) {
'**/*.js': ['sourcemap'], '**/*.js': ['sourcemap'],
}, },
// Bazel inter-op: Allow tests to request resources from either
// /base/node_modules/path/to/thing
// or
// /base/angular/node_modules/path/to/thing
// This can be removed when all karma tests are run under Bazel, then we
// don't need this entire config file.
proxies: {
'/base/angular/': '/base/',
},
reporters: ['internal-angular'], reporters: ['internal-angular'],
sauceLabs: { sauceLabs: {
testName: 'Angular2', testName: 'Angular2',

View File

@ -20,13 +20,9 @@ ts_library(
ts_web_test_suite( ts_web_test_suite(
name = "test_web", name = "test_web",
bootstrap = [ static_files = [
# "//:angularjs", "//:angularjs_scripts",
], ],
# Disable since tests need to request different AngularJS versions at
# runtime, which is not yet supported.
# (Related issue: https://github.com/bazelbuild/rules_typescript/issues/131)
tags = ["manual"],
deps = [ deps = [
":test_lib", ":test_lib",
], ],

View File

@ -28,7 +28,7 @@ export function createWithEachNg1VersionFn(setNg1: typeof setAngularJSGlobal) {
.reduce( .reduce(
(prev, file) => prev.then(() => new Promise<void>((resolve, reject) => { (prev, file) => prev.then(() => new Promise<void>((resolve, reject) => {
const script = document.createElement('script'); const script = document.createElement('script');
script.src = `base/node_modules/${file}`; script.src = `base/angular/node_modules/${file}`;
script.onerror = reject; script.onerror = reject;
script.onload = () => { script.onload = () => {
document.body.removeChild(script); document.body.removeChild(script);