mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
In the latest versions of ESLint, more and more formatting rules were removed or declared deprecated. These rules have been integrated into the new Stylistic package (https://eslint.style/guide/why) and expanded. Stylistic acts as a better formatter for JavaScript as Prettier. With this PR there are many changes that make the code more uniform, but it may be difficult to review due to the large amount. Even if I have no worries about the changes, perhaps this would be something for the release after next. Let me know what you think.
31 lines
1003 B
JavaScript
31 lines
1003 B
JavaScript
const TestSequencer = require("@jest/test-sequencer").default;
|
|
|
|
class CustomSequencer extends TestSequencer {
|
|
sort (tests) {
|
|
const orderPath = ["unit", "electron", "e2e"];
|
|
return tests.sort((testA, testB) => {
|
|
let indexA = -1;
|
|
let indexB = -1;
|
|
const reg = ".*/tests/([^/]*).*";
|
|
|
|
// move calendar and newsfeed at the end
|
|
if (testA.path.includes("e2e/modules/calendar_spec") || testA.path.includes("e2e/modules/newsfeed_spec")) return 1;
|
|
if (testB.path.includes("e2e/modules/calendar_spec") || testB.path.includes("e2e/modules/newsfeed_spec")) return -1;
|
|
|
|
let matchA = new RegExp(reg, "g").exec(testA.path);
|
|
if (matchA.length > 0) indexA = orderPath.indexOf(matchA[1]);
|
|
|
|
let matchB = new RegExp(reg, "g").exec(testB.path);
|
|
if (matchB.length > 0) indexB = orderPath.indexOf(matchB[1]);
|
|
|
|
if (indexA === indexB) return 0;
|
|
|
|
if (indexA === -1) return 1;
|
|
if (indexB === -1) return -1;
|
|
return indexA < indexB ? -1 : 1;
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = CustomSequencer;
|