remove mocha reports (cypress coverage sufficient)

master
JFH 2021-07-25 21:21:54 +02:00
parent f6041b5740
commit c4f0431436
7 changed files with 2334 additions and 6772 deletions

View File

@ -8,10 +8,9 @@ module.exports = {
"plugin:promise/recommended",
"plugin:import/errors",
"plugin:markdown/recommended",
"plugin:sonarjs/recommended",
"eslint:recommended"
],
plugins: [ "jsdoc", "promise", "html", "import", "sonarjs" ],
plugins: [ "jsdoc", "promise", "html", "import" ],
parserOptions: {
ecmaVersion: 2020,
sourceType: "module"
@ -29,8 +28,6 @@ module.exports = {
"one-var": [ "error", "never" ],
/** @todo jsdoc should be made warn or error */
"valid-jsdoc": "off",
/** @todo cognitive complexity should be much lower (25-50?) */
"sonarjs/cognitive-complexity": [ "warn", 200 ],
/** @todo no param reassign creates too many warnings but should be a warning */
"no-param-reassign": "off",
/** @todo no use before define creates too many warnings but should be a warning */
@ -40,7 +37,6 @@ module.exports = {
"comma-dangle": [ "error" ],
"node/no-unsupported-features/es-syntax": 0,
"no-unused-vars": [ "error", { "argsIgnorePattern": "^_" } ],
"sonarjs/no-duplicate-string": 0,
"semi" : "error",
"prefer-const": "error",
"no-trailing-spaces": "error",

View File

@ -12,8 +12,6 @@ cypress.env.json
coverage/**
.nyc_output
instrumented/**
mochawesome-report/**
mochawesome.json
releases

View File

@ -1,10 +1,6 @@
{
"baseUrl": "http://localhost:8000",
"reporter": "cypress-multi-reporters",
"video": false,
"reporterOptions": {
"configFile": "mocha-multi-reporters.json"
},
"ignoreTestFiles": ["**/__snapshots__/*", "**/__image_snapshots__/*"],
"defaultCommandTimeout": 10000,
"pageLoadTimeout": 120000,

View File

@ -1,9 +0,0 @@
{
"mochawesomeReporterOptions": {
"reportDir": "cypress/results",
"overwrite": false,
"html": false,
"json": true
},
"reporterEnabled": "mochawesome"
}

8883
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "svgedit",
"version": "7.0.0-preview",
"version": "7.0.0-beta.1",
"description": "Powerful SVG-Editor for your browser ",
"main": "dist/index.js",
"module": "dist/index.js",
@ -16,11 +16,11 @@
"lint": "eslint --ext js,html,md .",
"test": "run-s cypress:instrument cypress:test",
"cypress:instrument": "rimraf instrumented && cp-cli src instrumented && nyc instrument --compact=false src instrumented",
"cypress:test": "start-server-and-test start http://localhost:8000/instrumented/editor/index.html cypress:run",
"cypress:run": "run-s -n -c cypress:run-no-badge report-summary-mocha-full",
"cypress:test": "start-server-and-test start:test http://localhost:8000/instrumented/editor/index.html cypress:run",
"build": "rollup -c",
"build:watch": "rollup -c --watch",
"start": "web-dev-server --app-index src/editor/index.html --open --node-resolve",
"start:test": "web-dev-server --app-index src/editor/index.html --node-resolve",
"start:watch": "web-dev-server --app-index src/editor/index.html --open --node-resolve --watch",
"cypress:open": "run-p start cypress:open-no-start",
"cypress:open-no-start": "cypress open",
@ -33,25 +33,11 @@
"build-docs": "run-s -c build-docs-remove build-docs-create",
"build-and-open-docs-no-start": "run-s build-docs open-docs-no-start",
"build-and-open-docs": "run-s build-docs open-docs",
"report": "run-s report-no-mochawesome mochawesome-cli",
"report-summary": "run-s report-text-summary mochawesome-cli-dot",
"coverage-badge": "coveradge badges/coverage-badge",
"compress-images": "imageoptim \"src/editor/extensions/*.png\" \"src/editor/spinbtn/*.png\" \"src/editor/jgraduate/images/*.{png,gif}\" \"src/editor/images/*.png\"",
"remark": "remark -q -f .",
"prepublishOnly": "run-s license-badges copy prep build-docs",
"open-tests": "run-s cypress:instrument cypress:open",
"cypress:merge": "mochawesome-merge \"cypress/results/mochaw*.json\" > mochawesome.json && marge mochawesome.json && mbg --file ./mochawesome.json --badge_output badges/tests-badge.svg",
"cypress:run-only": "rimraf \"cypress/results/mochaw*.json\" && rimraf \".nyc_output/*\" && cypress run -q",
"cypress:run-no-badge": "run-s -c cypress:run-only cypress:merge",
"mochawesome-cli": "node tools/mochawesome-cli.js",
"mochawesome-cli-dot": "npm run mochawesome-cli -- --dot",
"report-no-mochawesome": "nyc report",
"report-text-summary": "nyc report --reporter=text-summary",
"report-summary-mocha-full": "run-s report-text-summary mochawesome-cli",
"test-only-no-report": "run-p start cypress:run-only",
"test-no-cov-no-core-rollup": "run-s eslint prep-no-core-rollup test-only",
"test-no-cov": "run-s prep test-only",
"test-no-core-rollup": "run-s eslint cypress:instrument test-no-cov-no-core-rollup"
"cypress:run": "rimraf \".nyc_output/*\" && cypress run -q",
"report-text-summary": "nyc report --reporter=text-summary"
},
"repository": {
"type": "git",
@ -95,26 +81,24 @@
"@babel/polyfill": "7.12.1",
"@web/dev-server-rollup": "0.3.4",
"canvg": "3.0.7",
"core-js": "3.14.0",
"core-js": "3.15.2",
"elix": "15.0.0",
"html2canvas": "^1.1.4",
"i18next": "20.3.1",
"html2canvas": "1.1.4",
"i18next": "20.3.5",
"jspdf": "2.3.1",
"pathseg": "1.2.0",
"regenerator-runtime": "0.13.7",
"rollup-plugin-polyfill-node": "0.6.2",
"regenerator-runtime": "0.13.9",
"rollup-plugin-polyfill-node": "0.7.0",
"svg2pdf.js": "2.1.0"
},
"devDependencies": {
"@babel/core": "7.14.3",
"@babel/preset-env": "7.14.4",
"@babel/register": "7.13.16",
"@babel/runtime-corejs3": "7.14.0",
"@cypress/code-coverage": "3.9.6",
"@babel/core": "7.14.8",
"@babel/preset-env": "7.14.8",
"@babel/register": "7.14.5",
"@babel/runtime-corejs3": "7.14.8",
"@cypress/code-coverage": "3.9.9",
"@cypress/fiddle": "1.19.2",
"@fintechstudios/eslint-plugin-chai-as-promised": "3.1.0",
"@hkdobrev/run-if-changed": "0.3.1",
"@mysticatea/eslint-plugin": "13.0.0",
"@rollup/plugin-babel": "5.3.0",
"@rollup/plugin-commonjs": "18.0.0",
"@rollup/plugin-dynamic-import-vars": "1.1.1",
@ -122,69 +106,55 @@
"@rollup/plugin-replace": "2.4.2",
"@rollup/plugin-url": "6.0.0",
"@web/dev-server": "0.1.17",
"axe-core": "4.2.2",
"axe-core": "4.3.1",
"babel-plugin-transform-object-rest-spread": "7.0.0-beta.3",
"copyfiles": "2.4.1",
"core-js-bundle": "3.14.0",
"coveradge": "0.6.0",
"cp-cli": "2.0.0",
"cross-var": "1.1.0",
"cypress": "7.5.0",
"cypress": "8.0.0",
"cypress-axe": "0.12.2",
"cypress-multi-reporters": "1.5.0",
"cypress-plugin-snapshots": "1.4.4",
"eslint": "7.28.0",
"eslint": "7.31.0",
"eslint-config-standard": "16.0.3",
"eslint-plugin-array-func": "3.1.7",
"eslint-plugin-chai-expect": "2.2.0",
"eslint-plugin-chai-expect-keywords": "2.1.0",
"eslint-plugin-chai-friendly": "0.7.1",
"eslint-plugin-compat": "^3.9.0",
"eslint-plugin-compat": "3.11.1",
"eslint-plugin-cypress": "2.11.3",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-html": "^6.1.2",
"eslint-plugin-html": "6.1.2",
"eslint-plugin-import": "2.23.4",
"eslint-plugin-jsdoc": "35.1.3",
"eslint-plugin-markdown": "^2.2.0",
"eslint-plugin-mocha": "9.0.0",
"eslint-plugin-mocha-cleanup": "1.9.1",
"eslint-plugin-no-unsanitized": "^3.1.5",
"eslint-plugin-jsdoc": "36.0.2",
"eslint-plugin-markdown": "2.2.0",
"eslint-plugin-no-unsanitized": "3.1.5",
"eslint-plugin-no-use-extend-native": "0.5.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-sonarjs": "^0.7.0",
"eslint-plugin-promise": "5.1.0",
"eslint-plugin-standard": "4.1.0",
"eslint-plugin-unicorn": "33.0.1",
"eslint-plugin-unicorn": "34.0.1",
"imageoptim-cli": "3.0.2",
"jamilih": "0.54.0",
"jsdoc": "3.6.7",
"mocha": "9.0.0",
"mocha-badge-generator": "0.9.0",
"mochawesome": "6.2.2",
"mochawesome-merge": "4.2.0",
"mochawesome-report-generator": "5.2.0",
"node-static": "0.7.11",
"npm-run-all": "4.1.5",
"nyc": "15.1.0",
"open-cli": "6.0.1",
"promise-fs": "2.1.1",
"qr-manipulation": "^0.7.0",
"query-result": "^1.0.5",
"qr-manipulation": "0.7.0",
"query-result": "1.0.5",
"remark-cli": "9.0.0",
"remark-lint-ordered-list-marker-value": "2.0.1",
"requirejs": "2.3.6",
"rimraf": "3.0.2",
"rollup": "2.51.1",
"rollup": "2.54.0",
"rollup-plugin-copy": "3.4.0",
"rollup-plugin-filesize": "9.1.1",
"rollup-plugin-node-polyfills": "0.2.1",
"rollup-plugin-progress": "1.1.2",
"rollup-plugin-re": "1.0.7",
"rollup-plugin-terser": "7.0.2",
"stackblur-canvas": "2.5.0",
"start-server-and-test": "^1.12.5",
"systemjs": "6.10.0",
"typescript": "4.3.2",
"underscore": "1.13.1"
"start-server-and-test": "1.13.0"
}
}

View File

@ -1,114 +0,0 @@
// Filed the following to support this file's functionality:
// https://github.com/cypress-io/cypress/issues/6585
// Todo: Show /test (i.e., `unit.js`) test results at beginning?
/**
* @file A CLI reporter against after-the-fact compiled (merged Mochawesome)
* Mocha results.
* @cli-arg {"doc"|"dot"|"json-stream"|"json"|"landing"|"list"|
* "markdown"|"min"|"nyan"|"progress"|"spec"|"tap"|
* "xunit"} [0="spec"] The Mocha reporter to use
*/
'use strict';
const reporterFile = process.argv[2]
? process.argv[2].replace(/^--/u, '')
: 'spec';
const path = '../mochawesome.json';
const MochaReporter = require(`mocha/lib/reporters/${reporterFile}.js`);
const Suite = require('mocha/lib/suite.js');
const Test = require('mocha/lib/test.js');
const Runner = require('mocha/lib/runner.js');
const { constants: {
EVENT_RUN_BEGIN,
EVENT_RUN_END,
EVENT_SUITE_BEGIN,
EVENT_SUITE_END,
EVENT_TEST_FAIL,
EVENT_TEST_PASS,
EVENT_TEST_PENDING
} } = require('mocha/lib/runner.js');
const { results, stats } = require(path);
const runner = new Runner(
new Suite('', null, true)
);
runner.stats = stats;
console.info('Mocha results:');
// eslint-disable-next-line no-new -- Has side effects
new MochaReporter(runner);
runner.emit(EVENT_RUN_BEGIN);
results.forEach(({ suites }) => {
suites.forEach(function handleSuite (st) {
const ste = Object.assign(new Suite(''), st);
ste.suites.forEach((s, i) => {
ste.suites[i] = handleSuite(s);
});
runner.emit(EVENT_SUITE_BEGIN, ste);
ste.tests.forEach((ts) => {
const tst = new Test('', () => {
//
});
Object.entries(ts).forEach(([ k, v ]) => {
// `fullTitle` is a string in mochawesome but a function in Mocha
if (k !== 'fullTitle') {
tst[k] = v;
}
});
tst.parent = ste; // Seems to work
const ev = tst.pass
? EVENT_TEST_PASS
: tst.fail
? EVENT_TEST_FAIL
// No distinct event for pending vs. skipped?
: tst.pending
? EVENT_TEST_PENDING
: tst.skipped
? EVENT_TEST_PENDING
: null;
if (!ev) {
throw new Error(
'Unexpected test event (not passing, failing, or pending): ' +
tst.title
);
}
runner.emit(ev, tst, tst.fail ? tst.err : undefined);
});
runner.emit(EVENT_SUITE_END, ste);
return ste;
});
});
runner.emit(EVENT_RUN_END);
const {
// passes, tests, pending,
end
} = stats;
/*
console.log(
`Passing ${passes}/${tests}${pending ? `Pending ${pending}` : ''}`
);
*/
const endDate = new Date(Date.parse(end));
const lastRan = new Intl.DateTimeFormat('en-US', {
year: 'numeric', month: 'numeric', day: 'numeric',
hour: 'numeric', minute: 'numeric'
}).format(endDate);
console.info(
`Tests finished: ${lastRan}`
);