Jason Chang
Jason Chang

Reputation: 145

Jest, TypeScript: Missing semi colon error

I am writing basic test using Jest for my angular project. However, I get a weird missing semi-colon error that I cannot understand how to fix.

import { RegistrationService } from "../registration/services/registration.service";
describe("Email Validator function", () => {
let registrationService: RegistrationService;

test("Check Email Exists", () => {
    const input = '[email protected]';

    expect(registrationService.checkIfEmailAvailability(input)).toEqual(true);
  });
});

Error:

SyntaxError: src\app\__tests__\email-validator.spec.ts: Missing semicolon (4:25)

  2 |
  3 | describe("Email Validator function", () => {
> 4 |   let registrationService: RegistrationService;

Upvotes: 7

Views: 9851

Answers (1)

Jason Chang
Jason Chang

Reputation: 145

I followed instructions here: https://basarat.gitbook.io/typescript/intro-1/jest

Basically I was missing ts-jest and the jest.config.js as mentioned in that article.

Upvotes: 6

Related Questions