Tests failing to run after migration from Angular 15 to Angular 16

Discussão em 'Angular' iniciado por Dronich, Novembro 18, 2024.

  1. Dronich

    Dronich Guest

    I have a more or less straightforward Angular setup, medium-scoped project. After what seemed like a trivial migration, unit tests stopped running. I've been able to bump the version of Angular straight to 18 from 15 and the application compiles and runs just fine, only tests are not working.

    I was able to isolate the issue to happening during migration from 15 to 16, but I'm at a loss regarding the root cause. Stack trace I got is the following

    > ng test --code-coverage

    ✔ Browser application bundle generation complete.
    04 11 2024 14:29:26.296:INFO [karma-server]: Karma v6.4.4 server started at http://localhost:9876/
    04 11 2024 14:29:26.299:INFO [launcher]: Launching browsers ChromeHeadlessNoSandbox with concurrency unlimited
    04 11 2024 14:29:26.305:INFO [launcher]: Starting browser ChromeHeadless
    04 11 2024 14:29:28.196:INFO [Chrome Headless 130.0.0.0 (Windows 10)]: Connected on socket E1V7ha4wgvF7g9KkAAAB with id 91378535
    Chrome Headless 130.0.0.0 (Windows 10) ERROR
    An error was thrown in afterAll
    Uncaught TypeError: Cannot read properties of undefined (reading 'slice')
    TypeError: Cannot read properties of undefined (reading 'slice')
    at Object.16741 (http://localhost:9876/_karma_webpack_/webpack:/node_modules/readable-stream/lib/_stream_writable.js:57:81)
    at exports (http://localhost:9876/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
    at Object.67306 (http://localhost:9876/_karma_webpack_/webpack:/node_modules/readable-stream/readable-browser.js:4:1)
    at require (http://localhost:9876/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
    at Object.14467 (http://localhost:9876/_karma_webpack_/webpack:/node_modules/browserify-sign/browser/index.js:5:14)
    at require (http://localhost:9876/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
    at Object.74462 (http://localhost:9876/_karma_webpack_/webpack:/node_modules/crypto-browserify/index.js:53:12)
    at require (http://localhost:9876/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
    at Object.25148 (http://localhost:9876/_karma_webpack_/webpack:/node_modules/avsc/lib/utils.js:11:14)
    at __webpack_require__ (http://localhost:9876/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
    Chrome Headless 130.0.0.0 (Windows 10): Executed 16 of 16 ERROR (0 secs / 0.081 secs)

    =============================== Coverage summary ===============================
    Statements : Unknown% ( 0/0 )
    Branches : Unknown% ( 0/0 )
    Functions : Unknown% ( 0/0 )
    Lines : Unknown% ( 0/0 )
    Chrome Headless 130.0.0.0 (Windows 10): Executed 16 of 16 ERROR (0.133 secs / 0.081 secs)
    04 11 2024 14:29:31.690:ERROR [coverage]: Chrome Headless 130.0.0.0 (Windows 10): Coverage for statements (28.08%) does not meet global threshold (96%)
    04 11 2024 14:29:31.691:ERROR [coverage]: Chrome Headless 130.0.0.0 (Windows 10): Coverage for branches (18.18%) does not meet global threshold (92%)
    04 11 2024 14:29:31.691:ERROR [coverage]: Chrome Headless 130.0.0.0 (Windows 10): Coverage for lines (28.1%) does not meet global threshold (96%)
    04 11 2024 14:29:31.692:ERROR [coverage]: Chrome Headless 130.0.0.0 (Windows 10): Coverage for functions (15.39%) does not meet global threshold (94%)

    =============================== Coverage summary ===============================
    Statements : 28.08% ( 762/2713 )
    Branches : 18.18% ( 126/693 )
    Functions : 15.39% ( 87/565 )
    Lines : 28.1% ( 747/2658 )
    ================================================================================

    Continue reading...

Compartilhe esta Página