feat: Use vitest instead of jest, run all the specs anywhere in app/ folder in the CI (#9722)
Due to the pattern `**/specs/*.spec.js` defined in CircleCI, none of the frontend spec in the folders such as `specs/<domain-name>/getters.spec.js` were not executed in Circle CI. This PR fixes the issue, along with the following changes: - Use vitest instead of jest - Remove jest dependancies - Update tests to work with vitest --------- Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
@@ -29,7 +29,7 @@ global.chatwootWebChannel = {
|
||||
|
||||
describe('availabilityMixin', () => {
|
||||
beforeEach(() => {
|
||||
jest.useRealTimers();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('returns valid isInBetweenWorkingHours if in different timezone', () => {
|
||||
@@ -37,9 +37,9 @@ describe('availabilityMixin', () => {
|
||||
render() {},
|
||||
mixins: [availabilityMixin],
|
||||
};
|
||||
jest
|
||||
.useFakeTimers('modern')
|
||||
.setSystemTime(new Date('Thu Apr 14 2022 06:04:46 GMT+0530'));
|
||||
vi.useFakeTimers('modern').setSystemTime(
|
||||
new Date('Thu Apr 14 2022 06:04:46 GMT+0530')
|
||||
);
|
||||
const Constructor = Vue.extend(Component);
|
||||
const vm = new Constructor().$mount();
|
||||
const wrapper = createWrapper(vm);
|
||||
@@ -52,9 +52,9 @@ describe('availabilityMixin', () => {
|
||||
render() {},
|
||||
mixins: [availabilityMixin],
|
||||
};
|
||||
jest
|
||||
.useFakeTimers('modern')
|
||||
.setSystemTime(new Date('Thu Apr 14 2022 09:01:46 GMT+0530'));
|
||||
vi.useFakeTimers('modern').setSystemTime(
|
||||
new Date('Thu Apr 14 2022 09:01:46 GMT+0530')
|
||||
);
|
||||
const Constructor = Vue.extend(Component);
|
||||
const wrapper = createWrapper(new Constructor().$mount());
|
||||
expect(wrapper.vm.isInBetweenTheWorkingHours).toBe(true);
|
||||
@@ -69,9 +69,9 @@ describe('availabilityMixin', () => {
|
||||
global.chatwootWebChannel.workingHours = [
|
||||
{ day_of_week: 3, closed_all_day: true },
|
||||
];
|
||||
jest
|
||||
.useFakeTimers('modern')
|
||||
.setSystemTime(new Date('Thu Apr 14 2022 09:01:46 GMT+0530'));
|
||||
vi.useFakeTimers('modern').setSystemTime(
|
||||
new Date('Thu Apr 14 2022 09:01:46 GMT+0530')
|
||||
);
|
||||
|
||||
const Constructor = Vue.extend(Component);
|
||||
const vm = new Constructor().$mount();
|
||||
@@ -88,9 +88,9 @@ describe('availabilityMixin', () => {
|
||||
global.chatwootWebChannel.workingHours = [
|
||||
{ day_of_week: 3, open_all_day: true },
|
||||
];
|
||||
jest
|
||||
.useFakeTimers('modern')
|
||||
.setSystemTime(new Date('Thu Apr 14 2022 09:01:46 GMT+0530'));
|
||||
vi.useFakeTimers('modern').setSystemTime(
|
||||
new Date('Thu Apr 14 2022 09:01:46 GMT+0530')
|
||||
);
|
||||
|
||||
const Constructor = Vue.extend(Component);
|
||||
const vm = new Constructor().$mount();
|
||||
|
||||
Reference in New Issue
Block a user