karma-runner / karma-runner/karma-coverage

ng test error with PhantomJS , getting less error

Open
#462 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
771
Forks
242
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with npm run coverage and separate the styles.less build error from the TypeScript test errors. Read the reported specs—citation-list.component.spec.ts, details.service.spec.ts, controller.event.spec.ts, and lookup.event.spec.ts—then verify that the coverage command completes without these errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript, typescript, webpack
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.