Add linter for using `sync: false` in `mount` and `shallowMount`

Description

Whenever we're using @vue/test-utils, we require that sync: false is passed to mount and shallowMount because:

  • In Karma, when this options is missing, non-deterministic errors in unrelated tests will arise. 😞
  • @vue/test-utils will be removing sync mode in the future, so we'd rather not become dependent on it.

Examples for this linter

Please keep in mind that in Karma there's more boilerplate needed which is out of scope for this linter.

import { shallowMount, mount } from '@vue/test-utils';

// Bad :(
wrapper = shallowMount(FooComponent, { propsData });

// Good :)

wrapper = shallowMount(FooComponent, { propsData, sync: false });

// Bad :(
mount(FooComponent, { attachToDocument: true, sync: true });

// Good :)
mount(FooComponent, { attachToDocument: true, sync: false });
Edited Dec 12, 2019 by Paul Slaughter
Assignee Loading
Time tracking Loading