mirror of
https://github.com/directus/directus.git
synced 2026-01-14 22:57:56 -05:00
* Fix remaining blackbox test issues * Temporary activation of blackbox tests (sqlite) * Enable hanging-process reporter for now * Revert "Enable hanging-process reporter for now" This reverts commitce490ba229. * Fix hanging by cleaning up sequential list Also prevent this issue in future by logging invalid files in list * Switch remaining tests to `getPort` To get random, available ports * Revert "Temporary activation of blackbox tests (sqlite)" This reverts commita8687a095a.
76 lines
2.0 KiB
TypeScript
76 lines
2.0 KiB
TypeScript
// Tests will run sequentially according to this list
|
|
export const sequentialTestsList: Record<'db' | 'common', SequentialTestsList> = {
|
|
common: {
|
|
before: ['/common/common.test.ts'],
|
|
after: [],
|
|
// If specified, only run these tests sequentially
|
|
only: [
|
|
// '/common/common.test.ts',
|
|
],
|
|
},
|
|
db: {
|
|
before: [
|
|
'/tests/db/seed-database.test.ts',
|
|
'/common/common.test.ts',
|
|
'/tests/db/routes/schema/schema.test.ts',
|
|
'/tests/db/routes/collections/crud.test.ts',
|
|
'/tests/db/routes/fields/change-fields.test.ts',
|
|
'/tests/db/routes/fields/crud.test.ts',
|
|
],
|
|
after: [
|
|
'/tests/db/schema/timezone/timezone.test.ts',
|
|
'/tests/db/schema/timezone/timezone-changed-node-tz-america.test.ts',
|
|
'/tests/db/schema/timezone/timezone-changed-node-tz-asia.test.ts',
|
|
'/tests/db/websocket/auth.test.ts',
|
|
'/tests/db/websocket/general.test.ts',
|
|
'/tests/db/routes/permissions/cache-purge.test.ts',
|
|
'/tests/db/routes/flows/webhook.test.ts',
|
|
'/tests/db/app/cache.test.ts',
|
|
'/tests/db/routes/collections/schema-cache.test.ts',
|
|
],
|
|
// If specified, only run these tests sequentially
|
|
only: [
|
|
// '/tests/db/seed-database.test.ts',
|
|
// '/common/common.test.ts',
|
|
],
|
|
},
|
|
};
|
|
|
|
export function getReversedTestIndex(testFilePath: string, project: 'db' | 'common') {
|
|
const list = sequentialTestsList[project];
|
|
|
|
if (list.only.length > 0) {
|
|
for (let index = 0; index < list.only.length; index++) {
|
|
const onlyTest = list.only[index];
|
|
|
|
if (onlyTest && testFilePath.includes(onlyTest)) {
|
|
return index;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (let index = 0; index < list.before.length; index++) {
|
|
const beforeTest = list.before[index];
|
|
|
|
if (beforeTest && testFilePath.includes(beforeTest)) {
|
|
return index;
|
|
}
|
|
}
|
|
|
|
for (let index = 0; index < list.after.length; index++) {
|
|
const afterTest = list.after[index];
|
|
|
|
if (afterTest && testFilePath.includes(afterTest)) {
|
|
return 0 - list.after.length + index;
|
|
}
|
|
}
|
|
|
|
return list.before.length;
|
|
}
|
|
|
|
type SequentialTestsList = {
|
|
before: string[];
|
|
after: string[];
|
|
only: string[];
|
|
};
|