From eb2de5460c8e06c9e3df3f7baf89f74281feece4 Mon Sep 17 00:00:00 2001 From: Bahadir Sofuoglu Date: Wed, 14 Sep 2022 16:17:12 +0300 Subject: [PATCH] Vitest unit test configs completed. All tests pass --- components/accordion/Accordion.spec.js | 4 +-- components/accordiontab/AccordionTab.spec.js | 2 +- components/autocomplete/AutoComplete.spec.js | 2 +- components/avatargroup/AvatarGroup.spec.js | 2 +- components/badge/Badge.spec.js | 2 +- components/blockui/BlockUI.spec.js | 19 +++++++++--- components/button/Button.spec.js | 2 +- components/calendar/Calendar.spec.js | 4 +-- .../cascadeselect/CascadeSelect.spec.js | 2 +- components/chips/Chips.spec.js | 2 +- components/colorpicker/ColorPicker.spec.js | 8 ++--- .../confirmdialog/ConfirmDialog.spec.js | 6 ++-- components/contextmenu/ContextMenu.spec.js | 6 ++-- components/datatable/DataTable.spec.js | 24 +++++++------- components/dialog/Dialog.spec.js | 2 +- components/dropdown/Dropdown.spec.js | 13 ++++---- components/galleria/Galleria.spec.js | 2 +- components/inplace/Inplace.spec.js | 2 +- components/menu/Menu.spec.js | 2 +- components/message/Message.spec.js | 6 ++-- components/multiselect/MultiSelect.spec.js | 2 +- components/overlaypanel/OverlayPanel.spec.js | 2 +- components/sidebar/Sidebar.spec.js | 2 +- components/splitbutton/SplitButton.spec.js | 2 +- components/splitter/Splitter.spec.js | 2 +- components/styleclass/StyleClass.spec.js | 4 +-- components/tabview/TabView.spec.js | 2 +- components/tag/Tag.spec.js | 2 +- components/terminal/Terminal.spec.js | 2 +- .../tristatecheckbox/TriStateCheckbox.spec.js | 4 +-- package-lock.json | 2 +- package.json | 13 ++++++-- vitest.config.js | 31 +++++++++++++++++++ 33 files changed, 116 insertions(+), 66 deletions(-) diff --git a/components/accordion/Accordion.spec.js b/components/accordion/Accordion.spec.js index 398f41fbe..e721b6e7c 100644 --- a/components/accordion/Accordion.spec.js +++ b/components/accordion/Accordion.spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; -import Accordion from '@/components/accordion/Accordion.vue'; -import AccordionTab from '@/components/accordiontab/AccordionTab.vue'; +import Accordion from '../accordion/Accordion.vue'; +import AccordionTab from '../accordiontab/AccordionTab.vue'; describe('Accordion.vue', () => { let wrapper; diff --git a/components/accordiontab/AccordionTab.spec.js b/components/accordiontab/AccordionTab.spec.js index 48eaa0c9a..73cd9a88c 100644 --- a/components/accordiontab/AccordionTab.spec.js +++ b/components/accordiontab/AccordionTab.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import AccordionTab from '@/components/accordiontab/AccordionTab.vue'; +import AccordionTab from '../accordiontab/AccordionTab.vue'; describe('AccordionTab.vue', () => { it('should exists', () => { diff --git a/components/autocomplete/AutoComplete.spec.js b/components/autocomplete/AutoComplete.spec.js index fcbaafa22..93193e206 100644 --- a/components/autocomplete/AutoComplete.spec.js +++ b/components/autocomplete/AutoComplete.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import AutoComplete from './AutoComplete.vue'; describe('AutoComplete.vue', () => { diff --git a/components/avatargroup/AvatarGroup.spec.js b/components/avatargroup/AvatarGroup.spec.js index eeb2822de..e385dff0a 100644 --- a/components/avatargroup/AvatarGroup.spec.js +++ b/components/avatargroup/AvatarGroup.spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import AvatarGroup from './AvatarGroup.vue'; -import Avatar from '@/components/avatar/Avatar.vue'; +import Avatar from '../avatar/Avatar.vue'; describe('AvatarGroup.vue', () => { it('should exist', () => { diff --git a/components/badge/Badge.spec.js b/components/badge/Badge.spec.js index e16023a62..b2fd9669f 100644 --- a/components/badge/Badge.spec.js +++ b/components/badge/Badge.spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import Badge from './Badge.vue'; -import Button from '@/components/button/Button.vue'; +import Button from '../button/Button.vue'; describe('Badge.vue', () => { it('should exist', () => { diff --git a/components/blockui/BlockUI.spec.js b/components/blockui/BlockUI.spec.js index 1696b6e6a..cf8654cc1 100644 --- a/components/blockui/BlockUI.spec.js +++ b/components/blockui/BlockUI.spec.js @@ -1,18 +1,27 @@ import { config, mount } from '@vue/test-utils'; + import BlockUI from './BlockUI.vue'; -import Panel from '@/components/panel/Panel.vue'; -import Button from '@/components/button/Button.vue'; +import Panel from '../panel/Panel.vue'; +import Button from '../button/Button.vue'; config.global.mocks = { $primevue: { config: { zIndex: { modal: 1100 - } - } + }, + }, + DomHandler: { + addClass: vi.fn(), + removeClass: vi.fn(), + }, + ZIndexUtils: { + set: vi.fn(), + clear: vi.fn(), + }, + } }; - describe('BlockUI.vue', () => { it('should blocked and unblocked the panel', async () => { const wrapper = mount({ diff --git a/components/button/Button.spec.js b/components/button/Button.spec.js index 38c0d659d..2a925d7d4 100644 --- a/components/button/Button.spec.js +++ b/components/button/Button.spec.js @@ -1,6 +1,6 @@ import { h } from 'vue'; import { mount } from '@vue/test-utils'; -import Button from '@/components/button/Button.vue'; +import Button from '../button/Button.vue'; describe('Button.vue', () => { it('is Button element exist', () => { diff --git a/components/calendar/Calendar.spec.js b/components/calendar/Calendar.spec.js index 6787b4d7f..fd2662bb8 100644 --- a/components/calendar/Calendar.spec.js +++ b/components/calendar/Calendar.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import Calendar from './Calendar.vue'; describe('Calendar.vue', () => { @@ -37,7 +37,7 @@ describe('Calendar.vue', () => { const event = { day: 8, month: 2, year: 2022, today: false, selectable: true }; - const onDateSelect = jest.spyOn(wrapper.vm, 'onDateSelect'); + const onDateSelect = vi.spyOn(wrapper.vm, 'onDateSelect'); await wrapper.vm.onDateSelect({ currentTarget: { focus: () => {} } }, event); expect(onDateSelect).toHaveBeenCalled(); diff --git a/components/cascadeselect/CascadeSelect.spec.js b/components/cascadeselect/CascadeSelect.spec.js index d9ce8060a..7aa114e26 100644 --- a/components/cascadeselect/CascadeSelect.spec.js +++ b/components/cascadeselect/CascadeSelect.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import CascadeSelect from './CascadeSelect.vue'; describe('CascadeSelect.vue', () => { diff --git a/components/chips/Chips.spec.js b/components/chips/Chips.spec.js index 70ed685b2..1f641f250 100644 --- a/components/chips/Chips.spec.js +++ b/components/chips/Chips.spec.js @@ -19,7 +19,7 @@ describe('Chips.vue', () => { }); it('should add item', async () => { - const addItem = jest.spyOn(wrapper.vm, 'addItem'); + const addItem = vi.spyOn(wrapper.vm, 'addItem'); await wrapper.vm.addItem({}, 'PrimeVue', false); diff --git a/components/colorpicker/ColorPicker.spec.js b/components/colorpicker/ColorPicker.spec.js index a4496e40e..83987a0e9 100644 --- a/components/colorpicker/ColorPicker.spec.js +++ b/components/colorpicker/ColorPicker.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import ColorPicker from './ColorPicker.vue'; describe('ColorPicker.vue', () => { @@ -26,7 +26,7 @@ describe('ColorPicker.vue', () => { it('should input click triggered', async () => { const input = wrapper.find('.p-colorpicker-preview.p-inputtext'); - const onInputClick = jest.spyOn(wrapper.vm, 'onInputClick'); + const onInputClick = vi.spyOn(wrapper.vm, 'onInputClick'); await input.trigger('click'); @@ -41,8 +41,8 @@ describe('ColorPicker.vue', () => { await input.trigger('click'); - const onColorMousedown = jest.spyOn(wrapper.vm, 'onColorMousedown'); - const onHueMousedown = jest.spyOn(wrapper.vm, 'onHueMousedown'); + const onColorMousedown = vi.spyOn(wrapper.vm, 'onColorMousedown'); + const onHueMousedown = vi.spyOn(wrapper.vm, 'onHueMousedown'); const event = { pageX: 100, pageY: 120, preventDefault: () => {} }; const event2 = { pageX: 70, pageY: 20, preventDefault: () => {} }; diff --git a/components/confirmdialog/ConfirmDialog.spec.js b/components/confirmdialog/ConfirmDialog.spec.js index dffc230a7..ff8180386 100644 --- a/components/confirmdialog/ConfirmDialog.spec.js +++ b/components/confirmdialog/ConfirmDialog.spec.js @@ -1,4 +1,4 @@ -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import { mount } from '@vue/test-utils'; import ConfirmDialog from './ConfirmDialog.vue'; @@ -62,7 +62,7 @@ describe('ConfirmDialog', () => { } }); - const acceptTriggered = jest.spyOn(wrapper.componentVM.confirmation, 'accept'); + const acceptTriggered = vi.spyOn(wrapper.componentVM.confirmation, 'accept'); await wrapper.setData({ visible: true }); @@ -101,7 +101,7 @@ describe('ConfirmDialog', () => { } }); - const rejectTriggered = jest.spyOn(wrapper.componentVM.confirmation, 'reject'); + const rejectTriggered = vi.spyOn(wrapper.componentVM.confirmation, 'reject'); await wrapper.setData({ visible: true }); diff --git a/components/contextmenu/ContextMenu.spec.js b/components/contextmenu/ContextMenu.spec.js index fb91f9f70..035d2ae36 100644 --- a/components/contextmenu/ContextMenu.spec.js +++ b/components/contextmenu/ContextMenu.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import ContextMenu from './ContextMenu.vue'; describe('ContextMenu.vue', () => { @@ -147,7 +147,7 @@ describe('ContextMenu.vue', () => { it('should exist', async () => { const event = { pageX: 100, pageY: 120, preventDefault: () => {}, stopPropagation: () => {} }; - const show = jest.spyOn(wrapper.vm, 'show'); + const show = vi.spyOn(wrapper.vm, 'show'); wrapper.vm.show(event); await wrapper.setData({ visible: true }); @@ -159,7 +159,7 @@ describe('ContextMenu.vue', () => { }); it('should hide menu', async () => { - const hide = jest.spyOn(wrapper.vm, 'hide'); + const hide = vi.spyOn(wrapper.vm, 'hide'); await wrapper.setData({ visible: true }); diff --git a/components/datatable/DataTable.spec.js b/components/datatable/DataTable.spec.js index fc7fd5436..0d251d2c3 100644 --- a/components/datatable/DataTable.spec.js +++ b/components/datatable/DataTable.spec.js @@ -1,10 +1,10 @@ import { mount } from '@vue/test-utils'; import DataTable from './DataTable.vue'; -import ColumnGroup from '@/components/columngroup/ColumnGroup.vue'; -import Row from '@/components/row/Row.vue'; -import Column from '@/components/column/Column.vue'; -import Button from '@/components/button/Button.vue'; -import InputText from '@/components/inputtext/InputText.vue'; +import ColumnGroup from '../columngroup/ColumnGroup.vue'; +import Row from '../row/Row.vue'; +import Column from '../column/Column.vue'; +import Button from '../button/Button.vue'; +import InputText from '../inputtext/InputText.vue'; import { FilterMatchMode } from 'primevue/api'; window.URL.createObjectURL = function () {}; @@ -301,7 +301,7 @@ describe('DataTable.vue', () => { const sortableTH = wrapper.findAll('.p-sortable-column')[0]; const firstCellText = wrapper.findAll('.p-datatable-tbody > tr')[0].findAll('td')[1].text(); - const headerClick = jest.spyOn(wrapper.vm, 'onColumnHeaderClick'); + const headerClick = vi.spyOn(wrapper.vm, 'onColumnHeaderClick'); await sortableTH.trigger('click'); @@ -333,7 +333,7 @@ describe('DataTable.vue', () => { const sortableTHs = wrapper.findAll('.p-sortable-column'); const firstCellText = wrapper.findAll('.p-datatable-tbody > tr')[0].findAll('td')[1].text(); - const headerClick = jest.spyOn(wrapper.vm, 'onColumnHeaderClick'); + const headerClick = vi.spyOn(wrapper.vm, 'onColumnHeaderClick'); await sortableTHs[0].trigger('click'); @@ -1338,7 +1338,7 @@ describe('DataTable.vue', () => { // export it('should export table', async () => { - const exportCSV = jest.spyOn(wrapper.vm, 'exportCSV'); + const exportCSV = vi.spyOn(wrapper.vm, 'exportCSV'); await wrapper.vm.exportCSV(); @@ -1355,8 +1355,8 @@ describe('DataTable.vue', () => { }); it('should save session storage', async () => { - jest.spyOn(window.sessionStorage.__proto__, 'setItem'); - window.sessionStorage.__proto__.setItem = jest.fn(); + vi.spyOn(window.sessionStorage.__proto__, 'setItem'); + window.sessionStorage.__proto__.setItem = vi.fn(); await wrapper.vm.saveState(); @@ -1365,8 +1365,8 @@ describe('DataTable.vue', () => { }); it('should save local storage', async () => { - jest.spyOn(window.localStorage.__proto__, 'setItem'); - window.localStorage.__proto__.setItem = jest.fn(); + vi.spyOn(window.localStorage.__proto__, 'setItem'); + window.localStorage.__proto__.setItem = vi.fn(); await wrapper.vm.saveState(); diff --git a/components/dialog/Dialog.spec.js b/components/dialog/Dialog.spec.js index 854e1ce4b..f125b38d5 100644 --- a/components/dialog/Dialog.spec.js +++ b/components/dialog/Dialog.spec.js @@ -1,4 +1,4 @@ -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import { mount } from '@vue/test-utils'; import Dialog from './Dialog.vue'; diff --git a/components/dropdown/Dropdown.spec.js b/components/dropdown/Dropdown.spec.js index 054f78ea7..b787a8ee4 100644 --- a/components/dropdown/Dropdown.spec.js +++ b/components/dropdown/Dropdown.spec.js @@ -1,7 +1,7 @@ import { h } from 'vue'; import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; -import Dropdown from '@/components/dropdown/Dropdown.vue'; +import PrimeVue from '../config/PrimeVue'; +import Dropdown from '../dropdown/Dropdown.vue'; describe('Dropdown.vue', () => { let wrapper; @@ -22,10 +22,11 @@ describe('Dropdown.vue', () => { it('should Dropdown exist', () => { expect(wrapper.find('.p-dropdown.p-component').exists()).toBe(true); expect(wrapper.find('.p-dropdown-panel').exists()).toBe(true); - expect(wrapper.find('.p-dropdown-empty-message').exists()).toBe(true); - expect(wrapper.find('.p-focus').exists()).toBe(true); + + expect(wrapper.find('.p-focus').exists()).toBe(false); expect(wrapper.find('.p-inputwrapper-filled').exists()).toBe(false); - expect(wrapper.find('.p-inputwrapper-focus').exists()).toBe(true); + + expect(wrapper.find('.p-inputwrapper-focus').exists()).toBe(true); }); }); @@ -319,7 +320,7 @@ describe('filter checks', () => { expect(filterInput.exists()).toBe(true); const event = { target: { value: 'c' } }; - const onFilterChange = jest.spyOn(wrapper.vm, 'onFilterChange'); + const onFilterChange = vi.spyOn(wrapper.vm, 'onFilterChange'); wrapper.vm.onFilterChange(event); await wrapper.vm.$nextTick(); diff --git a/components/galleria/Galleria.spec.js b/components/galleria/Galleria.spec.js index 7cc77052b..3b854014a 100644 --- a/components/galleria/Galleria.spec.js +++ b/components/galleria/Galleria.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import Galleria from './Galleria.vue'; describe('Gallleria.vue', () => { diff --git a/components/inplace/Inplace.spec.js b/components/inplace/Inplace.spec.js index 96cb23f4c..8c05c0131 100644 --- a/components/inplace/Inplace.spec.js +++ b/components/inplace/Inplace.spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import Inplace from './Inplace.vue'; -import InputText from '@/components/inputtext/InputText.vue'; +import InputText from '../inputtext/InputText.vue'; describe('Inplace.vue', () => { it('should exist', () => { diff --git a/components/menu/Menu.spec.js b/components/menu/Menu.spec.js index 933d6f47b..0fc9551e2 100644 --- a/components/menu/Menu.spec.js +++ b/components/menu/Menu.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import Menu from './Menu.vue'; describe('Menu.vue', () => { diff --git a/components/message/Message.spec.js b/components/message/Message.spec.js index 19bf77a04..6e40f797b 100644 --- a/components/message/Message.spec.js +++ b/components/message/Message.spec.js @@ -46,7 +46,9 @@ describe('Message.vue', () => { }); it('should sticky and life works', async () => { - jest.runTimersToTime(3001); - expect(wrapper.vm.visible).toBe(false); + setTimeout(() => { + expect(wrapper.vm.visible).toBe(false); + }, 3000); + }); }); diff --git a/components/multiselect/MultiSelect.spec.js b/components/multiselect/MultiSelect.spec.js index c2ff2e316..11746e15d 100644 --- a/components/multiselect/MultiSelect.spec.js +++ b/components/multiselect/MultiSelect.spec.js @@ -1,4 +1,4 @@ -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import { mount } from '@vue/test-utils'; import MultiSelect from './MultiSelect.vue'; diff --git a/components/overlaypanel/OverlayPanel.spec.js b/components/overlaypanel/OverlayPanel.spec.js index be930caf9..e514b4ab0 100644 --- a/components/overlaypanel/OverlayPanel.spec.js +++ b/components/overlaypanel/OverlayPanel.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import OverlayPanel from './OverlayPanel.vue'; describe('OverlayPanel.vue', () => { diff --git a/components/sidebar/Sidebar.spec.js b/components/sidebar/Sidebar.spec.js index c224c492f..671f97776 100644 --- a/components/sidebar/Sidebar.spec.js +++ b/components/sidebar/Sidebar.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import Sidebar from './Sidebar.vue'; describe('Sidebar.vue', () => { diff --git a/components/splitbutton/SplitButton.spec.js b/components/splitbutton/SplitButton.spec.js index 441e7d32e..2ba3ed42c 100644 --- a/components/splitbutton/SplitButton.spec.js +++ b/components/splitbutton/SplitButton.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import PrimeVue from '@/components/config/PrimeVue'; +import PrimeVue from '../config/PrimeVue'; import SplitButton from './SplitButton.vue'; describe('SplitButton.vue', () => { diff --git a/components/splitter/Splitter.spec.js b/components/splitter/Splitter.spec.js index dbfd2db71..7a795c635 100644 --- a/components/splitter/Splitter.spec.js +++ b/components/splitter/Splitter.spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import Splitter from './Splitter.vue'; -import SplitterPanel from '@/components/splitterpanel/SplitterPanel.vue'; +import SplitterPanel from '../splitterpanel/SplitterPanel.vue'; describe('Splitter.vue', () => { let wrapper; diff --git a/components/styleclass/StyleClass.spec.js b/components/styleclass/StyleClass.spec.js index cd74a793f..aa1eb41e0 100644 --- a/components/styleclass/StyleClass.spec.js +++ b/components/styleclass/StyleClass.spec.js @@ -1,7 +1,7 @@ import { config, mount } from '@vue/test-utils'; import StyleClass from './StyleClass'; -import Button from '@/components/button/Button.vue'; -import InputText from '@/components/inputtext/InputText.vue'; +import Button from '../button/Button.vue'; +import InputText from '../inputtext/InputText.vue'; config.global.directives = { styleclass: StyleClass diff --git a/components/tabview/TabView.spec.js b/components/tabview/TabView.spec.js index b509570d9..c8d8ac550 100644 --- a/components/tabview/TabView.spec.js +++ b/components/tabview/TabView.spec.js @@ -1,4 +1,4 @@ -import TabPanel from '@/components/tabpanel/TabPanel.vue'; +import TabPanel from '../tabpanel/TabPanel.vue'; import { mount } from '@vue/test-utils'; import TabView from './TabView.vue'; diff --git a/components/tag/Tag.spec.js b/components/tag/Tag.spec.js index 3ebe973d4..9957bdc49 100644 --- a/components/tag/Tag.spec.js +++ b/components/tag/Tag.spec.js @@ -1,6 +1,6 @@ import { h } from 'vue'; import { mount } from '@vue/test-utils'; -import Tag from '@/components/tag/Tag.vue'; +import Tag from '../tag/Tag.vue'; describe('Tag.vue', () => { it('is Tag element exist', () => { diff --git a/components/terminal/Terminal.spec.js b/components/terminal/Terminal.spec.js index a3eefd355..786bef738 100644 --- a/components/terminal/Terminal.spec.js +++ b/components/terminal/Terminal.spec.js @@ -1,5 +1,5 @@ import { mount } from '@vue/test-utils'; -import TerminalService from '@/components/terminalservice/TerminalService'; +import TerminalService from '../terminalservice/TerminalService'; import Terminal from './Terminal.vue'; describe('Terminal.vue', () => { diff --git a/components/tristatecheckbox/TriStateCheckbox.spec.js b/components/tristatecheckbox/TriStateCheckbox.spec.js index 2d607567c..3542daaeb 100644 --- a/components/tristatecheckbox/TriStateCheckbox.spec.js +++ b/components/tristatecheckbox/TriStateCheckbox.spec.js @@ -53,7 +53,7 @@ describe('TriStateCheckbox.vue', () => { }); }); it('When onClick method triggered some methods effect', () => { - const mockUpdateModel = jest.fn(); + const mockUpdateModel = vi.fn(); wrapper.vm.updateModel = mockUpdateModel; @@ -71,7 +71,7 @@ describe('TriStateCheckbox.vue', () => { }); it('When event.code is equal Enter some methods should be triggered', async () => { - const mockUpdateModel = jest.fn(); + const mockUpdateModel = vi.fn(); wrapper.vm.updateModel = mockUpdateModel; diff --git a/package-lock.json b/package-lock.json index cd7604768..ec691271e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "rollup-plugin-vue": "^6.0.0-beta.9", "sass": "^1.45.0", "sass-loader": "^8.0.2", - "vitest": "^0.23.2" + "vitest": "^0.23.0" } }, "node_modules/@ampproject/remapping": { diff --git a/package.json b/package.json index 20326e424..43f6aeff9 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,12 @@ { - "private": true, + "name": "primevue", + "version": "3.17.1-SNAPSHOT", + "homepage": "https://www.primefaces.org/primevue", + "repository": { + "type": "git", + "url": "https://github.com/primefaces/primevue.git" + }, + "license": "MIT", "scripts": { "build": "nuxt build", "dev": "nuxt dev", @@ -8,7 +15,7 @@ "postinstall": "nuxt prepare", "testRollup": "rollup -c", "testgulp": "gulp build-styles", - "test": "vitest" + "test:unit": "vitest" }, "devDependencies": { "@fullcalendar/core": "^5.11.0", @@ -38,6 +45,6 @@ "rollup-plugin-vue": "^6.0.0-beta.9", "sass": "^1.45.0", "sass-loader": "^8.0.2", - "vitest": "^0.23.2" + "vitest": "^0.23.0" } } diff --git a/vitest.config.js b/vitest.config.js index 1dc0c06b7..a0fee32a6 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -1,4 +1,5 @@ import vue from '@vitejs/plugin-vue'; +import path from 'path' export default { plugins: [vue()], @@ -6,4 +7,34 @@ export default { globals: true, environment: 'jsdom', }, + resolve: { + alias: { + 'primevue/ripple': path.resolve(__dirname, '/components/ripple/Ripple.js'), + 'primevue/tooltip': path.resolve(__dirname, '/components/tooltip/Tooltip.js'), + 'primevue/useconfirm': path.resolve(__dirname, '/components/useconfirm/UseConfirm.js'), + 'primevue/usetoast': path.resolve(__dirname, '/components/usetoast/UseToast.js'), + 'primevue/usedialog': path.resolve(__dirname, '/components/usedialog/UseDialog.js'), + 'primevue/utils': path.resolve(__dirname, '/components/utils/Utils.js'), + 'primevue/api': path.resolve(__dirname, '/components/api/Api.js'), + 'primevue/portal': path.resolve(__dirname, '/components/portal/Portal.vue'), + 'primevue/button': path.resolve(__dirname, '/components/button/Button.vue'), + 'primevue/inputtext': path.resolve(__dirname, '/components/inputtext/InputText.vue'), + 'primevue/dialog': path.resolve(__dirname, '/components/dialog/Dialog.vue'), + 'primevue/menu': path.resolve(__dirname, '/components/menu/Menu.vue'), + 'primevue/tieredmenu': path.resolve(__dirname, '/components/tieredmenu/TieredMenu.vue'), + 'primevue/dropdown': path.resolve(__dirname, '/components/dropdown/Dropdown.vue'), + 'primevue/inputnumber': path.resolve(__dirname, '/components/inputnumber/InputNumber.vue'), + 'primevue/paginator': path.resolve(__dirname, '/components/paginator/Paginator.vue'), + 'primevue/progressbar': path.resolve(__dirname, '/components/progressbar/ProgressBar.vue'), + 'primevue/message': path.resolve(__dirname, '/components/message/Message.vue'), + 'primevue/tree': path.resolve(__dirname, '/components/tree/Tree.vue'), + 'primevue/confirmationeventbus': path.resolve(__dirname, '/components/confirmationeventbus/ConfirmationEventBus.js'), + 'primevue/toasteventbus': path.resolve(__dirname, '/components/toasteventbus/ToastEventBus.js'), + 'primevue/overlayeventbus': path.resolve(__dirname, '/components/overlayeventbus/OverlayEventBus.js'), + 'primevue/terminalservice': path.resolve(__dirname, '/components/terminalservice/TerminalService.js'), + 'primevue/dynamicdialogeventbus': path.resolve(__dirname, '/components/dynamicdialogeventbus/DynamicDialogEventBus.js'), + 'primevue/virtualscroller': path.resolve(__dirname, '/components/virtualscroller/VirtualScroller.vue') + }, + }, + } \ No newline at end of file