test order

This commit is contained in:
Karsten Hassel 2021-06-13 23:06:20 +02:00
parent d2fde2bfc8
commit a2083be76b
2 changed files with 17 additions and 4 deletions

View File

@ -10,10 +10,10 @@
"install": "echo \"Installing vendor files ...\n\" && cd vendor && npm install --loglevel=error", "install": "echo \"Installing vendor files ...\n\" && cd vendor && npm install --loglevel=error",
"install-fonts": "echo \"Installing fonts ...\n\" && cd fonts && npm install --loglevel=error", "install-fonts": "echo \"Installing fonts ...\n\" && cd fonts && npm install --loglevel=error",
"postinstall": "npm run install-fonts && echo \"MagicMirror installation finished successfully! \n\"", "postinstall": "npm run install-fonts && echo \"MagicMirror installation finished successfully! \n\"",
"test": "NODE_ENV=test jest -i --forceExit", "test": "NODE_ENV=test jest -i",
"test:coverage": "NODE_ENV=test nyc --reporter=lcov --reporter=text jest -i --forceExit", "test:coverage": "NODE_ENV=test nyc --reporter=lcov --reporter=text jest -i",
"test:e2e": "NODE_ENV=test jest --selectProjects e2e -i --forceExit", "test:e2e": "NODE_ENV=test jest --selectProjects e2e -i",
"test:unit": "NODE_ENV=test jest --selectProjects unit -i --forceExit", "test:unit": "NODE_ENV=test jest --selectProjects unit -i",
"test:prettier": "prettier . --check", "test:prettier": "prettier . --check",
"test:js": "eslint js/**/*.js modules/default/**/*.js clientonly/*.js serveronly/*.js translations/*.js vendor/*.js tests/**/*.js config/* --config .eslintrc.json --quiet", "test:js": "eslint js/**/*.js modules/default/**/*.js clientonly/*.js serveronly/*.js translations/*.js vendor/*.js tests/**/*.js config/* --config .eslintrc.json --quiet",
"test:css": "stylelint css/main.css modules/default/**/*.css --config .stylelintrc.json", "test:css": "stylelint css/main.css modules/default/**/*.css --config .stylelintrc.json",
@ -93,6 +93,7 @@
}, },
"jest": { "jest": {
"verbose": true, "verbose": true,
"testSequencer": "<rootDir>/tests/e2e/testSequencer.js",
"projects": [ "projects": [
{ {
"displayName": "unit", "displayName": "unit",
@ -119,6 +120,7 @@
], ],
"testPathIgnorePatterns": [ "testPathIgnorePatterns": [
"<rootDir>/tests/e2e/modules/mocks", "<rootDir>/tests/e2e/modules/mocks",
"<rootDir>/tests/e2e/testSequencer.js",
"<rootDir>/tests/e2e/global-setup.js" "<rootDir>/tests/e2e/global-setup.js"
] ]
} }

View File

@ -0,0 +1,11 @@
const Sequencer = require("@jest/test-sequencer").default;
class CustomSequencer extends Sequencer {
sort(tests) {
let copyTests = Array.from(tests);
copyTests = copyTests.sort((testA, testB) => (testA.path > testB.path ? -1 : 1));
return (copyTests = copyTests.sort((testA, testB) => (testA.path.includes("/modules/") ? 1 : -1)));
}
}
module.exports = CustomSequencer;