Skip to main content

Including and excluding groups

Similar to the way you use skip and only to include and exclude tests, you can use and to exclude and include whole groups.

These two functions are powerful and give you control of whole portions of your suite at once.

import { create, test, group, enforce, skip } from 'vest';

create(data => { ? 'signUp' : 'signIn');

test('userName', "Can't be empty", () => {
test('password', "Can't be empty", () => {

group('signIn', () => {
'User not found. Please check if you typed it correctly.',

group('signUp', () => {
test('email', 'Email already registered', isEmailRegistered(;

test('age', 'You must be at least 18 years old to join', () => {

Things to note when using these functions When using, only tests within the targeted group will be run, all other tests will be skipped - even if they are specifically selected using only.

It works like this: When applied to a suite, filters out all possible tests to the tests that are within a certain group. When used in conjunction with only, these two filters have and AND relationship, meaning that the "onlied" fields will only be selected from within the targeted group.

If you combine with only your included field declared within the skipped group will be skipped.