From 8e3601172c07fbe0ebe0f20b7353f137c250778e Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 24 Sep 2023 15:20:37 -0700 Subject: [PATCH] HTML Reporter: Move internal `diff.js` import to `core.js` Ref https://github.com/qunitjs/qunit/issues/1118. --- src/core.js | 2 ++ src/{html-reporter => core}/diff.js | 8 +++----- src/html-reporter/reporter.js | 3 --- src/{html-reporter => html-runner}/fixture.js | 0 src/{html-reporter => html-runner}/urlparams.js | 0 src/qunit.js | 4 +++- 6 files changed, 8 insertions(+), 9 deletions(-) rename src/{html-reporter => core}/diff.js (99%) rename src/{html-reporter => html-runner}/fixture.js (100%) rename src/{html-reporter => html-runner}/urlparams.js (100%) diff --git a/src/core.js b/src/core.js index 91ffa4367..12e7a72a9 100644 --- a/src/core.js +++ b/src/core.js @@ -19,6 +19,7 @@ import ProcessingQueue from './core/processing-queue'; import { on, emit } from './events'; import onWindowError from './core/onerror'; import onUncaughtException from './core/on-uncaught-exception'; +import diff from './core/diff'; const QUnit = {}; @@ -42,6 +43,7 @@ QUnit.version = '@VERSION'; extend(QUnit, { config, + diff, dump, equiv, reporters, diff --git a/src/html-reporter/diff.js b/src/core/diff.js similarity index 99% rename from src/html-reporter/diff.js rename to src/core/diff.js index eb8fb97c5..66d6b9ee4 100644 --- a/src/html-reporter/diff.js +++ b/src/core/diff.js @@ -1,4 +1,4 @@ -import QUnit from '../core'; +/* eslint-disable indent */ import { escapeText } from '../core/utilities'; /* @@ -29,7 +29,6 @@ import { escapeText } from '../core/utilities'; * Usage: QUnit.diff(expected, actual) * */ -QUnit.diff = (function () { function DiffMatchPatch () { } @@ -1112,7 +1111,7 @@ QUnit.diff = (function () { } }; - return function (o, n) { + export default function diff (o, n) { let diff, output, text; diff = new DiffMatchPatch(); output = diff.DiffMain(o, n); @@ -1120,5 +1119,4 @@ QUnit.diff = (function () { text = diff.diffPrettyHtml(output); return text; - }; -}()); + } diff --git a/src/html-reporter/reporter.js b/src/html-reporter/reporter.js index 7b41864b9..21136710d 100644 --- a/src/html-reporter/reporter.js +++ b/src/html-reporter/reporter.js @@ -1,4 +1 @@ -import './fixture'; -import './diff'; -import './urlparams'; import './html'; diff --git a/src/html-reporter/fixture.js b/src/html-runner/fixture.js similarity index 100% rename from src/html-reporter/fixture.js rename to src/html-runner/fixture.js diff --git a/src/html-reporter/urlparams.js b/src/html-runner/urlparams.js similarity index 100% rename from src/html-reporter/urlparams.js rename to src/html-runner/urlparams.js diff --git a/src/qunit.js b/src/qunit.js index 8aec540fa..f4ba54eb2 100644 --- a/src/qunit.js +++ b/src/qunit.js @@ -1,2 +1,4 @@ import './core'; -import './html-reporter/reporter'; +import './html-runner/fixture'; +import './html-runner/urlparams'; +import './html-reporter/html';