angular / angular-cli

CLI tool for Angular
https://cli.angular.dev
MIT License
26.78k stars 11.98k forks source link

Incompatibility between @angular-devkit/build-angular and pa11y #13043

Closed mark-norgate-landg closed 5 years ago

mark-norgate-landg commented 5 years ago

Bug Report or Feature Request (mark with an x)

- [ x ] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ x ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node version 10.13.0 npm version 6.4.1 Windows 7 Enterprise SP1

Repro steps

package.json:

{
  "name": "some-project",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "start:jenkins-test-server": "ng serve --port $JENKINS_PORT",
    "a11y": "node a11y/pa11y.config.js",
    "screenshot-comparison": "node screenshot-comparison/wraith-setup.js && wraith capture screenshot-comparison/wraith.config.yaml",
    "build": "ng build",
    "build:prod": "ng build --prod",
    "bdd": "rimraf cucumber/build && tsc -p cucumber && protractor cucumber/build/protractor.conf.js",
    "bdd-parallel": "rimraf cucumber/build && tsc -p cucumber && protractor cucumber/build/protractor.conf.parallel.js",
    "bdd-parallel-retry-failures": "rimraf cucumber/build && tsc -p cucumber && protractor-flake --node_modules/.bin/protractor --parser cucumber --node-bin node --max-attempts=2 -- ./cucumber/build/protractor.conf.parallel.js",
    "bdd-debug-vscode": "rimraf cucumber/build && tsc -p cucumber",
    "bdd-debug-devtools": "node --inspect-brk ./node_modules/protractor/bin/protractor ./cucumber/build/protractor.conf.js",
    "test": "ng test --browsers Chrome",
    "test:headless": "ng test --browsers ChromeHeadlessNoSandbox --watch=false",
    "test:bdd": "npm run webdriver && start-server-and-test start:jenkins-test-server $JENKINS_PORT bdd",
    "test:bdd-local": "cross-env NO_PROXY=localhost,127.0.0.1 start-server-and-test start 4200 bdd",
    "test:bdd-local-parallel": "cross-env NO_PROXY=localhost,127.0.0.1 start-server-and-test start 4200 bdd-parallel",
    "test:bdd-local-debug": "cross-env NO_PROXY=localhost,127.0.0.1 start-server-and-test start 4200 bdd-debug-devtools",
    "webdriver": "webdriver-manager update --versions.chrome=2.39 --gecko false --ignore_ssl --proxy http://10.16.0.22:443",
    "webdriver-start": "webdriver-manager start",
    "test:a11y": "start-server-and-test start:jenkins-test-server $JENKINS_PORT a11y",
    "test:a11y-local": "start-server-and-test start 4200 a11y",
    "test:screenshot-comparison": "start-server-and-test start:jenkins-test-server $JENKINS_PORT screenshot-comparison",
    "test:screenshot-comparison-local": "cross-env NO_PROXY=localhost,127.0.0.1 start-server-and-test start 4200 screenshot-comparison",
    "e2e": "ng e2e --webdriver-update=false --dev-server-target=",
    "test:e2e": "npm run webdriver && start-server-and-test start:jenkins-test-server $JENKINS_PORT e2e",
    "test:e2e-local": "cross-env NO_PROXY=localhost,127.0.0.1 start-server-and-test start 4200 e2e",
    "lint": "npm run tslint && npm run htmlhint && npm run stylelint",
    "tslint": "ng lint",
    "htmlhint": "htmlhint --config .htmlhintrc \"src/app/**/*.html\"",
    "stylelint": "stylelint \"src/**/*.scss\""
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^7.0.0",
    "@angular/cdk": "^7.0.0",
    "@angular/common": "^7.0.0",
    "@angular/compiler": "^7.0.0",
    "@angular/core": "^7.0.0",
    "@angular/forms": "^7.0.0",
    "@angular/http": "^7.0.0",
    "@angular/platform-browser": "^7.0.0",
    "@angular/platform-browser-dynamic": "^7.0.0",
    "@angular/pwa": "^0.8.7",
    "@angular/router": "^7.0.0",
    "@angular/service-worker": "^7.0.0",
    "@ngrx/effects": "^6.1.0",
    "@ngrx/router-store": "^6.1.0",
    "@ngrx/store": "^6.1.0",
    "@ngrx/store-devtools": "^6.1.0",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.4",
    "keyboard-focus": "^1.0.1",
    "landg-dls": "git+ssh://git@10.136.69.221:7999/ft/landg-dls.git#v1.4.2",
    "ngrx-store-freeze": "^0.2.4",
    "protractor-flake": "^3.3.0",
    "rxjs": "~6.3.3",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.10.6",
    "@angular/cli": "~7.0.1",
    "@angular/compiler-cli": "^7.0.0",
    "@angular/language-service": "^7.0.3",
    "@types/chai": "^4.1.7",
    "@types/chai-as-promised": "^7.1.0",
    "@types/cucumber": "^4.0.4",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^8.9.5",
    "assert": "^1.4.1",
    "casperjs": "^1.1.4",
    "chai": "^4.2.0",
    "chai-as-promised": "^7.1.1",
    "codelyzer": "~4.3.0",
    "cross-env": "^5.2.0",
    "cucumber": "^5.0.2",
    "cucumber-html-report": "^0.6.5",
    "cucumber-html-reporter": "^4.0.4",
    "expect": "^23.6.0",
    "fs-extra": "^7.0.0",
    "htmlhint": "^0.10.1",
    "jasmine-core": "~2.99.1",
    "jasmine-marbles": "^0.4.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "mdn-polyfills": "^5.13.0",
    "mergejson": "^1.1.0",
    "ng2-cookies": "^1.0.12",
    "node-sass": "^4.10.0",
    "npm-audit-html": "^1.1.0",
    "pa11y": "^5.1.0",
    "path": "^0.12.7",
    "protractor": "^5.4.1",
    "protractor-cucumber-framework": "^6.1.1",
    "protractor-multiple-cucumber-html-reporter-plugin": "^1.8.0",
    "start-server-and-test": "^1.7.4",
    "stylelint": "^9.5.0",
    "stylelint-config-standard": "^18.2.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.1.3"
  }
}

running:

> start-server-and-test start:jenkins-test-server $JENKINS_PORT a11y
> ng serve --port $JENKINS_PORT

causes the issue.

When using version 0.8.0 of @angular-devkit/build-angular", we run into problems with our PWA app. At runtime, it complains that it can't find the PWA scripts. Updating to version 0.10.6 fixes this issue, but this causes the a11y tests to fail n the Jenkins pipeline. The a11y tests work fine when at version 0.8.0.

The log given by the failure

The Jenkins log looks like this:

[workspace] Running shell script
+ npm run test:a11y

> some-project@0.0.0 test:a11y /var/lib/jenkins/jobs/Compute/jobs/some-project-frontend/branches/bug-DWP-520.00rn7g/workspace
> start-server-and-test start:jenkins-test-server $JENKINS_PORT a11y

starting server using command "npm run start:jenkins-test-server"
and when url "http://localhost:4000" is responding
running tests using command "a11y"

> some-project@0.0.0 start:jenkins-test-server /var/lib/jenkins/jobs/Compute/jobs/some-project/branches/bug-DWP-520.00rn7g/workspace
> ng serve --port $JENKINS_PORT

** Angular Live Development Server is listening on localhost:4000, open your browser on http://localhost:4000/ **

Date: 2018-11-23T12:08:18.519Z
Hash: 84a75b28068bff1b0d74
Time: 20265ms
chunk {main} main.js, main.js.map (main) 280 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 427 kB [initial] [rendered]
chunk {product-product-module} product-product-module.js, product-product-module.js.map (product-product-module) 56.5 kB  [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 9.05 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 191 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 5.52 MB [initial] [rendered]
ℹ 「wdm」: Compiled successfully.

...but after this it hangs and we have to abort the process.

Desired functionality

We would like the a11y tests to run in our Jenkins pipeline using a version of @angular-devkit/build-angular" that works with the PWA.

alan-agius4 commented 5 years ago

Hi, this is expected ng serve will launch a dev server, which will not terminate unless you forcefully terminate it. This is the same behaviour as other http servers, they will run until they are killed.

mark-norgate-landg commented 5 years ago

This is definitely still an issue. If we use version 0.8.0 of @angular-devkit/build-angular, it passes through Jenkins without any problem. It runs the a11y tests and moves on successfully. However, this version of the package causes issues with PWA so we have upgraded to 0.10.0; and now 0.11.0. Both of these issues cause the Jenkins pipeline to hang on the a11y tests.

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.