Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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;
like image 327
Jason Chang Avatar asked Aug 05 '26 01:08

Jason Chang


1 Answers

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.

like image 183
Jason Chang Avatar answered Aug 07 '26 16:08

Jason Chang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!