Files
directus/tests/setup/customSequencer.js
ian 68066eccb7 Remove UTC conversion from date, time and datetime fields (#10956)
* Remove UTC conversion from date, time and datetime fields

* Fix mysql / maria timestamps when not in UTC timezone

* Add sequential tests with node timezone change

* Increase connection attempt check

* Add error catching in tests flow setup

* Check for server connectivity

* Fix promises

* Fix timestamp inconsistencies

* Revert to previously used parseISO

* Ensure database and directus connection

* Add another timezone to test positive and negative GMT

* Set local server hostname to localhost

* Add tests for SQLite

* Use notNullable primary key

* Revert connection testing sleep duration

* Fix nested transactions on SQLite

* Increase MSSQL request timeout

* Add type override flag for SQLite

* Remove commented code

* Add type override flags for Oracle

* Updated test file path

* Increase test servers launch timeout

* Increase test servers launch timeout

* Update format of tests

* Fix typo

* Increase test timeout for CockroachDB

* Add type overrides when creating fields through collections service

* Remove time field type conversion for Oracle

* Update collections list in test

* Remove check for time field in Oracle

* Add missing continue...

* Remove database override

* Add note for SQLite

* Rename flags and extract shared util

* Abstract remaining DB specific checks

* Revert flags renaming except renaming of test files

* Use date helper to add field flag

* Move field date typecasting upstream

* Use timestamp helper for date-created and date-updated

* Fix tests

* Remove unused vars

* Add tests for date-created

* Increase connection attempt count

* Fix test for mariadb

* Increase allowable difference to account for delays

* Add tests for date-updated

* Fix tests again for mariadb

* Add date helpers post merge

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2022-04-06 16:15:22 -04:00

28 lines
719 B
JavaScript

const Sequencer = require('@jest/test-sequencer').default;
const findIndex = require('lodash').findIndex;
const sequentialTestsList = require('./sequentialTests.js').list;
class CustomSequencer extends Sequencer {
async sort(tests) {
const sortedTests = Array.from(tests);
if (sortedTests.length > 1) {
for (let sequentialTest of sequentialTestsList) {
const testIndex = findIndex(sortedTests, (test) => {
return String(test.path).endsWith(sequentialTest.testFilePath);
});
if (testIndex !== -1) {
sortedTests.push(sortedTests.splice(testIndex, 1)[0]);
}
}
}
process.env.totalTestsCount = String(tests.length);
return sortedTests;
}
}
module.exports = CustomSequencer;