From 05a52c8ee0cab2c11d43dacc588125091e4ce2fd Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 27 Aug 2024 00:37:59 +0100 Subject: [PATCH] Build: Alphabetize internal import statements --- build/review-package.js | 9 +++++++-- build/utils.js | 3 +++ src/core/assert.js | 2 +- src/core/config.js | 2 +- src/core/core.js | 26 +++++++++++++------------- src/core/equiv.js | 2 +- src/core/on-uncaught-exception.js | 2 +- src/core/processing-queue.js | 8 ++++---- src/core/reporters/HtmlReporter.js | 2 +- src/core/reporters/TapReporter.js | 4 ++-- src/core/test.js | 14 +++++++------- 11 files changed, 41 insertions(+), 33 deletions(-) diff --git a/build/review-package.js b/build/review-package.js index 1004db4e4..1cd868f56 100644 --- a/build/review-package.js +++ b/build/review-package.js @@ -44,8 +44,13 @@ const ReleaseAssets = { fs.writeFileSync(tempPrevPath, prevContent); const currentPath = path.join(__dirname, '..', file); - process.stdout.write(getDiff(tempPrevPath, currentPath)); - await confirm(`Accept ${file}?`); + const diff = getDiff(tempPrevPath, currentPath, { allowUnchanged: true }); + if (diff === null) { + console.log(`${file} was unchanged...`); + } else { + process.stdout.write(diff); + await confirm(`Accept ${file}?`); + } } { const file = 'qunit.js'; diff --git a/build/utils.js b/build/utils.js index df5545295..77b104031 100644 --- a/build/utils.js +++ b/build/utils.js @@ -42,6 +42,9 @@ function getDiff (from, to, options = {}) { // Expected, `diff` command yields non-zero exit status if files differ return e.stdout; } + if (options.allowUnchanged) { + return null; + } throw new Error(`Unable to diff between ${from} and ${to}`); } diff --git a/src/core/assert.js b/src/core/assert.js index 43f8225f6..65bc75222 100644 --- a/src/core/assert.js +++ b/src/core/assert.js @@ -1,6 +1,6 @@ +import config from './config.js'; import dump from './dump.js'; import equiv from './equiv.js'; -import config from './config.js'; import { objectType, objectValues, objectValuesSubset, errorString } from './utilities.js'; import { sourceFromStacktrace } from './stacktrace.js'; import { clearTimeout } from './globals.js'; diff --git a/src/core/config.js b/src/core/config.js index 6926458ff..45d747e2c 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -1,6 +1,6 @@ import { globalThis, process, sessionStorage } from './globals.js'; -import { urlParams } from './urlparams.js'; import { extend } from './utilities.js'; +import { urlParams } from './urlparams.js'; /** * Config object: Maintain internal state diff --git a/src/core/core.js b/src/core/core.js index 35a40b638..76307966e 100644 --- a/src/core/core.js +++ b/src/core/core.js @@ -1,22 +1,22 @@ -import { window } from './globals.js'; -import equiv from './equiv.js'; -import dump from './dump.js'; -import { unnamedModule, module } from './module.js'; import Assert from './assert.js'; -import { test, pushFailure } from './test.js'; -import reporters from './reporters.js'; +import { createRegisterCallbackFunction } from './callbacks.js'; import config from './config.js'; +import diff from './diff.js'; +import dump from './dump.js'; +import equiv from './equiv.js'; +import { on } from './events.js'; +import { window } from './globals.js'; import hooks from './hooks.js'; -import { objectType, is } from './utilities.js'; -import { createRegisterCallbackFunction } from './callbacks.js'; -import { stack } from './stacktrace.js'; +import { module, unnamedModule } from './module.js'; +import onUncaughtException from './on-uncaught-exception.js'; import ProcessingQueue from './processing-queue.js'; +import reporters from './reporters.js'; +import { stack } from './stacktrace.js'; +import { start } from './start.js'; import { urlParams } from './urlparams.js'; -import { on } from './events.js'; -import onUncaughtException from './on-uncaught-exception.js'; -import diff from './diff.js'; +import { test, pushFailure } from './test.js'; +import { objectType, is } from './utilities.js'; import version from './version.js'; -import { start } from './start.js'; config.currentModule = unnamedModule; config._pq = new ProcessingQueue(); diff --git a/src/core/equiv.js b/src/core/equiv.js index 49a59bbd9..4b1c8d6a7 100644 --- a/src/core/equiv.js +++ b/src/core/equiv.js @@ -1,5 +1,5 @@ -import { objectType } from './utilities.js'; import { StringSet } from './globals.js'; +import { objectType } from './utilities.js'; const BOXABLE_TYPES = new StringSet(['boolean', 'number', 'string']); diff --git a/src/core/on-uncaught-exception.js b/src/core/on-uncaught-exception.js index a0e8f1899..1842bd76f 100644 --- a/src/core/on-uncaught-exception.js +++ b/src/core/on-uncaught-exception.js @@ -1,8 +1,8 @@ import config from './config.js'; +import { emit } from './events.js'; import { globalSuiteReport } from './module.js'; import { sourceFromStacktrace } from './stacktrace.js'; import { errorString } from './utilities.js'; -import { emit } from './events.js'; /** * Handle a global error that should result in a failed test run. diff --git a/src/core/processing-queue.js b/src/core/processing-queue.js index e107bf3a1..b28a6cc6e 100644 --- a/src/core/processing-queue.js +++ b/src/core/processing-queue.js @@ -1,11 +1,11 @@ import config from './config.js'; -import { generateHash, performance } from './utilities.js'; import { runLoggingCallbacks } from './callbacks.js'; -import Promise from './promise.js'; -import { globalSuiteReport } from './module.js'; -import onUncaughtException from './on-uncaught-exception.js'; import { emit } from './events.js'; import { setTimeout } from './globals.js'; +import { globalSuiteReport } from './module.js'; +import onUncaughtException from './on-uncaught-exception.js'; +import Promise from './promise.js'; +import { generateHash, performance } from './utilities.js'; /** * Creates a seeded "sample" generator which is used for randomizing tests. diff --git a/src/core/reporters/HtmlReporter.js b/src/core/reporters/HtmlReporter.js index fdcd98cb1..7d7bce95a 100644 --- a/src/core/reporters/HtmlReporter.js +++ b/src/core/reporters/HtmlReporter.js @@ -1,8 +1,8 @@ -import { extend, errorString, escapeText } from '../utilities.js'; import diff from '../diff.js'; import dump from '../dump.js'; import { prioritySymbol } from '../events.js'; import { window, document, navigator, StringMap } from '../globals.js'; +import { extend, errorString, escapeText } from '../utilities.js'; import version from '../version.js'; import fuzzysort from 'fuzzysort'; diff --git a/src/core/reporters/TapReporter.js b/src/core/reporters/TapReporter.js index 579a6a5e3..8ae7caf18 100644 --- a/src/core/reporters/TapReporter.js +++ b/src/core/reporters/TapReporter.js @@ -1,7 +1,7 @@ -import kleur from 'kleur'; -import { errorString } from '../utilities.js'; import { console } from '../globals.js'; import { annotateStacktrace } from '../stacktrace.js'; +import { errorString } from '../utilities.js'; +import kleur from 'kleur'; /** * Format a given value into YAML. diff --git a/src/core/test.js b/src/core/test.js index 58de323ca..558c9423f 100644 --- a/src/core/test.js +++ b/src/core/test.js @@ -1,9 +1,13 @@ -import { globalThis, setTimeout, clearTimeout, StringMap } from './globals.js'; -import { emit } from './events.js'; import Assert from './assert.js'; +import { runLoggingCallbacks } from './callbacks.js'; +import config from './config.js'; +import dump from './dump.js'; +import { emit } from './events.js'; +import { globalThis, setTimeout, clearTimeout, StringMap } from './globals.js'; import Logger from './logger.js'; import Promise from './promise.js'; -import config from './config.js'; +import TestReport from './reports/test.js'; +import { extractStacktrace, sourceFromStacktrace } from './stacktrace.js'; import { diff, errorString, @@ -13,10 +17,6 @@ import { inArray, performance } from './utilities.js'; -import { runLoggingCallbacks } from './callbacks.js'; -import { extractStacktrace, sourceFromStacktrace } from './stacktrace.js'; -import dump from './dump.js'; -import TestReport from './reports/test.js'; export default function Test (settings) { this.expected = null;