Is there a way to fix this error without having to place an ignore in the file?
Error when running command:
./node_modules/tslint/bin/tslint -p src/tsconfig.json --type-check src/app/app.component.spec.ts
[21, 5]: unused expression, expected an assignment or function call
Test:
let chai = require('chai');
let expect = chai.expect;
import { AppComponent } from './app.component';
import { ComponentFixture, TestBed } from '@angular/core/testing';
describe('AppComponent', function() {
let testAppComponent: AppComponent;
let fixture: ComponentFixture<AppComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [AppComponent]
});
fixture = TestBed.createComponent(AppComponent);
testAppComponent = fixture.componentInstance;
});
it('should create the correct component', () => {
expect(testAppComponent instanceof AppComponent).to.be.true;
});
});
Did you perhaps mean this:
expect(testAppComponent instanceof AppComponent).toBe(true);
The expression you have there just accesses a bunch of properties, you need some kind of function call for it to actually do anything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With