mirror of
https://github.com/fergalmoran/onearmy-community-platform.git
synced 2025-12-22 09:37:54 +00:00
fix: run vitest tests sequentially (#3698)
fix: run vitest tests sequentially & fix flaky tests
This commit is contained in:
@@ -193,4 +193,4 @@
|
||||
"node": ">=20"
|
||||
},
|
||||
"packageManager": "yarn@3.6.4"
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,9 @@ const vitestConfig: VitestUserConfigInterface = {
|
||||
},
|
||||
include: ['./src/**/*.test.?(c|m)[jt]s?(x)'],
|
||||
logHeapUsage: true,
|
||||
sequence: {
|
||||
hooks: 'list',
|
||||
},
|
||||
},
|
||||
}
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
|
||||
@@ -143,7 +143,7 @@ describe('Research Article', () => {
|
||||
|
||||
// Assert
|
||||
await waitFor(() => {
|
||||
expect(wrapper.getAllByText('With contributions from:')).toHaveLength(1)
|
||||
expect(wrapper.getAllByText('With contributions from')).toHaveLength(1)
|
||||
expect(wrapper.getAllByText('example-username')).toHaveLength(2)
|
||||
expect(wrapper.getAllByText('another-example-username')).toHaveLength(2)
|
||||
expect(wrapper.getAllByTestId('Username: known flag')).toHaveLength(4)
|
||||
@@ -241,15 +241,24 @@ describe('Research Article', () => {
|
||||
})
|
||||
|
||||
// Assert
|
||||
await waitFor(() => {
|
||||
expect(wrapper.getAllByText('With contributions from:')).toHaveLength(1)
|
||||
expect(wrapper.getAllByText('example-username')).toHaveLength(2)
|
||||
expect(wrapper.getAllByText('another-example-username')).toHaveLength(2)
|
||||
expect(wrapper.getAllByText('third-example-username')).toHaveLength(1)
|
||||
expect(wrapper.queryByText('fourth-example-username')).toBeNull()
|
||||
expect(wrapper.getAllByTestId('collaborator/creator')).toHaveLength(1)
|
||||
expect(wrapper.getAllByTestId('Username: known flag')).toHaveLength(5)
|
||||
})
|
||||
await waitFor(
|
||||
() => {
|
||||
expect(wrapper.getAllByText('With contributions from')).toHaveLength(
|
||||
1,
|
||||
)
|
||||
expect(wrapper.getAllByText('example-username')).toHaveLength(2)
|
||||
expect(wrapper.getAllByText('another-example-username')).toHaveLength(
|
||||
2,
|
||||
)
|
||||
expect(wrapper.getAllByText('third-example-username')).toHaveLength(1)
|
||||
expect(wrapper.queryByText('fourth-example-username')).toBeNull()
|
||||
expect(wrapper.getAllByTestId('collaborator/creator')).toHaveLength(1)
|
||||
expect(wrapper.getAllByTestId('Username: known flag')).toHaveLength(5)
|
||||
},
|
||||
{
|
||||
timeout: 10000,
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
it('does not show edit timestamp, when create displays the same value', async () => {
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('filterMapPinsByType', () => {
|
||||
|
||||
it('returns only verified pins', () => {
|
||||
const mapPins: Partial<IMapPin>[] = [
|
||||
{ _deleted: false, type: 'member', verified: true },
|
||||
{ _deleted: false, type: 'collection-point', verified: true },
|
||||
{ _deleted: false, type: 'machine-builder' },
|
||||
]
|
||||
expect(
|
||||
|
||||
@@ -4,10 +4,7 @@ import type { IMapPin } from 'src/models/maps.models'
|
||||
|
||||
// filter pins to include matched pin type or subtype
|
||||
// excluding items which have been marked as deleted=true
|
||||
export const filterMapPinsByType = (
|
||||
mapPins: IMapPin[],
|
||||
filters: Array<string>,
|
||||
) => {
|
||||
export const filterMapPinsByType = (mapPins: IMapPin[], filters: string[]) => {
|
||||
const filterList = new Set(filters)
|
||||
let filteredPins = mapPins
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ const vitestConfig: VitestUserConfigInterface = {
|
||||
},
|
||||
include: ['./src/**/*.test.?(c|m)[jt]s?(x)'],
|
||||
logHeapUsage: true,
|
||||
sequence: {
|
||||
hooks: 'list',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user