Skip to content

Commit

Permalink
Build: Move /src/core/diff.js to /src/diff.js
Browse files Browse the repository at this point in the history
This produces strings (HTML) and is available unconditionally.
It does not depend on the DOM.

Pluck its test out of /test/reporter-html/ and add it to /test/main
instead. Thus coverering it in Node.js, mozjs, web worker,
and CLI as well.

Ref #1726.
  • Loading branch information
Krinkle committed Jun 23, 2024
1 parent af8434c commit a3c2cfe
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ module.exports = function (grunt) {
'test/main/assert-timeout.js',
'test/main/async.js',
'test/main/deepEqual.js',
'test/main/diff.js',
'test/main/dump.js',
'test/main/each.js',
'test/main/modules.js',
Expand Down
2 changes: 1 addition & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import ProcessingQueue from './core/processing-queue';
import { urlParams } from './urlparams';
import { on, emit } from './events';
import onUncaughtException from './core/on-uncaught-exception';
import diff from './core/diff';
import diff from './diff';

const QUnit = {};

Expand Down
2 changes: 1 addition & 1 deletion src/core/diff.js → src/diff.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable indent */
import { escapeText } from '../core/utilities';
import { escapeText } from './core/utilities';

/*
* This file is a modified version of google-diff-match-patch's JavaScript implementation
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/HtmlReporter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extend, errorString, escapeText } from '../core/utilities';
import diff from '../core/diff';
import diff from '../diff';
import dump from '../dump';
import { window, document, navigator, StringMap } from '../globals';
import { urlParams } from '../urlparams';
Expand Down
2 changes: 1 addition & 1 deletion test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<script src="main/assert-timeout.js"></script>
<script src="main/async.js"></script>
<script src="main/deepEqual.js"></script>
<script src="main/diff.js"></script>
<script src="main/dump.js"></script>
<script src="main/each.js"></script>
<script src="main/modules.js"></script>
Expand All @@ -25,7 +26,6 @@
<script src="main/test.js"></script>
<script src="main/utilities.js"></script>

<script src="reporter-html/diff.js"></script>
<script src="reporter-html/reporter-html.js"></script>
<script src="reporter-html/unhandled-rejection.js"></script>
</head>
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions test/mozjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ loadRelativeToScript('../test/main/assert-step.js');
// loadRelativeToScript( "../test/main/assert-timeout.js" ); // Requires setTimeout
// loadRelativeToScript( "../test/main/async.js" ); // Requires setTimeout
loadRelativeToScript('../test/main/deepEqual.js');
loadRelativeToScript('../test/main/diff.js');
loadRelativeToScript('../test/main/dump.js');
loadRelativeToScript('../test/main/each.js');
// loadRelativeToScript( "../test/main/modules.js" ); // Requires setTimeout
Expand Down
1 change: 1 addition & 0 deletions test/webWorker-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ importScripts(
'main/assert-timeout.js',
'main/async.js',
'main/deepEqual.js',
'main/diff.js',
'main/dump.js',
'main/each.js',
'main/modules.js',
Expand Down

0 comments on commit a3c2cfe

Please sign in to comment.