carbon-design-system / carbon-components-angular

An Angular implementation of the Carbon Design System for IBM.
https://angular.carbondesignsystem.com
Apache License 2.0
529 stars 301 forks source link

Angular problem when upgrade form 14 to 18: Module '"@angular/core/testing"' has no exported member 'async' #2941

Closed zosmf-Mira closed 2 months ago

zosmf-Mira commented 2 months ago

./src/polyfills.ts:1:0-27 - Error: Module not found: Error: Package path ./dist/zone is not exported from package /Users/yuanyuan/Documents/GitHub_UI/zmfui_diagnosis/node_modules/zone.js (see exports field in /Users/yuanyuan/Documents/GitHub_UI/zmfui_diagnosis/node_modules/zone.js/package.json)

Error: node_modules/zmf-common/src/app/Test/test.component.spec.ts:1:10 - error TS2305: Module '"@angular/core/testing"' has no exported member 'async'.

1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';

"zmf-common" is a project owned by my team(and I could change it's code if need), it works well from itself side, but it bop up error when I from my project after I upgrade angular from 14 to 18, could you please help address it? As it is block our project, so if you could address it ASAP I'll very appreciate!

below is my environment. { "name": "diagnosticsassistant", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "pkg-build": "ng build diagnosticsassistant --base-href /zosmf/diagnostics/dist/", "xdeploy": "chmod 755 xdeploy.sh && xdeploy.sh", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^18.1.0", "@angular/cdk": "^18.1.0", "@angular/common": "^18.1.0", "@angular/compiler": "^18.1.0", "@angular/core": "^18.1.0", "@angular/forms": "^18.1.0", "@angular/material": "^18.1.0", "@angular/platform-browser": "^18.1.0", "@angular/platform-browser-dynamic": "^18.1.0", "@angular/router": "^18.1.0", "@carbon/colors": "^11.14.0", "@carbon/elements": "^11.22.0", "@carbon/grid": "^11.13.0", "@carbon/icons": "^11.44.1", "@carbon/layout": "^11.13.0", "@carbon/motion": "^11.10.0", "@carbon/styles": "^1.60.1", "@carbon/themes": "^11.18.0", "@ngx-translate/core": "^15.0.0", "@ngx-translate/http-loader": "^8.0.0", "@types/file-saver": "^2.0.5", "carbon-components": "^11.48.1", "carbon-components-angular": "^5.27.3", "file-saver": "^2.0.5", "jquery": "^3.6.0", "karma-coverage": "^2.2.0", "rxjs": "^7.8.1", "rxjs-compat": "6.6.7", "tslib": "^2.6.3", "zmf-common": "git+https://ddfe8970bb4fcfec305a7eb1e5bea699817d3b36:x-oauth-basic@github.ibm.com/zosdev/zmfui_common.git", "zone.js": "^0.14.7" }, "devDependencies": { "@angular-devkit/build-angular": "^18.1.0", "@angular/cli": "^18.1.0", "@angular/compiler-cli": "^18.1.0", "@angular/language-service": "^18.1.0", "@types/jasmine": "^5.1.4", "@types/jasminewd2": "^2.0.13", "@types/node": "^20.14.11", "codelyzer": "^6.0.2", "jasmine-core": "^5.1.2", "jasmine-spec-reporter": "^7.0.0", "karma": "^6.4.3", "karma-chrome-launcher": "^3.2.0", "karma-coverage-istanbul-reporter": "^3.0.3", "karma-jasmine": "^4.0.2", "karma-jasmine-html-reporter": "^2.1.0", "protractor": "^7.0.0", "ts-node": "^10.9.2", "tslint": "^6.1.3", "typescript": "^5.5.3" }, "browserslist": [ "> 0.5%", "last 2 versions", "Firefox ESR", "not dead", "not IE 9-11", "not ios_saf 15.2-15.3" ] }

Describe in detail the issue you're having.

Is this a feature request (new component, new icon), a bug, or a general issue?

Is this issue related to a specific component?

What did you expect to happen? What happened instead? What would you like to see changed?

What browser are you working in?

What version of the Carbon Design System are you using?

What offering/product do you work on? Any pressing ship or release dates we should be aware of?

Steps to reproduce the issue

  1. Step one
  2. Step two
  3. Step three
  4. etc.

Additional information

zosmf-Mira commented 2 months ago

I changed it from async to fakeAsync, problem fixed. However, I am not sure fakeAsync is the correct one or not because I see another ...Async export module. Could you also help explain it if possible.