karma-runner / karma-phantomjs-launcher

A Karma plugin. Launcher for PhantomJS.
MIT License
281 stars 131 forks source link

ng test error with PhantomJS , getting less error #219

Open bxdadwhal opened 2 years ago

bxdadwhal commented 2 years ago

error :-npm run coverage

gd@2.0.0 coverage ng test --code-coverage --reporters=coverage

⠙ Generating browser application bundles (phase: building)...19 01 2022 01:29:08.151:INFO [karma-server]: Karma v6.3.11 server started at http://localhost:9876/ 19 01 2022 01:29:08.158:INFO [launcher]: Launching browsers PhantomJS with concurrency unlimited 19 01 2022 01:29:08.183:INFO [launcher]: Starting browser PhantomJS ✔ Browser application bundle generation complete.

./src/styles.less - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): ModuleBuildError: Module build failed (from ./node_modules/@angular-devkit/build-angular/node_modules/less-loader/dist/cjs.js):

Chunk.split is not a function

at processResult (C:\Users\bdadwhal-etc\angular-migration8.1\node_modules\webpack\lib\NormalModule.js:713:19) at C:\Users\bdadwhal-etc\angular-migration8.1\node_modules\webpack\lib\NormalModule.js:819:5 at C:\Users\bdadwhal-etc\angular-migration8.1\node_modules\loader-runner\lib\LoaderRunner.js:399:11 at C:\Users\bdadwhal-etc\angular-migration8.1\node_modules\loader-runner\lib\LoaderRunner.js:251:18 at context.callback (C:\Users\bdadwhal-etc\angular-migration8.1\node_modules\loader-runner\lib\LoaderRunner.js:124:13) at Object.lessLoader (C:\Users\bdadwhal-etc\angular-migration8.1\node_modules\@angular-devkit\build-angular\node_modules\less-loader\dist\index.js:54:5) Error: src/app/citation/citation-list/citation-list.component.spec.ts:433:76 - error TS2345: Argument of type 'Observable<{}>' is not assignable to parameter of type 'void'.

433 spyOn(component['detailsService'], 'bibDetailsAction').and.returnValue(Observable.of({}));


Error: src/app/citation/store/details.service.spec.ts:59:81 - error TS2345: Argument of type 'Observable<{ bibDetails: { title: string; publishedDate: string; inventors: string[]; applicants: string[]; application: { country: string; display: string; date: string; type: string; kind: string; id: string; docKey: string; }; abstract: string; priority: any[]; }; classifications: { ...; }; }>' is not assignable to parameter of type 'Observable'.
Type '{ bibDetails: { title: string; publishedDate: string; inventors: string[]; applicants: string[]; application: { country: string; display: string; date: string; type: string; kind: string; id: string; docKey: string; }; abstract: string; priority: any[]; }; classifications: { ...; }; }' is missing the following properties from type 'BibResponse': docNumber, toDocNumber, toBibDetails, toClassifications

59 spyOn(service['citationStoreService'], 'getCitationDetail').and.returnValue(Observable.of(details));

Error: src/app/page-content/events/controller.event.spec.ts:35:68 - error TS2345: Argument of type 'Observable' is not assignable to parameter of type 'Observable'. Type 'DocNumber' is missing the following properties from type 'LookupResponse': group, title, query

35 spyOn(service['lookupEvent'], 'getObservable').and.returnValue(Observable.of(new DocNumber()));


Error: src/app/page-content/events/lookup.event.spec.ts:78:82 - error TS2345: Argument of type '{ status: number; }' is not assignable to parameter of type 'Expected'.
Type '{ status: number; }' is missing the following properties from type '{ readonly name: ExpectedRecursive<"HttpErrorResponse">; readonly message: ExpectedRecursive; readonly error:
any; readonly ok: ExpectedRecursive; ... 4 more ...; readonly type: ExpectedRecursive<...>; }': name, message, error, ok, and 4 more.

78 expect(service['applicationErrorEvent']['lookupError']).toHaveBeenCalledWith(httpError);

./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].rules[0].oneOf[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[7].rules[0].oneOf[1].use[2]!./node_modules/@angular-devkit/build-angular/node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[7].rules[1].use[0]!./src/styles.less - Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/node_modules/less-loader/dist/cjs.js):

Chunk.split is not a function

bxdadwhal commented 2 years ago

package.json :- { "name": "gd", "version": "2.0.0", "engines": { "node": "14.17.3", "npm": "8.3.0" }, "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build --prod", "test": "ng test", "lint": "ng lint --type-check", "e2e": "ng e2e", "serve": "ng serve --proxy-config proxy.conf.json", "coverage": "ng test --code-coverage --reporters=coverage" }, "private": true, "dependencies": { "@angular/animations": "~12.2.0", "@angular/common": "~12.2.0", "@angular/compiler": "~12.2.0", "@angular/core": "~12.2.0", "@angular/forms": "~12.2.0", "@angular/material": "^12.2.0", "@angular/platform-browser": "~12.2.0", "@angular/platform-browser-dynamic": "~12.2.0", "@angular/router": "~12.2.0", "@babel/compat-data": "^7.8.0", "@ngrx/store": "^9.2.0", "@types/jasminewd2": "^2.0.3", "core-js": "2.5.1", "dexie": "2.0.1", "immutable": "3.8.2", "karma-typescript": "^3.0.5", "lodash": "4.17.4", "ngx-bootstrap": "^7.0.0", "pouchdb-browser": "6.3.4", "rxjs": "6.6.0", "rxjs-compat": "^6.6.7", "tslib": "^2.3.0", "zone.js": "~0.11.4" }, "devDependencies": { "@angular-devkit/build-angular": "~12.2.8", "@angular/cli": "~12.2.8", "@angular/compiler-cli": "~12.2.0", "@types/jasmine": "~3.8.0", "@types/node": "^12.11.1", "angular": "1.6.6", "angular-in-memory-web-api": "0.4.6", "angular-mocks": "1.6.6", "angular-route": "1.6.6", "angular-sanitize": "1.6.6", "bootstrap": "3.3.7", "codelyzer": "^6.0.0", "concurrently": "3.5.0", "font-awesome": "4.7.0", "grunt": "1.0.1", "grunt-bower-task": "0.5.0", "grunt-cli": "1.2.0", "grunt-concurrent": "2.3.1", "grunt-contrib-clean": "1.1.0", "grunt-contrib-concat": "1.0.1", "grunt-contrib-copy": "1.0.0", "grunt-contrib-jshint": "1.1.0", "grunt-contrib-less": "1.4.1", "grunt-contrib-uglify": "3.1.0", "grunt-contrib-watch": "1.0.0", "grunt-exec": "3.0.0", "grunt-open": "0.2.3", "grunt-text-replace": "0.4.0", "jasmine-core": "^3.8.0", "jasmine-spec-reporter": "^5.0.0", "jquery": "2.2.4", "karma": "^6.3.0", "karma-chrome-launcher": "^3.1.0", "karma-cli": "1.0.1", "karma-coverage": "^2.0.3", "karma-htmlfile-reporter": "0.3.5", "karma-jasmine": "^4.0.0", "karma-jasmine-html-reporter": "^1.7.0", "karma-phantomjs-launcher": "1.0.4", "karma-requirejs": "1.1.0", "karma-sonarqube-unit-reporter": "0.0.13", "load-grunt-tasks": "3.5.2", "protractor": "^7.0.0", "requirejs": "2.3.5", "time-grunt": "1.4.0", "ts-node": "^8.3.0", "tslint": "^6.1.0", "typescript": "^4.3.5"

} }

bxdadwhal commented 2 years ago

karma-conf.js :- // Karma configuration file, see link for more information // https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-phantomjs-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage'), require('@angular-devkit/build-angular/plugins/karma') ], client: { clearContext: false // leave Jasmine Spec Runner output visible in browser }, // files: [ // // ], // preprocessors: { // // }, // mime: { // 'text/x-typescript': ['ts', 'tsx'] // }, coverageReporter: { dir: require('path').join(__dirname, 'coverage'), subdir: '.', reporters: [ { type: 'html' }, { type: 'lcovonly' } ], },

reporters: ['progress', 'coverage'], // reporters: config.angularCli && config.angularCli.codeCoverage // ? ['progress', 'coverage-istanbul'] // : ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: false, browsers: ['PhantomJS'], singleRun: true }); };