Karma: Running a single test file from command line
First you need to start karma server with karma start Then, you can use grep to filter a specific test or describe block: karma run — –grep=testDescriptionFilter
First you need to start karma server with karma start Then, you can use grep to filter a specific test or describe block: karma run — –grep=testDescriptionFilter
The command line interface is in a separate package. To install this use: npm install -g karma-cli
You passed HeroDetailComponent to TestBed.createComponent() without declaring the component first: TestBed.configureTestingModule({ imports: [AppModule, CommonModule, FormsModule, SharedModule, HeroRoutingModule, ReactiveFormsModule ], providers: [ {provide: APP_BASE_HREF, useValue: “https://stackoverflow.com/”} ], declarations: [HeroDetailComponent] }).compileComponents(); Hope it helps. Update for following errors in your test: Added some more imports (just take your HeroModule as a blueprint because that’s basically what you … Read more
You are missing the angular-mocks.js file.
As per photusenigma at: https://github.com/npm/npm/issues/4815 Run these commands in a terminal window (note – DON’T replace the $USER part…thats a linux command to get your user!): sudo chown -R $USER ~/.npm sudo chown -R $USER /usr/local/lib/node_modules …and…if you’re on a mac (like I am), and still see errors after running these commands, then run this … Read more
I discovered that Jasmine allows you to prefix describe and it methods with an f (for focus): fdescribe and fit. If you use either of these, Karma will only run the relevant tests. To focus the current file, you can just take the top level describe and change it to fdescribe. If you use Jasmine … Read more
To check if any module in a project is ‘old’: npm outdated ‘outdated’ will check every module defined in package.json and see if there is a newer version in the NPM registry. For example, say xml2js 0.2.6 (located in node_modules in the current project) is outdated because a newer version exists (0.2.7). You would see: … Read more