Unit Testing TypeError: "jit__object_Object_54 is not a constructor"


#1

Hey guys, i have follwed the https://github.com/ionic-team/ionic-unit-testing-example repo for unit testing, but it doesnt quite work for me…

My Package:
“scripts”: {
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”,
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”,
“test”: “karma start ./test-config/karma.conf.js”,
“test-ci”: “karma start ./test-config/karma.conf.js --single-run”,
“test-coverage”: “karma start ./test-config/karma.conf.js --coverage”,
“e2e”: “npm run e2e-update && npm run e2e-test”,
“e2e-test”: “protractor ./test-config/protractor.conf.js”,
“e2e-update”: “webdriver-manager update --standalone false --gecko false”
},
“dependencies”: {
"@angular/common": “4.1.3”,
"@angular/compiler": “4.1.3”,
"@angular/compiler-cli": “4.1.3”,
"@angular/core": “4.1.3”,
"@angular/forms": “4.1.3”,
"@angular/http": “4.1.3”,
"@angular/platform-browser": “4.1.3”,
"@angular/platform-browser-dynamic": “4.1.3”,
"@ionic-native/barcode-scanner": “4.3.1”,
"@ionic-native/camera": “^4.2.1”,
"@ionic-native/core": “^3.12.1”,
"@ionic-native/date-picker": “^4.3.1”,
"@ionic-native/fcm": “4.3.2”,
"@ionic-native/file": “^4.4.2”,
"@ionic-native/file-transfer": “^4.4.2”,
"@ionic-native/google-plus": “^4.3.0”,
"@ionic-native/keyboard": “^4.3.2”,
"@ionic-native/splash-screen": “3.12.1”,
"@ionic-native/status-bar": “^3.12.1”,
"@ionic/storage": “2.0.1”,
“angularfire2”: “5.0.0-rc.3”,
“cordova-android”: “^6.3.0”,
“cordova-browser”: “^4.1.0”,
“cordova-plugin-camera”: “^2.4.1”,
“cordova-plugin-compat”: “^1.2.0”,
“cordova-plugin-console”: “^1.0.5”,
“cordova-plugin-datepicker”: “^0.9.3”,
“cordova-plugin-device”: “^1.1.4”,
“cordova-plugin-fcm”: “^2.1.2”,
“cordova-plugin-file”: “^5.0.0”,
“cordova-plugin-file-transfer”: “^1.7.0”,
“cordova-plugin-googleplus”: “^5.1.1”,
“cordova-plugin-splashscreen”: “^4.0.3”,
“cordova-plugin-statusbar”: “^2.2.2”,
“cordova-plugin-whitelist”: “git+https://github.com/apache/cordova-plugin-whitelist.git”,
“dexie”: “2.0.1”,
“firebase”: “4.6.0”,
“ionic-angular”: “3.4.2”,
“ionic-image-loader”: “^4.2.1”,
“ionic-img-viewer”: “2.7.3”,
“ionic-plugin-deeplinks”: “^1.0.14”,
“ionic-plugin-keyboard”: “^2.2.1”,
“ionicons”: “3.0.0”,
“ng-elastic”: “^1.0.0-beta.5”,
“phonegap-plugin-barcodescanner”: “^6.0.0”,
“rxjs”: “5.4.0”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.18”
},
“devDependencies”: {
"@angular/cli": “^1.1.2”,
"@ionic/app-scripts": “2.1.4”,
"@types/jasmine": “^2.5.41”,
"@types/node": “^7.0.8”,
“angular2-template-loader”: “^0.6.2”,
“html-loader”: “^0.4.5”,
“istanbul-instrumenter-loader”: “^3.0.0”,
“jasmine”: “^2.5.3”,
“jasmine-spec-reporter”: “^4.1.0”,
“karma”: “^1.5.0”,
“karma-chrome-launcher”: “^2.0.0”,
“karma-coverage-istanbul-reporter”: “^1.3.0”,
“karma-jasmine”: “^1.1.0”,
“karma-jasmine-html-reporter”: “^0.2.2”,
“karma-sourcemap-loader”: “^0.3.7”,
“karma-webpack”: “^2.0.3”,
“null-loader”: “^0.1.1”,
“protractor”: “^5.1.1”,
“ts-loader”: “^2.0.3”,
“ts-node”: “^3.0.2”,
“typescript”: “2.3.4”
},

Ionic Info:

@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 3.4.2

System:

Android SDK Tools : 26.1.1
Node              : v8.9.1
npm               : 5.5.1
OS                : Windows 10

This is my app.component.spec.ts :

so if i do “npm run test” the setup works but a to me very weird error occurrs… :

not really sure what this means… can s1 help me please :slight_smile: ?

Thanks for your answers!