jest
jest copied to clipboard
After skiping the test, still jest takes long time, how to make it to 0 time
I am doing testing with jest.js in my angular project. It seems that, my whole testing process take closly 45min, which i not requried. I decided to skip some of unwanted tests from the project. for that I am skipping it out.
But still I am getting 25.36s
for the skipped file. how to make it to 0s
instead? here is my test case: (xdescribe
) i skipped.
import { TestBed, inject, getTestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { IboSharedLibModule } from '@ibo/ibo-shared-lib';
import { CourseMappingAddGuard } from './course-mapping-add.guard';
import { HttpClient } from '@angular/common/http';
import { provideMockStore, MockStore } from '@ngrx/store/testing';
import { Router } from '@angular/router';
import * as subscribe from '../previous-course-linkage/state/selectors/course-mapping.selector';
xdescribe('CourseMappingAddGuard', () => {
let injector: TestBed;
let guard: CourseMappingAddGuard;
function createTranslateLoader(http: HttpClient) {
const store: MockStore<any> = null;
}
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [],
imports: [
StoreModule.forRoot({}, { runtimeChecks: { strictStateImmutability: true, strictActionImmutability: true } }),
HttpClientTestingModule,
IboSharedLibModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: createTranslateLoader,
deps: [HttpClient],
},
isolate: true,
}),
],
providers: [
CourseMappingAddGuard,
provideMockStore({
selectors: [],
}),
],
});
injector = getTestBed();
guard = injector.get(CourseMappingAddGuard);
});
it('should redirect to parent page if no data available', () => {
expect(guard.canActivate()).toEqual(false);
});
});
here is the test result:
$ jest course-mapping-add.guard.spec.ts
Test Suites: 1 skipped, 0 of 1 total
Tests: 1 skipped, 1 total
Snapshots: 0 total
Time: 16.232s, estimated 20s
Ran all test suites matching /course-mapping-add.guard.spec.ts/i.
Done in 25.36s.
any one please help me to understand? thanks in advance.
Hey @3gwebtrain! Jest should normally run very fast, so 25 seconds for one skipped test is not normal. But there can be a number of reasons to why this is happening (for example, a problem with your computer), and this issue tracker is not meant to be a help forum. It would be better if you ask your questions at StackOverflow or the discord channel.
If you believe there is a bug in Jest, then it would be helpful if you can provide a minimal reproduction (without angular and such) - with clear instructions on how to recreate the issue.
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.