commit
b1d11216ba
|
@ -8,7 +8,6 @@ docs/jsdoc
|
|||
archive
|
||||
|
||||
jsconfig.json
|
||||
mochawesome-report
|
||||
releases
|
||||
!.eslintrc.js
|
||||
!.ncurc.js
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -8,8 +8,6 @@ cypress.env.json
|
|||
coverage
|
||||
instrumented
|
||||
.nyc_output
|
||||
mochawesome-report
|
||||
mochawesome.json
|
||||
.vscode
|
||||
.eslintcache
|
||||
.DS_Store
|
||||
|
|
|
@ -12,8 +12,6 @@ cypress.env.json
|
|||
coverage/**
|
||||
.nyc_output
|
||||
instrumented/**
|
||||
mochawesome-report/**
|
||||
mochawesome.json
|
||||
|
||||
releases
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"mochawesomeReporterOptions": {
|
||||
"reportDir": "cypress/results",
|
||||
"overwrite": false,
|
||||
"html": false,
|
||||
"json": true
|
||||
},
|
||||
"reporterEnabled": "mochawesome"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
104
package.json
104
package.json
|
@ -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",
|
||||
|
@ -15,15 +15,16 @@
|
|||
"scripts": {
|
||||
"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",
|
||||
"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",
|
||||
"cypress:run": "rimraf \".nyc_output/*\" && cypress run -q && nyc report --reporter=text-summary",
|
||||
"cypress:instrument": "rimraf instrumented && cp-cli src instrumented && nyc instrument --compact=false src instrumented",
|
||||
"cypress:test": "start-server-and-test start:test http://localhost:8000/instrumented/editor/index.html cypress:run",
|
||||
"start-allow-origin": "static -p 8001 -H '{\"Access-Control-Allow-Origin\": \"*\"}'",
|
||||
"start-embedded": "run-p start start-allow-origin",
|
||||
"open-docs-no-start": "open-cli http://localhost:8000/docs/jsdoc/",
|
||||
|
@ -33,25 +34,9 @@
|
|||
"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"
|
||||
"prepublishOnly": "run-s license-badges copy prep build-docs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -93,98 +78,81 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"@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",
|
||||
"@rollup/plugin-node-resolve": "13.0.0",
|
||||
"@rollup/plugin-replace": "2.4.2",
|
||||
"@rollup/plugin-dynamic-import-vars": "1.3.0",
|
||||
"@rollup/plugin-node-resolve": "13.0.4",
|
||||
"@rollup/plugin-replace": "3.0.0",
|
||||
"@rollup/plugin-url": "6.0.0",
|
||||
"@web/dev-server": "0.1.17",
|
||||
"axe-core": "4.2.2",
|
||||
"@web/dev-server-rollup": "0.3.6",
|
||||
"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",
|
||||
"core-js-bundle": "3.15.2",
|
||||
"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",
|
||||
"open-cli": "7.0.0",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,13 +52,6 @@ const config = [ {
|
|||
file: 'dist/editor/xdomain-index.js',
|
||||
intro: 'const XDOMAIN = true;'
|
||||
}
|
||||
/*
|
||||
{
|
||||
format: 'system',
|
||||
dir: 'dist/editor/system',
|
||||
inlineDynamicImports: true
|
||||
}
|
||||
*/
|
||||
],
|
||||
plugins: [
|
||||
copy({
|
||||
|
@ -74,27 +67,6 @@ const config = [ {
|
|||
transform: (contents) => contents.toString()
|
||||
.replace('<script type="module" src="index.js">', '<script type="module" src="xdomain-index.js">')
|
||||
},
|
||||
/*
|
||||
{
|
||||
src: 'src/editor/index.html',
|
||||
dest: ['dist/editor/system'],
|
||||
rename: 'index.html',
|
||||
transform: (contents) => contents.toString()
|
||||
.replace('<script type="module" src="index.js">',
|
||||
`<script>
|
||||
const systemJsLoaderTag = document.createElement('script');
|
||||
systemJsLoaderTag.src = './s.min.js';
|
||||
systemJsLoaderTag.addEventListener('load', function () {
|
||||
System.import('./index.js');
|
||||
});
|
||||
document.head.appendChild(systemJsLoaderTag);
|
||||
`)
|
||||
},
|
||||
{
|
||||
src: ['node_modules/systemjs/dist/s.min.js', 'node_modules/systemjs/dist/s.min.js.map'],
|
||||
dest: 'dist/editor/system'
|
||||
},
|
||||
*/
|
||||
{ src: 'src/editor/images', dest },
|
||||
{ src: 'src/editor/extensions/ext-shapes/shapelib', dest: dest.map((d) => `${d}/extensions/ext-shapes`) },
|
||||
{ src: 'src/editor/embedapi.html', dest },
|
||||
|
|
|
@ -526,7 +526,6 @@ class Editor extends EditorStartup {
|
|||
this.workarea.scroll();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line sonarjs/no-collapsible-if
|
||||
if (this.configObj.urldata.storagePrompt !== true && this.storagePromptState === 'ignore') {
|
||||
if ($id("dialog_box") != null) $id("dialog_box").style.display = 'none';
|
||||
}
|
||||
|
@ -614,7 +613,6 @@ class Editor extends EditorStartup {
|
|||
this.multiselected = (elems.length >= 2 && !isNullish(elems[1]));
|
||||
// Only updating fields for single elements for now
|
||||
if (!this.multiselected) {
|
||||
// eslint-disable-next-line sonarjs/no-small-switch
|
||||
switch (mode) {
|
||||
case 'rotate': {
|
||||
const ang = this.svgCanvas.getRotationAngle(elem);
|
||||
|
|
|
@ -295,7 +295,6 @@ class EditorStartup {
|
|||
if (evt.type === 'mouseup') { panning = false; }
|
||||
return false;
|
||||
});
|
||||
// eslint-disable-next-line sonarjs/no-identical-functions
|
||||
$id('svgcanvas').addEventListener('mousemove', function(evt) {
|
||||
if (panning === false) { return true; }
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable sonarjs/no-collapsible-if */
|
||||
/**
|
||||
* @param {any} obj
|
||||
* @returns {any}
|
||||
|
|
|
@ -48,7 +48,6 @@ export class SeListItem extends HTMLElement {
|
|||
*/
|
||||
attributeChangedCallback (name, oldValue, newValue) {
|
||||
if (oldValue === newValue) return;
|
||||
// eslint-disable-next-line sonarjs/no-small-switch
|
||||
switch (name) {
|
||||
case 'option':
|
||||
this.$menuitem.setAttribute('option', newValue);
|
||||
|
|
|
@ -178,7 +178,6 @@ export class SESpinInput extends HTMLElement {
|
|||
this.value = e.target.value;
|
||||
this.dispatchEvent(this.$event);
|
||||
});
|
||||
// eslint-disable-next-line sonarjs/no-identical-functions
|
||||
this.$input.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
this.value = e.target.value;
|
||||
|
|
|
@ -119,7 +119,6 @@ export class SeCMenuLayerDialog extends HTMLElement {
|
|||
*/
|
||||
attributeChangedCallback (name, oldValue, newValue) {
|
||||
if (oldValue === newValue) return;
|
||||
// eslint-disable-next-line sonarjs/no-small-switch
|
||||
switch (name) {
|
||||
case 'value':
|
||||
this.source = newValue;
|
||||
|
|
|
@ -122,7 +122,6 @@ export class SeExportDialog extends HTMLElement {
|
|||
* @returns {void}
|
||||
*/
|
||||
attributeChangedCallback (name, oldValue, newValue) {
|
||||
// eslint-disable-next-line sonarjs/no-small-switch
|
||||
let node;
|
||||
switch (name) {
|
||||
case 'dialog':
|
||||
|
|
|
@ -455,7 +455,6 @@ export default {
|
|||
header.textContent = allLibs;
|
||||
back.style.display = 'none';
|
||||
});
|
||||
// eslint-disable-next-line sonarjs/no-identical-functions
|
||||
back.addEventListener('touchend', function () {
|
||||
frame.setAttribute('src', 'about:blank');
|
||||
frame.style.display = 'none';
|
||||
|
@ -499,7 +498,6 @@ export default {
|
|||
libOpts.style.display = 'none';
|
||||
back.style.display = 'block';
|
||||
});
|
||||
// eslint-disable-next-line sonarjs/no-identical-functions
|
||||
li.addEventListener('touchend', function () {
|
||||
frame.setAttribute('src', url);
|
||||
frame.style.display = 'block';
|
||||
|
|
|
@ -96,7 +96,6 @@ class BottomPanel {
|
|||
});
|
||||
}
|
||||
if (bNoStroke && bNoFill) {
|
||||
// eslint-disable-next-line sonarjs/no-identical-functions
|
||||
buttonsNeedingFillAndStroke.forEach((btn) => {
|
||||
// if btn is pressed, change to select button
|
||||
if ($id(btn).pressed) {
|
||||
|
|
|
@ -508,7 +508,6 @@ export const setStrokeWidthMethod = function (val) {
|
|||
* @param {Element} e
|
||||
* @returns {void}
|
||||
*/
|
||||
// eslint-disable-next-line sonarjs/no-identical-functions
|
||||
function addNonG(e) {
|
||||
if (e.nodeName !== 'g') {
|
||||
elems.push(e);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable sonarjs/no-duplicate-string */
|
||||
/**
|
||||
* Tools for SVG sanitization.
|
||||
* @module sanitize
|
||||
|
|
|
@ -443,7 +443,6 @@ export const groupSelectedElements = function (type, urlArg) {
|
|||
let cmdStr = '';
|
||||
let url;
|
||||
|
||||
// eslint-disable-next-line sonarjs/no-small-switch
|
||||
switch (type) {
|
||||
case 'a': {
|
||||
cmdStr = 'Make hyperlink';
|
||||
|
|
|
@ -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}`
|
||||
);
|
Loading…
Reference in New Issue