diff --git a/src/tests/backend/specs/hooks.ts b/src/tests/backend/specs/hooks.ts index 07c6e262e..415c530ed 100644 --- a/src/tests/backend/specs/hooks.ts +++ b/src/tests/backend/specs/hooks.ts @@ -1,11 +1,18 @@ 'use strict'; +import {fileURLToPath} from 'node:url'; +import {dirname} from 'node:path'; import {strict as assert} from 'assert'; -const hooks = require('../../../static/js/pluginfw/hooks'); -const plugins = require('../../../static/js/pluginfw/plugin_defs'); +import hooks from '../../../static/js/pluginfw/hooks.js'; +import pluginDefs from '../../../static/js/pluginfw/plugin_defs.js'; import sinon from 'sinon'; import {MapArrayType} from "../../../node/types/MapType"; +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const plugins = pluginDefs; + interface ExtendedConsole extends Console { warn: { diff --git a/src/tests/backend/specs/i18n.ts b/src/tests/backend/specs/i18n.ts index 0f0b9be2a..400fd3399 100644 --- a/src/tests/backend/specs/i18n.ts +++ b/src/tests/backend/specs/i18n.ts @@ -1,8 +1,13 @@ 'use strict'; -const assert = require('assert').strict; -const common = require('../common'); -const i18n = require('../../../node/hooks/i18n'); +import {fileURLToPath} from 'node:url'; +import {dirname} from 'node:path'; +import assert from 'assert'; +import common from '../common.js'; +import i18n from '../../../node/hooks/i18n.js'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); describe(__filename, function () { before(async function () { diff --git a/src/tests/backend/specs/settings.ts b/src/tests/backend/specs/settings.ts index 3f836ae40..6d7695d65 100644 --- a/src/tests/backend/specs/settings.ts +++ b/src/tests/backend/specs/settings.ts @@ -1,10 +1,15 @@ 'use strict'; -const assert = require('assert').strict; -import {exportedForTestingOnly} from '../../../node/utils/Settings' +import {fileURLToPath} from 'node:url'; +import {dirname} from 'node:path'; +import assert from 'assert'; +import {exportedForTestingOnly} from '../../../node/utils/Settings.js' import path from 'path'; import process from 'process'; +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + describe(__filename, function () { describe('parseSettings', function () { let settings: any; diff --git a/src/tests/backend/specs/socketio.ts b/src/tests/backend/specs/socketio.ts index b235974aa..ffebc8dc9 100644 --- a/src/tests/backend/specs/socketio.ts +++ b/src/tests/backend/specs/socketio.ts @@ -1,14 +1,21 @@ 'use strict'; +import {fileURLToPath} from 'node:url'; +import {dirname} from 'node:path'; import {MapArrayType} from "../../../node/types/MapType"; -const assert = require('assert').strict; -const common = require('../common'); -const padManager = require('../../../node/db/PadManager'); -const plugins = require('../../../static/js/pluginfw/plugin_defs'); -import readOnlyManager from '../../../node/db/ReadOnlyManager'; -import settings from '../../../node/utils/Settings'; -const socketIoRouter = require('../../../node/handler/SocketIORouter'); +import assert from 'assert'; +import common from '../common.js'; +import padManager from '../../../node/db/PadManager.js'; +import pluginDefs from '../../../static/js/pluginfw/plugin_defs.js'; +import readOnlyManager from '../../../node/db/ReadOnlyManager.js'; +import settings from '../../../node/utils/Settings.js'; +import socketIoRouter from '../../../node/handler/SocketIORouter.js'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const plugins = pluginDefs; describe(__filename, function () { this.timeout(30000); diff --git a/src/tests/backend/specs/specialpages.ts b/src/tests/backend/specs/specialpages.ts index 3f0092a61..c8884a2f7 100644 --- a/src/tests/backend/specs/specialpages.ts +++ b/src/tests/backend/specs/specialpages.ts @@ -1,10 +1,15 @@ 'use strict'; +import {fileURLToPath} from 'node:url'; +import {dirname} from 'node:path'; import {strict as assert} from 'assert'; import {MapArrayType} from "../../../node/types/MapType"; -const common = require('../common'); -import settings from '../../../node/utils/Settings'; +import common from '../common.js'; +import settings from '../../../node/utils/Settings.js'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); diff --git a/src/tests/backend/specs/undo_clear_authorship.ts b/src/tests/backend/specs/undo_clear_authorship.ts index 5ec73ca17..1e9c9f382 100644 --- a/src/tests/backend/specs/undo_clear_authorship.ts +++ b/src/tests/backend/specs/undo_clear_authorship.ts @@ -1,5 +1,8 @@ 'use strict'; +import {fileURLToPath} from 'node:url'; +import {dirname} from 'node:path'; + /** * Tests for https://github.com/ether/etherpad-lite/issues/2802 * @@ -13,11 +16,14 @@ import {PadType} from "../../../node/types/PadType"; -const assert = require('assert').strict; -const common = require('../common'); -const padManager = require('../../../node/db/PadManager'); -import AttributePool from '../../../static/js/AttributePool'; -import padutils from '../../../static/js/pad_utils'; +import assert from 'assert'; +import common from '../common.js'; +import padManager from '../../../node/db/PadManager.js'; +import AttributePool from '../../../static/js/AttributePool.js'; +import padutils from '../../../static/js/pad_utils.js'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); describe(__filename, function () { let agent: any; diff --git a/src/tests/backend/specs/webaccess.ts b/src/tests/backend/specs/webaccess.ts index 919bb1a41..afa2b4855 100644 --- a/src/tests/backend/specs/webaccess.ts +++ b/src/tests/backend/specs/webaccess.ts @@ -1,13 +1,20 @@ 'use strict'; +import {fileURLToPath} from 'node:url'; +import {dirname} from 'node:path'; import {MapArrayType} from "../../../node/types/MapType"; import {Func} from "mocha"; import {SettingsUser} from "../../../node/types/SettingsUser"; -const assert = require('assert').strict; -const common = require('../common'); -const plugins = require('../../../static/js/pluginfw/plugin_defs'); -import settings from '../../../node/utils/Settings'; +import assert from 'assert'; +import common from '../common.js'; +import pluginDefs from '../../../static/js/pluginfw/plugin_defs.js'; +import settings from '../../../node/utils/Settings.js'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const plugins = pluginDefs; describe(__filename, function () { this.timeout(30000);