diff --git a/package.json b/package.json index 2f87d1a64a..6ced349aa4 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@angular-devkit/core": "^7.3.2", "@angular-devkit/schematics": "^7.3.2", "@angular/bazel": "file:./tools/npm/@angular_bazel", - "@bazel/jasmine": "0.26.0", + "@bazel/jasmine": "0.27.4", "@bazel/karma": "0.27.4", "@bazel/typescript": "0.27.4", "@microsoft/api-extractor": "^7.0.21", diff --git a/tools/testing/init_node_spec.ts b/tools/testing/init_node_spec.ts index d9f256f830..0dc2b82471 100644 --- a/tools/testing/init_node_spec.ts +++ b/tools/testing/init_node_spec.ts @@ -21,7 +21,15 @@ import 'reflect-metadata/Reflect'; // jasmine_node_test under Bazel will check if `jasmineCore.boot(jasmineCore)` // has been called and re-use the env if it has. // See https://github.com/bazelbuild/rules_nodejs/pull/539 -const jasmineCore: any = require('jasmine-core'); +let jasmineCore: any = null; +try { + // Under Bazel we want to use the jasmine-core version that is + // a transive dep of @bazel/typescript. Attempt to require under + // its nested node_modules incase it was not hoisted. + jasmineCore = require('@bazel/jasmine/node_modules/jasmine-core'); +} catch (_) { + jasmineCore = require('jasmine-core'); +} jasmineCore.boot(jasmineCore); import 'zone.js/dist/jasmine-patch.js'; diff --git a/yarn.lock b/yarn.lock index 57c18ded82..703a9a433c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -127,10 +127,10 @@ resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.9.0.tgz#fd60023acd36313d304cc2f8c2e181b88b5445cd" integrity sha512-E31cefDcdJsx/oii6p/gqKZXSVw0kEg1O73DD2McFcSvnf/p1GYWcQtVgdRQmlviBEytJkJgdX8rtThitRvcow== -"@bazel/jasmine@0.26.0": - version "0.26.0" - resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-0.26.0.tgz#f7aed169b057b5af547d2573657b394ecbda0b5d" - integrity sha512-lkvzPHdbSEe1zitnV1hIBwodriXqp/ClHSZQJ5Y486UaLQ6Sm7k7gV2phOwtg7LqLVZnElZDmFLSI0/O1UYYyQ== +"@bazel/jasmine@0.27.4": + version "0.27.4" + resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-0.27.4.tgz#1b6548def3d35ed14799681cab27a01d776d2835" + integrity sha512-rFNZTFYWVSYqK5CqfBtbC7TL2FofIEYfM5Q8gWol8Lc6ChLjI5574jtmqWyJDMjRskKmJUDz4m5gaiE+BoKHeA== dependencies: jasmine "~3.3.1"