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

Need named AMD/UMD ngsummary.js files for Angular packages for ts_web_test_suite #192

Closed

Description

@gregmagolan

Currently there is no way to generate named AMD/UMD ngsummary.js files for Angular packages to be included in ts_web_test.

These files can be generated by adding

    "angularCompilerOptions": {
        "enableSummariesForJit": true
    },

to the postinstall tsconfig... but the generated files are not named AMD/UMD.

These files are needed when a component under test in a karma test (ts_web_test_suite) uses a component or directive from an Angular package. For example, if a component uses ngModel, its ngsummary.js file will import @angular/forms/forms.ngsummary.js and that file is needed by ts_web_test for the test to run.

This can be reproduced here: https://github.com/gregmagolan/angular-bazel-example/tree/karma-ngsummary-repro

Running yarn && bazel test ... will generate the following error:

HeadlessChrome 66.0.3359 (Mac OS X 10.13.4) ERROR: 'There is no timestamp for /base/angular_bazel_example/node_modules/@angular/forms/forms.ngsummary.js!'

27 04 2018 17:47:18.498:WARN [web-server]: 404: /base/angular_bazel_example/node_modules/@angular/forms/forms.ngsummary.js
HeadlessChrome 66.0.3359 (Mac OS X 10.13.4) ERROR
  Script error.
  at :0:0

If you uncomment the following in /angular.tsconfig.js:

    // Uncomment to generate xxx.ngsummary.js files in Angular packages
    // "angularCompilerOptions": {
    //     "enableSummariesForJit": true
    // },

and the following in /BUILD.bazel:

    # Uncomment to include forms ngsummary file in ts_web_test
    # "node_modules/@angular/forms/forms.ngsummary.js",

and run yarn postinstall && bazel test ... the non-named-AMD/UMD generated file will be included in ts_web_test and the test will still FAIL.

If you then manually change @angular/forms/forms.ngsummary.js to be a named-AMD/UMD module then the test will finally PASS.

Activity

  1. gregmagolan commented on Apr 27, 2018

    @gregmagolan
    ContributorAuthor
  2. gregmagolan commented on Apr 27, 2018

    @gregmagolan
    ContributorAuthor

    I committed /forms.ngsummary.js in the repro branch, which is what a named-AMD/UMD @angular/forms/forms.ngsummary.js should look like. Uncomment the above mentioned lines and manually copy the contents of /forms.ngsummary.js to /node_modules/@angular/forms/forms.ngsummary.js and the test will PASS.

  3. gregmagolan commented on Apr 27, 2018

    @gregmagolan
    ContributorAuthor

    Note. I experimented with setting the package format to UMD in the postinstall tsconfig but that broke the postinstall compile.

  4. changed the title [-]Need named AMD/UMD ngsummary.js files for Angular packages for ts_web_test[/-] [+]Need named AMD/UMD ngsummary.js files for Angular packages for ts_web_test_suite[/+] on May 31, 2018
  5. self-assigned this
    on May 31, 2018
  6. gregmagolan commented on Jun 26, 2018

    @gregmagolan
    ContributorAuthor

    This issue is resolved if angular is built from source as shown here: angular/angular-bazel-example#160

    ngModel from @angular/forms is used within HelloWorldComponent and it works in a karma test

  7. gregmagolan commented on Aug 10, 2018

    @gregmagolan
    ContributorAuthor

    Latest angular can now be build with bazel with angular being built from source. angular/angular-bazel-example#160 was merged in and https://github.com/alexeagle/angular-bazel-example is now building Angular 6.1.2.

    This is still an issue with using the mixed mode ngc/bazel with 3rd party libraries but that should be tracked with separate issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions