Skip to content

Commit

Permalink
[ONL-8065] Replace jest with vitest (#1737)
Browse files Browse the repository at this point in the history
* [ONL-8065] feat: Replace jest with vitest.

* [ONL-8065] chore: Configure vitest.

* [ONL-8065] chore: Configure eslint rules.

* [ONL-8065] chore: Replace jest with vitest in test setup/mocks/stubs. Converted them to TS too.

* [ONL-8065] fix: Fixed CVueWrapper not having correct return values.

* [ONL-8065] fix: Fixed $tooltipContainer global property can't be recognised by TS when testing ec-tooltip.

* [ONL-8065] fix: Removed toMatchDiffSnapshot occurrences because they are not supported by vitest. Fixed random failures in dropdown-search when trying to find tabbableElement.

* [ONL-8065] chore: Replaced jest with vitest in utils.

* [ONL-8065] chore: Replaced jest with vitest in directives and reworked ec-tooltip tests.

* [ONL-8065] chore: Replaced jest with vitest in hocs.

* [ONL-8065] chore: Replaced jest with vitest in composables.

* [ONL-8065] chore: Fixed wrong eslint file path used in src.

* [ONL-8065] fix: Fixed coverage in tests reported by the vitest.

* [ONL-8065] fix: More fixes related to coverage and replacing jest with vitest.

* [ONL-8065] chore: Updated remaining snapshots.

* [ONL-8065] chore: Migrated intl setup to TS.

* [ONL-8065] fix: Fixed typing for VueWrapper

* [ONL-8065] chore: Removed CVueWrapper as it is not needed anymore.

* [ONL-8065] docs: Updated docs.

* [ONL-8065] chore: Updated npmignore.

* [ONL-8065] chore: Updated latest testing dependencies and removed unused packages.

* [ONL-8065] chore: Removed testing-library as it is no longer required by VTU.

* [ONL-8065] fix: Fixed missing types for fake-timers.

* [ONL-8065] fix: Allowed expect inside beforeEach and afterEach blocks.

* [ONL-8065] fix: Fixed comments in snapshots.

* [ONL-8065] chore: Updated latest dependencies.

* [ONL-8065] chore: Removed unused generic type.

* 2.4.0
  • Loading branch information
mcibique committed Nov 7, 2023
1 parent 61c3400 commit 3ab4b7b
Show file tree
Hide file tree
Showing 174 changed files with 30,752 additions and 35,675 deletions.
13 changes: 0 additions & 13 deletions .eslintrc.jest.js

This file was deleted.

6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ module.exports = {
},
],
'filenames/match-regex': [
2,
'error',
'^[.a-z0-9-]+$',
],
},
Expand All @@ -117,11 +117,7 @@ module.exports = {
files: [
'**/src/**/*.spec.js',
],
env: {
jest: true,
},
rules: {
'global-require': 'off',
'vue/require-prop-types': 'off',
},
},
Expand Down
33 changes: 33 additions & 0 deletions .eslintrc.tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const vitest = require('eslint-plugin-vitest');

module.exports = {
overrides: [
{
files: [
'**/*.spec.js',
'**/*.spec.ts',
],
plugins: ['vitest'],
extends: [
'plugin:vitest/recommended',
],
globals: {
...vitest.environments.env.globals,
},
rules: {
'vitest/consistent-test-filename': ['error', { pattern: '.*\\.spec\\.[tj]sx?$' }],
'vitest/consistent-test-it': ['error', { fn: 'it', withinDescribe: 'it' }],
'vitest/no-alias-methods': 'error',
'vitest/no-disabled-tests': 'error',
'vitest/no-duplicate-hooks': 'error',
'vitest/no-focused-tests': 'error',
'vitest/no-standalone-expect': ['error', { additionalTestBlockFunctions: ['beforeEach', 'afterEach'] }],
'vitest/prefer-hooks-in-order': 'error',
'vitest/prefer-hooks-on-top': 'error',
'vitest/prefer-lowercase-title': ['error', { ignoreTopLevelDescribe: true }],
'vitest/prefer-to-be': 'off',
},
},
],
};
9 changes: 4 additions & 5 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@
**/*.story.css
**/*.story.js
**/__snapshots__/**
babel.config.js
bitbucket-pipelines.yml
coverage
cypress.json
docker
jest.config.js
Makefile
now.json
postcss.config.js
patches
public
tests/**/*
!tests/mocks/**
!tests/stubs/**
vercel.json
vite.config.js
vitest.config.ts
CODEOWNERS
*.md
patches
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ If you need to support every single locale on the planet, we recommend to polyfi

### Testing

[Jest](https://jestjs.io/)
[Vitest](https://vitest.dev/)

[Vue Test Utils](https://test-utils.vuejs.org/)

Expand Down
6 changes: 6 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
declare module 'vue' {
interface ComponentCustomProperties {
$tooltipContainer?: HTMLElement | string;
}
}

export type Maybe<T> = T | null;

export enum ZIndexLevel {
Expand Down
78 changes: 0 additions & 78 deletions jest.config.js

This file was deleted.

Loading

1 comment on commit 3ab4b7b

@vercel
Copy link

@vercel vercel bot commented on 3ab4b7b Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

chameleon – ./

chameleon-git-master-ebury.vercel.app
chameleon-ebury.vercel.app
chameleon-dead-plane.vercel.app

Please sign in to comment.