Skip to content

Commit

Permalink
Merge pull request #834 from acelaya-forks/feature/vitest-migration
Browse files Browse the repository at this point in the history
Feature/vitest migration
  • Loading branch information
acelaya committed May 27, 2023
2 parents 706e00a + 27d79b5 commit 2ac1025
Show file tree
Hide file tree
Showing 128 changed files with 9,201 additions and 12,710 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org).

## [Unreleased]
### Added
* *Nothing*

### Changed
* [#781](https://github.com/shlinkio/shlink-web-client/issues/781) Migrate tests from jest to vitest.

### Deprecated
* *Nothing*

### Removed
* *Nothing*

### Fixed
* *Nothing*


## [3.10.1] - 2023-04-23
### Added
* *Nothing*
Expand Down
9 changes: 0 additions & 9 deletions babel.config.js

This file was deleted.

12 changes: 0 additions & 12 deletions config/jest/cssTransform.js

This file was deleted.

31 changes: 0 additions & 31 deletions config/jest/fileTransform.js

This file was deleted.

12 changes: 0 additions & 12 deletions config/jest/setupTests.ts

This file was deleted.

27 changes: 27 additions & 0 deletions config/test/setupTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'vitest-canvas-mock';
import 'chart.js/auto';
import type { TestingLibraryMatchers } from '@testing-library/jest-dom/matchers';
import matchers from '@testing-library/jest-dom/matchers';
import { cleanup } from '@testing-library/react';
import ResizeObserver from 'resize-observer-polyfill';
import { afterEach, expect } from 'vitest';

// Workaround for TypeScript error: https://github.com/testing-library/jest-dom/issues/439#issuecomment-1536524120
declare module 'vitest' {
interface Assertion<T = any> extends jest.Matchers<void, T>, TestingLibraryMatchers<T, void> {}
}

// Extends Vitest's expect method with methods from react-testing-library
expect.extend(matchers);

afterEach(() => {
// Clears all mocks after every test
vi.clearAllMocks();
// Run a cleanup after each test case (e.g. clearing jsdom)
cleanup();
});

(global as any).ResizeObserver = ResizeObserver;
(global as any).scrollTo = () => {};
(global as any).prompt = () => {};
(global as any).matchMedia = (media: string) => ({ matches: false, media });
39 changes: 0 additions & 39 deletions jest.config.js

This file was deleted.

0 comments on commit 2ac1025

Please sign in to comment.