eslint-plugin-testing-library

ESLint plugin to follow best practices and anticipate common mistakes when writing tests with Testing Library

MIT License

Downloads
23.7M
Stars
952
Committers
66

Bot releases are hidden (Show)

eslint-plugin-testing-library - v3.1.3

Published by Belco90 over 4 years ago

3.1.3 (2020-05-16)

Bug Fixes

eslint-plugin-testing-library - v3.1.2

Published by Belco90 over 4 years ago

3.1.2 (2020-05-09)

Bug Fixes

  • prefer-screen-queries: false positives when using within method (#119) (28238aa), closes #116
eslint-plugin-testing-library - v3.1.1

Published by Belco90 over 4 years ago

3.1.1 (2020-05-08)

Bug Fixes

  • no-manual-cleanup: check require imports properly (#128) (28e23a9), closes #125
eslint-plugin-testing-library - v3.1.0

Published by Belco90 over 4 years ago

3.1.0 (2020-05-04)

Features

  • migrate plugin to typescript-eslint (#121) (3439a29). This is not actually adding any new feature to the plugin but we wanted to bump a minor version here so the migration can be noticed properly.
eslint-plugin-testing-library - v3.0.4

Published by Belco90 over 4 years ago

3.0.4 (2020-04-19)

Bug Fixes

  • async checks when calling queries member expressions (#114) (cedb56b), closes #113

This bug fix makes sure await-async-query and no-await-sync-query rules work fine when checking queries used from screen util.

eslint-plugin-testing-library - v3.0.3

Published by Belco90 over 4 years ago

3.0.3 (2020-04-07)

Bug Fixes

eslint-plugin-testing-library - v3.0.2

Published by Belco90 over 4 years ago

3.0.2 (2020-04-01)

Bug Fixes

eslint-plugin-testing-library - v3.0.1

Published by Belco90 over 4 years ago

3.0.1 (2020-03-31)

Bug Fixes

  • check namespaced imports for no-debug and prefer-wait-for (#102) (6c8f14a), closes #101
eslint-plugin-testing-library - v3.0.0

Published by Belco90 over 4 years ago

3.0.0 (2020-03-29)

Features

  • await-async-utils: reflect waitFor changes (#89)
  • new rule no-wait-for-empty-callback (#94)
  • new rule prefer-wait-for (#88)
  • new rule prefer-screen-queries (#99)
  • new rule prefer-presence-queries (#98)

prefer-wait-for

This new rule is fixable so it can help you migrating deprecated wait, waitForElement and waitForDomChange to new waitFor method.

From this:

import { render, wait, waitForElement, waitForDomChange } from '@testing-library/dom';

async () => {
  render(<SomeComponent />);

  await wait();
  await wait(() => expect(screen.getByText('submit')).not.toBeInTheDocument());
  await waitForElement(() => {});
  await waitForDomChange();
  await waitForDomChange({ timeout: 100 });
};

to this:

import { render, waitFor } from '@testing-library/dom';

async () => {
  render(<SomeComponent />);

  // `wait` without callback is replaced with `waitFor` with empty callback
  await waitFor(() => {});

  // `wait` with some callback is replaced with `waitFor` keeping same callback
  await waitFor(() => expect(screen.getByText('submit')).not.toBeInTheDocument());
  
  // same for `waitForElement`
  await waitFor(() => {});

  // same for `waitForDomChange`
  await waitFor(() => {});

  // `waitForDomChange` options are passed as 2nd arg to `waitFor`
  await waitFor(() => {}, { timeout: 100 });
};

BREAKING CHANGES

  • drop support for node v8. Min version allowed is node v10.12 (#96)
  • rule no-get-by-for-checking-element-not-present removed in favor of new rule prefer-presence-queries (#98)
eslint-plugin-testing-library - v2.2.3

Published by Belco90 over 4 years ago

2.2.3 (2020-02-11)

Bug Fixes

  • no-get-by-for-checking-element-not-present: false positives for negated matchers (#84) (34da6c1)
eslint-plugin-testing-library - v2.2.2

Published by Belco90 over 4 years ago

2.2.2 (2020-02-10)

Bug Fixes

eslint-plugin-testing-library - v2.2.1

Published by Belco90 over 4 years ago

2.2.1 (2020-02-04)

Bug Fixes

eslint-plugin-testing-library - v2.2.0

Published by Belco90 over 4 years ago

2.2.0 (2020-02-01)

Features

  • no-debug: scan for screen.debug() (#73) (153bb3a)
eslint-plugin-testing-library - v2.1.0

Published by Belco90 over 4 years ago

2.1.0 (2020-01-30)

Features

eslint-plugin-testing-library - v2.0.0

Published by Belco90 over 4 years ago

2.0.0 (2020-01-28)

Features

  • new rule await-async-utils (#69) (6420867)
  • new rule no-get-by-for-checking-element-not-present (#65) (1aa9238)

BREAKING CHANGES

  • rule prefer-expect-query-by has disappeared in favor of new rule no-get-by-for-checking-element-not-present
eslint-plugin-testing-library - v1.5.0

Published by Belco90 over 4 years ago

1.5.0 (2020-01-22)

Features

  • add support for resolves/rejects matchers in async queries (#64) (d0a1585)
eslint-plugin-testing-library - v1.4.1

Published by Belco90 almost 5 years ago

1.4.1 (2020-01-15)

Bug Fixes

  • prefer-expect-query-by: remove rule from shareable configs (#60) (93e2a8b)

Note that prefer-expect-query-by has to be manually enabled from now on.

eslint-plugin-testing-library - v1.4.0

Published by Belco90 almost 5 years ago

1.4.0 (2020-01-13)

Features

eslint-plugin-testing-library - v1.3.4

Published by Belco90 almost 5 years ago

1.3.4 (2019-12-10)

Bug Fixes

  • prefer-explicit-assert: check if node property is accessed (#52) (7b8c2c6)
eslint-plugin-testing-library - v1.3.3

Published by Belco90 almost 5 years ago

1.3.3 (2019-12-10)

Bug Fixes

  • await-async-query: references is not iterable / cant parse expect(findBy*) (#50) (ea8816c)