Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error unexpected token export when running with Jest #1005

Open
scaabel opened this issue Feb 14, 2023 · 0 comments
Open

Getting error unexpected token export when running with Jest #1005

scaabel opened this issue Feb 14, 2023 · 0 comments

Comments

@scaabel
Copy link

scaabel commented Feb 14, 2023

Vest version: 4.6.8
Framework: NextJs 13/React 18
Jest version: 29.2.0

I'm currently running a test with my Login page. Here is my validation suite for my login form.

//suite.ts
import { create, enforce, test } from 'vest';
import validator from 'validator';

enforce.extend({ isEmail: validator.isEmail });

export const suite = create((data) => {
	test('email', 'Email is required', () => {
		enforce(data?.email).isNotEmpty();
	});

	test('email', 'Email must be valid', () => {
		enforce(data?.email).isEmail();
	});

	test('password', 'Password is required', () => {
		enforce(data?.password).isNotEmpty();
	});
});

Here is my jest test.

import { render, screen } from '@testing-library/react';
import Login from '@pages/admin/login';

describe('Login', () => {
	it('should render login page', function () {
		render(<Login />);

		const title = screen.getByTestId('login-title');

		expect(title).toBeInTheDocument();
	});
});

I've attached a screenshot of my error below.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant