Migrate codebase from CommonJS to ES Modules

- Convert all require()/module.exports to import/export across 260+ files
- Add "type": "module" to package.json to enable ESM by default
- Add migrations/package.json with "type": "commonjs" to keep db-migrate compatible
- Convert eslint.config.js to ESM with sourceType: "module"
- Replace __dirname/__filename with import.meta.dirname/import.meta.filename
- Replace require.main === module with process.argv[1] === import.meta.filename
- Remove 'use strict' directives (implicit in ESM)
- Convert dynamic require() in switch statements to static import lookup maps
  (dns.js, domains.js, backupformats.js, backupsites.js, network.js)
- Extract self-referencing exports.CONSTANT patterns into standalone const
  declarations (apps.js, services.js, locks.js, users.js, mail.js, etc.)
- Lazify SERVICES object in services.js to avoid circular dependency TDZ issues
- Add clearMailQueue() to mailer.js for ESM-safe queue clearing in tests
- Add _setMockApp() to ldapserver.js for ESM-safe test mocking
- Add _setMockResolve() wrapper to dig.js for ESM-safe DNS mocking in tests
- Convert backupupload.js to use dynamic imports so --check exits before
  loading the module graph (which requires BOX_ENV)
- Update check-install to use ESM import for infra_version.js
- Convert scripts/ (hotfix, release, remote_hotfix.js, find-unused-translations)
- All 1315 tests passing

Migration stats (AI-assisted using Cursor with Claude):
- Wall clock time: ~3-4 hours
- Assistant completions: ~80-100
- Estimated token usage: ~1-2M tokens

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Girish Ramakrishnan
2026-02-14 09:53:14 +01:00
parent e0e9f14a5e
commit 96dc79cfe6
277 changed files with 4789 additions and 3811 deletions
+5 -6
View File
@@ -1,14 +1,13 @@
/* global it:false */
import * as acme2 from '../acme2.js';
import * as common from './common.js';
import expect from 'expect.js';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const acme2 = require('../acme2.js'),
common = require('./common.js'),
expect = require('expect.js');
describe('Acme2', function () {
const { setup, cleanup } = common;
+5 -6
View File
@@ -1,14 +1,13 @@
/* global it:false */
import * as addonConfigs from '../addonconfigs.js';
import * as common from './common.js';
import expect from 'expect.js';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const addonConfigs = require('../addonconfigs.js'),
common = require('./common.js'),
expect = require('expect.js');
describe('Addon config', function () {
const { setup, cleanup, app } = common;
+7 -8
View File
@@ -1,16 +1,15 @@
/* global it:false */
import * as applinks from '../applinks.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import safe from 'safetydance';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const applinks = require('../applinks.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
safe = require('safetydance');
describe('Applinks', function () {
const { setup, cleanup } = common;
+8 -9
View File
@@ -1,18 +1,17 @@
/* jslint node:true */
import * as appPasswords from '../apppasswords.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import safe from 'safetydance';
import * as users from '../users.js';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const appPasswords = require('../apppasswords.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
safe = require('safetydance'),
users = require('../users.js');
describe('App passwords', function () {
const { setup, cleanup, admin } = common;
+12 -12
View File
@@ -1,19 +1,20 @@
/* global it:false */
import apps from '../apps.js';
import AuditSource from '../auditsource.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import Location from '../location.js';
import safe from 'safetydance';
import * as users from '../users.js';
const { proxyApp } = common;
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const apps = require('../apps.js'),
AuditSource = require('../auditsource.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
Location = require('../location.js'),
safe = require('safetydance'),
users = require('../users.js');
describe('Apps', function () {
const { domainSetup, cleanup, app, admin, user , domain } = common;
@@ -356,7 +357,6 @@ describe('Apps', function () {
});
describe('proxy app', function () {
const proxyApp = require('./common.js').proxyApp;
const newUpstreamUri = 'https://foobar.com:443';
before(async function () {
+8 -9
View File
@@ -1,17 +1,16 @@
/* global it:false */
import * as apptask from '../apptask.js';
import * as common from './common.js';
import expect from 'expect.js';
import fs from 'node:fs';
import paths from '../paths.js';
import safe from 'safetydance';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const apptask = require('../apptask.js'),
common = require('./common.js'),
expect = require('expect.js'),
fs = require('node:fs'),
paths = require('../paths.js'),
safe = require('safetydance');
describe('apptask', function () {
const { setup, cleanup, app } = common;
+8 -9
View File
@@ -1,17 +1,16 @@
/* global it:false */
import * as archives from '../archives.js';
import backups from '../backups.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import safe from 'safetydance';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const archives = require('../archives.js'),
backups = require('../backups.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
safe = require('safetydance');
describe('Archives', function () {
const { setup, cleanup, auditSource, getDefaultBackupSite } = common;
+11 -12
View File
@@ -1,21 +1,20 @@
/* jslint node:true */
import * as archives from '../archives.js';
import * as backupCleaner from '../backupcleaner.js';
import backups from '../backups.js';
import * as backupSites from '../backupsites.js';
import * as common from './common.js';
import expect from 'expect.js';
import moment from 'moment';
import tasks from '../tasks.js';
import timers from 'timers/promises';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const archives = require('../archives.js'),
backupCleaner = require('../backupcleaner.js'),
backups = require('../backups.js'),
backupSites = require('../backupsites.js'),
common = require('./common.js'),
expect = require('expect.js'),
moment = require('moment'),
tasks = require('../tasks.js'),
timers = require('timers/promises');
describe('backup cleaner', function () {
const { setup, cleanup, app, getDefaultBackupSite, auditSource } = common;
+15 -15
View File
@@ -1,22 +1,22 @@
/* jslint node:true */
import * as common from './common.js';
import DataLayout from '../datalayout.js';
import * as tgz from '../backupformat/tgz.js';
const EnsureFileSizeStream = tgz._EnsureFileSizeStream;
import expect from 'expect.js';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import * as rsync from '../backupformat/rsync.js';
import safe from 'safetydance';
import stream from 'node:stream/promises';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const common = require('./common.js'),
DataLayout = require('../datalayout.js'),
EnsureFileSizeStream = require('../backupformat/tgz.js')._EnsureFileSizeStream,
expect = require('expect.js'),
fs = require('node:fs'),
os = require('node:os'),
path = require('node:path'),
rsync = require('../backupformat/rsync.js'),
safe = require('safetydance'),
stream = require('node:stream/promises');
describe('backuptask', function () {
const { setup, cleanup, createTree } = common;
@@ -77,7 +77,7 @@ describe('backuptask', function () {
createTree(tmpdir, { 'data': { 'subdir': { 'emptydir': { } } }, 'dir2': { 'file': 'stuff' } });
fs.chmodSync(path.join(tmpdir, 'dir2/file'), parseInt('0755', 8));
let dataLayout = new DataLayout(tmpdir, []);
const dataLayout = new DataLayout(tmpdir, []);
await rsync._saveFsMetadata(dataLayout, `${dataLayout.localRoot()}/fsmetadata.json`);
@@ -93,7 +93,7 @@ describe('backuptask', function () {
expect(fs.existsSync(path.join(tmpdir, 'data/subdir/emptydir'))).to.be(false); // just make sure rimraf worked
let dataLayout = new DataLayout(tmpdir, []);
const dataLayout = new DataLayout(tmpdir, []);
await rsync._restoreFsMetadata(dataLayout, `${dataLayout.localRoot()}/fsmetadata.json`);
+7 -8
View File
@@ -1,17 +1,16 @@
/* jslint node:true */
import backups from '../backups.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import safe from 'safetydance';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const backups = require('../backups.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
safe = require('safetydance');
describe('backups', function () {
const { setup, cleanup, getDefaultBackupSite } = common;
+10 -11
View File
@@ -1,20 +1,19 @@
/* jslint node:true */
import * as archives from '../archives.js';
import backups from '../backups.js';
import * as backupSites from '../backupsites.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import constants from '../constants.js';
import expect from 'expect.js';
import safe from 'safetydance';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const archives = require('../archives.js'),
backups = require('../backups.js'),
backupSites = require('../backupsites.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
constants = require('../constants.js'),
expect = require('expect.js'),
safe = require('safetydance');
describe('backups', function () {
const { setup, cleanup, auditSource, getDefaultBackupSite } = common;
+14 -14
View File
@@ -1,21 +1,21 @@
/* jslint node:true */
import backups from '../backups.js';
import * as backupSites from '../backupsites.js';
import child_process from 'node:child_process';
import * as common from './common.js';
import expect from 'expect.js';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import tasks from '../tasks.js';
import timers from 'timers/promises';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const backups = require('../backups.js'),
backupSites = require('../backupsites.js'),
common = require('./common.js'),
expect = require('expect.js'),
fs = require('node:fs'),
os = require('node:os'),
path = require('node:path'),
tasks = require('../tasks.js'),
timers = require('timers/promises');
describe('backuptask', function () {
const { setup, cleanup, getDefaultBackupSite, auditSource } = common;
@@ -63,7 +63,7 @@ describe('backuptask', function () {
it('can backup', async function () {
// arch only has maria db which lacks some mysqldump options we need, this is only here to allow running the tests :-/
if (require('node:child_process').execSync('/usr/bin/mysqldump --version').toString().indexOf('MariaDB') !== -1) {
if (child_process.execSync('/usr/bin/mysqldump --version').toString().indexOf('MariaDB') !== -1) {
console.log('test skipped because of MariaDB');
return;
}
@@ -77,7 +77,7 @@ describe('backuptask', function () {
it('can take another backup', async function () {
// arch only has maria db which lacks some mysqldump options we need, this is only here to allow running the tests :-/
if (require('node:child_process').execSync('/usr/bin/mysqldump --version').toString().indexOf('MariaDB') !== -1) {
if (child_process.execSync('/usr/bin/mysqldump --version').toString().indexOf('MariaDB') !== -1) {
console.log('test skipped because of MariaDB');
return;
}
+5 -6
View File
@@ -1,14 +1,13 @@
/* global it:false */
import blobs from '../blobs.js';
import * as common from './common.js';
import expect from 'expect.js';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const blobs = require('../blobs.js'),
common = require('./common.js'),
expect = require('expect.js');
describe('blobs', function () {
const { setup, cleanup } = common;
+7 -8
View File
@@ -1,16 +1,15 @@
/* global it:false */
import BoxError from '../boxerror.js';
import * as branding from '../branding.js';
import * as common from './common.js';
import expect from 'expect.js';
import safe from 'safetydance';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const BoxError = require('../boxerror.js'),
branding = require('../branding.js'),
common = require('./common.js'),
expect = require('expect.js'),
safe = require('safetydance');
describe('Branding', function () {
const { setup, cleanup, auditSource } = common;
+1 -1
View File
@@ -46,7 +46,7 @@ if ! grep -q "backupupload.js closefrom_override" "/etc/sudoers.d/yellowtent"; t
exit 1
fi
images=$(node -e "const i = require('${source_dir}/src/infra_version.js'); console.log(Object.keys(i.images).map(x => i.images[x]).join(' '));")
images=$(node --input-type=module -e "import i from '${source_dir}/src/infra_version.js'; console.log(Object.keys(i.images).map(x => i.images[x]).join(' '));")
for image in ${images}; do
if ! docker inspect "${image}" >/dev/null 2>/dev/null; then
+7 -8
View File
@@ -1,16 +1,15 @@
/* global it:false */
import BoxError from '../boxerror.js';
import * as common from './common.js';
import * as cloudron from '../cloudron.js';
import expect from 'expect.js';
import safe from 'safetydance';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
cloudron = require('../cloudron.js'),
expect = require('expect.js'),
safe = require('safetydance');
describe('Cloudron', function () {
const { setup, cleanup } = common;
+38 -38
View File
@@ -1,24 +1,22 @@
'use strict';
const apps = require('../apps.js'),
appstore = require('../appstore.js'),
backupSites = require('../backupsites.js'),
constants = require('../constants.js'),
cron = require('../cron.js'),
dashboard = require('../dashboard.js'),
database = require('../database.js'),
domains = require('../domains.js'),
expect = require('expect.js'),
fs = require('node:fs'),
locks = require('../locks.js'),
mailer = require('../mailer.js'),
mailServer = require('../mailserver.js'),
nock = require('nock'),
path = require('node:path'),
settings = require('../settings.js'),
tasks = require('../tasks.js'),
timers = require('timers/promises'),
users = require('../users.js');
import apps from '../apps.js';
import * as appstore from '../appstore.js';
import * as backupSites from '../backupsites.js';
import constants from '../constants.js';
import * as cron from '../cron.js';
import * as dashboard from '../dashboard.js';
import * as database from '../database.js';
import * as domains from '../domains.js';
import expect from 'expect.js';
import fs from 'node:fs';
import locks from '../locks.js';
import * as mailer from '../mailer.js';
import * as mailServer from '../mailserver.js';
import nock from 'nock';
import path from 'node:path';
import * as settings from '../settings.js';
import tasks from '../tasks.js';
import timers from 'timers/promises';
import * as users from '../users.js';
const manifest = {
'id': 'io.cloudron.test',
@@ -164,7 +162,13 @@ const proxyApp = {
};
Object.freeze(proxyApp);
exports = module.exports = {
const mockApiServerOrigin = 'http://localhost:6060';
const dashboardDomain = domain.domain;
const dashboardFqdn = `my.${domain.domain}`;
const appstoreToken = 'atoken';
const serverUrl = `http://localhost:${constants.PORT}`;
export {
createTree,
domainSetup,
databaseSetup,
@@ -172,23 +176,19 @@ exports = module.exports = {
cleanup,
checkMails,
clearMailQueue,
getDefaultBackupSite,
mockApiServerOrigin: 'http://localhost:6060',
dashboardDomain: domain.domain,
dashboardFqdn: `my.${domain.domain}`,
mockApiServerOrigin,
dashboardDomain,
dashboardFqdn,
app,
proxyApp,
admin,
auditSource,
domain, // the domain object
domain, // the domain object,
manifest,
user,
appstoreToken: 'atoken',
serverUrl: `http://localhost:${constants.PORT}`,
appstoreToken,
serverUrl,
};
function createTree(root, obj) {
@@ -218,8 +218,8 @@ async function databaseSetup() {
await database.initialize();
await database._clear();
await appstore._setApiServerOrigin(exports.mockApiServerOrigin);
await dashboard._setLocation(constants.DASHBOARD_SUBDOMAIN, exports.dashboardDomain);
await appstore._setApiServerOrigin(mockApiServerOrigin);
await dashboard._setLocation(constants.DASHBOARD_SUBDOMAIN, dashboardDomain);
// duplicated here since we clear the database
await backupSites.addDefault(auditSource);
@@ -238,7 +238,7 @@ async function setup() {
const ownerId = await users.createOwner(admin.email, admin.username, admin.password, admin.displayName, auditSource);
admin.id = ownerId;
await apps.add(app.id, app.appStoreId, '', app.manifest, app.subdomain, app.domain, app.portBindings, app);
await settings._set(settings.APPSTORE_API_TOKEN_KEY, exports.appstoreToken); // appstore token
await settings._set(settings.APPSTORE_API_TOKEN_KEY, appstoreToken); // appstore token
const userId = await users.add(user.email, user, auditSource);
user.id = userId;
await tasks.stopAllTasks();
@@ -247,7 +247,7 @@ async function setup() {
async function cleanup() {
nock.cleanAll();
mailer._mailQueue = [];
mailer.clearMailQueue();
await cron.stopJobs();
await database._clear();
@@ -255,13 +255,13 @@ async function cleanup() {
}
function clearMailQueue() {
mailer._mailQueue = [];
mailer.clearMailQueue();
}
async function checkMails(number) {
await timers.setTimeout(1000);
expect(mailer._mailQueue.length).to.equal(number);
const emails = mailer._mailQueue;
const emails = [...mailer._mailQueue]; // copy before clearing
clearMailQueue();
// return for further investigation
+4 -6
View File
@@ -1,11 +1,9 @@
/* global it, describe, before, after */
'use strict';
const BoxError = require('../boxerror.js'),
database = require('../database'),
expect = require('expect.js'),
safe = require('safetydance');
import BoxError from '../boxerror.js';
import * as database from '../database.js';
import expect from 'expect.js';
import safe from 'safetydance';
describe('database', function () {
describe('init', function () {
+5 -8
View File
@@ -1,14 +1,11 @@
'use strict';
/* global it:false */
import DataLayout from '../datalayout.js';
import expect from 'expect.js';
/* global describe:false */
/* global before:false */
'use strict';
const DataLayout = require('../datalayout.js'),
expect = require('expect.js');
describe('DataLayout', function () {
describe('no dirMap', function () {
const BOX_DATA_DIR = '/home/yellowtent/boxdata/box';
@@ -84,4 +81,4 @@ describe('DataLayout', function () {
});
});
});
});
+9 -9
View File
@@ -1,15 +1,15 @@
/* jslint node:true */
import child_process from 'node:child_process';
import * as common from './common.js';
import * as df from '../df.js';
import expect from 'expect.js';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const common = require('./common.js'),
df = require('../df.js'),
expect = require('expect.js');
describe('df', function () {
const { setup, cleanup } = common;
@@ -18,7 +18,7 @@ describe('df', function () {
it('can get filesystems', async function () {
// does not work on archlinux 8!
if (require('node:child_process').execSync('uname -a').toString().indexOf('-arch') !== -1) return;
if (child_process.execSync('uname -a').toString().indexOf('-arch') !== -1) return;
const disks = await df.filesystems();
expect(disks).to.be.ok();
@@ -27,9 +27,9 @@ describe('df', function () {
it('can get file', async function () {
// does not work on archlinux 8!
if (require('node:child_process').execSync('uname -a').toString().indexOf('-arch') !== -1) return;
if (child_process.execSync('uname -a').toString().indexOf('-arch') !== -1) return;
const disks = await df.file(__dirname);
const disks = await df.file(import.meta.dirname);
expect(disks).to.be.ok();
expect(disks.mountpoint).to.be('/home');
});
+13 -14
View File
@@ -1,22 +1,21 @@
/* jslint node:true */
import async from 'async';
import * as common from './common.js';
import constants from '../constants.js';
import * as directoryServer from '../directoryserver.js';
import expect from 'expect.js';
import * as groups from '../groups.js';
import ldap from 'ldapjs';
import safe from 'safetydance';
import speakeasy from 'speakeasy';
import * as users from '../users.js';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const async = require('async'),
common = require('./common.js'),
constants = require('../constants.js'),
directoryServer = require('../directoryserver.js'),
expect = require('expect.js'),
groups = require('../groups.js'),
ldap = require('ldapjs'),
safe = require('safetydance'),
speakeasy = require('speakeasy'),
users = require('../users.js');
async function ldapBind(dn, password) {
return new Promise((resolve, reject) => {
const client = ldap.createClient({ url: 'ldaps://127.0.0.1:' + constants.USER_DIRECTORY_LDAPS_PORT, tlsOptions: { rejectUnauthorized: false }});
@@ -55,7 +54,7 @@ async function ldapSearch(dn, opts, auth) {
client.search(dn, opts, function (error, result) {
if (error) return done(error);
let entries = [];
const entries = [];
result.on('searchEntry', function (entry) { entries.push(entry.object); });
+9 -10
View File
@@ -1,20 +1,19 @@
/* jslint node:true */
import * as common from './common.js';
import * as dns from '../dns.js';
import * as domains from '../domains.js';
import expect from 'expect.js';
import { DNS as GCDNS } from '@google-cloud/dns';
import nock from 'nock';
import * as _ from '../underscore.js';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global beforeEach:false */
/* global after:false */
'use strict';
const common = require('./common.js'),
dns = require('../dns.js'),
domains = require('../domains.js'),
expect = require('expect.js'),
GCDNS = require('@google-cloud/dns').DNS,
nock = require('nock'),
_ = require('../underscore.js');
describe('dns provider', function () {
const { setup, cleanup, auditSource, domain } = common;
const domainCopy = Object.assign({}, domain); // make a copy
+5 -6
View File
@@ -1,14 +1,13 @@
/* global it:false */
import * as common from './common.js';
import * as dns from '../dns.js';
import expect from 'expect.js';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const common = require('./common.js'),
dns = require('../dns.js'),
expect = require('expect.js');
describe('DNS', function () {
const { setup, cleanup, app, domain:domainObject } = common;
+6 -7
View File
@@ -1,16 +1,15 @@
/* jslint node:true */
import * as common from './common.js';
import * as docker from '../docker.js';
import expect from 'expect.js';
import nock from 'nock';
/* global it:false */
/* global before:false */
/* global after:false */
/* global describe:false */
'use strict';
const common = require('./common.js'),
docker = require('../docker.js'),
expect = require('expect.js'),
nock = require('nock');
describe('docker', function () {
const { setup, cleanup } = common;
+10 -12
View File
@@ -1,21 +1,19 @@
/* jslint node:true */
import child_process from 'node:child_process';
import * as common from './common.js';
import constants from '../constants.js';
import * as dockerProxy from '../dockerproxy.js';
import expect from 'expect.js';
import nock from 'nock';
import * as syslogServer from '../../syslog.js';
/* global it:false */
/* global xit:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const child_process = require('node:child_process'),
common = require('./common.js'),
constants = require('../constants.js'),
dockerProxy = require('../dockerproxy.js'),
expect = require('expect.js'),
nock = require('nock'),
syslogServer = require('../../syslog.js');
const DOCKER = `docker -H tcp://172.18.0.1:${constants.DOCKER_PROXY_PORT} `;
async function exec(cmd) {
@@ -84,7 +82,7 @@ describe('Dockerproxy', function () {
});
it('can use PUT to upload archive into a container', async function () {
const stdout = await exec(`${DOCKER} cp ${__dirname}/proxytestarchive.tar ${containerId}:/tmp/`);
const stdout = await exec(`${DOCKER} cp ${import.meta.dirname}/proxytestarchive.tar ${containerId}:/tmp/`);
expect(stdout).to.be.empty();
});
+7 -8
View File
@@ -1,17 +1,16 @@
/* jslint node:true */
import * as dockerRegistries from '../dockerregistries.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import safe from 'safetydance';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const dockerRegistries = require('../dockerregistries.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
safe = require('safetydance');
describe('Docker Registries', function () {
const { setup, cleanup, auditSource } = common;
+8 -9
View File
@@ -1,18 +1,17 @@
/* jslint node:true */
import apps from '../apps.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import * as domains from '../domains.js';
import expect from 'expect.js';
import safe from 'safetydance';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const apps = require('../apps.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
domains = require('../domains.js'),
expect = require('expect.js'),
safe = require('safetydance');
describe('Domains', function () {
const { setup, cleanup, domain, app, auditSource } = common;
+9 -10
View File
@@ -1,18 +1,17 @@
/* jslint node:true */
import * as common from './common.js';
import * as database from '../database.js';
import eventlog from '../eventlog.js';
import expect from 'expect.js';
import * as notifications from '../notifications.js';
import timers from 'timers/promises';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const common = require('./common.js'),
database = require('../database.js'),
eventlog = require('../eventlog.js'),
expect = require('expect.js'),
notifications = require('../notifications.js'),
timers = require('timers/promises');
describe('Eventlog', function () {
const { setup, cleanup } = common;
@@ -99,7 +98,7 @@ describe('Eventlog', function () {
});
it('upsert with existing old entry succeeds', async function () {
let yesterday = new Date();
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
await database.query('INSERT INTO eventlog (id, action, sourceJson, dataJson, creationTime) VALUES (?, ?, ?, ?, ?)', [ 'anotherid', 'user.login2', JSON.stringify({ ip: '1.2.3.4' }), JSON.stringify({ appId: 'thatapp' }), yesterday ]);
+11 -12
View File
@@ -1,20 +1,19 @@
/* global it:false */
import async from 'async';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import * as externalLdap from '../externalldap.js';
import * as groups from '../groups.js';
import ldap from 'ldapjs';
import safe from 'safetydance';
import * as users from '../users.js';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const async = require('async'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
externalLdap = require('../externalldap.js'),
groups = require('../groups.js'),
ldap = require('ldapjs'),
safe = require('safetydance'),
users = require('../users.js');
const LDAP_SHARED_PASSWORD = 'validpassword';
const LDAP_SHARED_TOTP_TOKEN = '1234';
const LDAP_PORT = 4321;
+7 -8
View File
@@ -1,17 +1,16 @@
/* jslint node:true */
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import * as groups from '../groups.js';
import safe from 'safetydance';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
groups = require('../groups.js'),
safe = require('safetydance');
describe('Groups', function () {
const { setup, cleanup, admin, user, auditSource, app } = common;
+2 -4
View File
@@ -1,9 +1,7 @@
'use strict';
/* global it, describe */
const expect = require('expect.js'),
ipaddr = require('../ipaddr.js');
import expect from 'expect.js';
import * as ipaddr from '../ipaddr.js';
describe('ipaddr', function () {
describe('IPv4', function () {
+6 -7
View File
@@ -1,16 +1,15 @@
/* jslint node:true */
import * as common from './common.js';
import expect from 'expect.js';
import * as janitor from '../janitor.js';
import * as tokens from '../tokens.js';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const common = require('./common.js'),
expect = require('expect.js'),
janitor = require('../janitor.js'),
tokens = require('../tokens.js');
describe('janitor', function () {
const { setup, cleanup } = common;
+14 -15
View File
@@ -1,22 +1,21 @@
/* jslint node:true */
import * as addonConfigs from '../addonconfigs.js';
import async from 'async';
import * as common from './common.js';
import constants from '../constants.js';
import expect from 'expect.js';
import * as groups from '../groups.js';
import ldap from 'ldapjs';
import * as ldapServer from '../ldapserver.js';
import * as mail from '../mail.js';
import safe from 'safetydance';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const addonConfigs = require('../addonconfigs.js'),
async = require('async'),
common = require('./common.js'),
constants = require('../constants.js'),
expect = require('expect.js'),
groups = require('../groups.js'),
ldap = require('ldapjs'),
ldapServer = require('../ldapserver.js'),
mail = require('../mail.js'),
safe = require('safetydance');
async function ldapBind(dn, password) {
return new Promise((resolve, reject) => {
const client = ldap.createClient({ url: 'ldap://127.0.0.1:' + constants.LDAP_PORT });
@@ -45,7 +44,7 @@ async function ldapSearch(dn, opts) {
client.search(dn, opts, function (error, result) {
if (error) return done(error);
let entries = [];
const entries = [];
result.on('searchEntry', function (entry) { entries.push(entry.object); });
@@ -87,7 +86,7 @@ describe('Ldap Server', function () {
}
], done);
ldapServer._MOCK_APP = mockApp;
ldapServer._setMockApp(mockApp);
});
after(function (done) {
+5 -7
View File
@@ -1,12 +1,10 @@
'use strict';
/* global it, describe, before, after */
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
safe = require('safetydance'),
locks = require('../locks.js');
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import safe from 'safetydance';
import locks from '../locks.js';
describe('Locks', function () {
this.timeout(20000);
+6 -7
View File
@@ -1,13 +1,12 @@
/* global it:false */
import expect from 'expect.js';
import fs from 'node:fs';
import * as logs from '../logs.js';
import stream from 'node:stream';
/* global describe:false */
'use strict';
const expect = require('expect.js'),
fs = require('node:fs'),
logs = require('../logs.js'),
stream = require('node:stream');
describe('log stream', function () {
it('can create stream', function (done) {
fs.writeFileSync('/tmp/test-input.log', '2022-10-09T15:19:48.740Z message', 'utf8');
+7 -9
View File
@@ -1,16 +1,15 @@
/* global it:false */
import * as common from './common.js';
import BoxError from '../boxerror.js';
import expect from 'expect.js';
import * as mail from '../mail.js';
import safe from 'safetydance';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const common = require('./common.js'),
BoxError = require('../boxerror.js'),
expect = require('expect.js'),
mail = require('../mail.js'),
safe = require('safetydance');
describe('Mail', function () {
const { setup, cleanup, domain, auditSource } = common;
@@ -116,7 +115,6 @@ describe('Mail', function () {
});
});
describe('mailboxes', function () {
it('add user mailbox succeeds', async function () {
await mail.addMailbox('girish', domain.domain, { ownerId: 'uid-0', ownerType: mail.OWNERTYPE_USER, active: true, enablePop3: false, storageQuota: 0, messagesQuota: 0 }, auditSource);
+9 -10
View File
@@ -1,18 +1,17 @@
/* global it:false */
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import fs from 'node:fs';
import * as network from '../network.js';
import paths from '../paths.js';
import safe from 'safetydance';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
fs = require('node:fs'),
network = require('../network.js'),
paths = require('../paths.js'),
safe = require('safetydance');
describe('Network', function () {
const { setup, cleanup, auditSource } = common;
+8 -9
View File
@@ -1,18 +1,17 @@
/* jslint node:true */
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import * as notifications from '../notifications.js';
import safe from 'safetydance';
import timers from 'timers/promises';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
notifications = require('../notifications.js'),
safe = require('safetydance'),
timers = require('timers/promises');
const EVENT_0 = {
id: 'event_0',
action: 'action',
+5 -7
View File
@@ -1,12 +1,10 @@
/* global describe, before, it, after */
'use strict';
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
oidcClients = require('../oidcclients.js'),
safe = require('safetydance');
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import oidcClients from '../oidcclients.js';
import safe from 'safetydance';
describe('OIDC Clients', function () {
const { setup, cleanup } = common;
+6 -7
View File
@@ -1,13 +1,12 @@
/* global it:false */
import BoxError from '../boxerror.js';
import expect from 'expect.js';
import * as openssl from '../openssl.js';
import safe from 'safetydance';
/* global describe:false */
'use strict';
const BoxError = require('../boxerror.js'),
expect = require('expect.js'),
openssl = require('../openssl.js'),
safe = require('safetydance');
describe('openssl', function () {
describe('validateCertificate', function () {
const foobarDomain = 'foobar.com';
+8 -9
View File
@@ -1,22 +1,21 @@
/* global it:false */
import expect from 'expect.js';
import fs from 'node:fs';
import ProgressStream from '../progress-stream.js';
import stream from 'node:stream';
/* global describe:false */
'use strict';
const expect = require('expect.js'),
fs = require('node:fs'),
ProgressStream = require('../progress-stream.js'),
stream = require('node:stream');
describe('progress stream', function () {
it('can create stream', function (done) {
const input = fs.createReadStream(`${__dirname}/progress-stream-test.js`);
const input = fs.createReadStream(`${import.meta.dirname}/progress-stream-test.js`);
const progress = new ProgressStream({ interval: 1000 });
const output = fs.createWriteStream('/dev/null');
stream.pipeline(input, progress, output, function (error) {
expect(error).to.not.be.ok();
const size = fs.statSync(`${__dirname}/progress-stream-test.js`).size;
const size = fs.statSync(`${import.meta.dirname}/progress-stream-test.js`).size;
expect(progress.stats().transferred).to.be(size);
done();
+5 -6
View File
@@ -1,13 +1,12 @@
/* jslint node:true */
import expect from 'expect.js';
import promiseRetry from '../promise-retry.js';
import safe from 'safetydance';
/* global it:false */
/* global describe:false */
'use strict';
const expect = require('expect.js'),
promiseRetry = require('../promise-retry.js'),
safe = require('safetydance');
describe('promiseRetry', function () {
this.timeout(0);
+9 -10
View File
@@ -1,18 +1,17 @@
/* global it:false */
import * as appstore from '../appstore.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import nock from 'nock';
import * as provision from '../provision.js';
import safe from 'safetydance';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const appstore = require('../appstore.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
nock = require('nock'),
provision = require('../provision.js'),
safe = require('safetydance');
describe('Provision', function () {
const { domainSetup, auditSource, cleanup } = common;
+8 -9
View File
@@ -1,17 +1,16 @@
/* global it:false */
import * as common from './common.js';
import * as domains from '../domains.js';
import expect from 'expect.js';
import fs from 'node:fs';
import paths from '../paths.js';
import * as reverseProxy from '../reverseproxy.js';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const common = require('./common.js'),
domains = require('../domains.js'),
expect = require('expect.js'),
fs = require('node:fs'),
paths = require('../paths.js'),
reverseProxy = require('../reverseproxy.js');
describe('Reverse Proxy', function () {
const { setup, cleanup, domain, auditSource, app } = common;
const domainCopy = Object.assign({}, domain);
+7 -8
View File
@@ -1,17 +1,16 @@
/* jslint node:true */
import constants from '../constants.js';
import expect from 'expect.js';
import safe from 'safetydance';
import * as server from '../server.js';
import superagent from '@cloudron/superagent';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const constants = require('../constants.js'),
expect = require('expect.js'),
safe = require('safetydance'),
server = require('../server.js'),
superagent = require('@cloudron/superagent');
const SERVER_URL = 'http://localhost:' + constants.PORT;
describe('Server', function () {
+10 -9
View File
@@ -1,15 +1,16 @@
/* jslint node:true */
import BoxError from '../boxerror.js';
import expect from 'expect.js';
import path from 'node:path';
import safe from 'safetydance';
import shellModule from '../shell.js';
const shell = shellModule('test');
/* global it:false */
/* global describe:false */
'use strict';
const BoxError = require('../boxerror.js'),
expect = require('expect.js'),
path = require('node:path'),
safe = require('safetydance'),
shell = require('../shell.js')('test');
describe('shell', function () {
describe('spawn', function () {
it('can run valid program', async function () {
@@ -52,7 +53,7 @@ describe('shell', function () {
});
it('can sudo valid program', async function () {
const RELOAD_NGINX_CMD = path.join(__dirname, '../src/scripts/restartservice.sh');
const RELOAD_NGINX_CMD = path.join(import.meta.dirname, '../src/scripts/restartservice.sh');
const [error] = await safe(shell.sudo([ RELOAD_NGINX_CMD, 'nginx' ], {}));
expect(error).to.be.ok();
});
+24 -25
View File
@@ -1,26 +1,25 @@
/* global it:false */
import * as backupSites from '../backupsites.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import consumers from 'node:stream/consumers';
import { execSync } from 'node:child_process';
import expect from 'expect.js';
import * as filesystem from '../storage/filesystem.js';
import fs from 'node:fs';
import * as gcs from '../storage/gcs.js';
import os from 'node:os';
import path from 'node:path';
import * as s3 from '../storage/s3.js';
import safe from 'safetydance';
import stream from 'stream/promises';
/* global describe:false */
/* global before:false */
/* global after:false */
/* global xit:false */
'use strict';
const backupSites = require('../backupsites.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
consumers = require('node:stream/consumers'),
execSync = require('node:child_process').execSync,
expect = require('expect.js'),
filesystem = require('../storage/filesystem.js'),
fs = require('node:fs'),
gcs = require('../storage/gcs.js'),
os = require('node:os'),
path = require('node:path'),
s3 = require('../storage/s3.js'),
safe = require('safetydance'),
stream = require('stream/promises');
describe('Storage', function () {
const { setup, cleanup, getDefaultBackupSite, auditSource } = common;
@@ -62,7 +61,7 @@ describe('Storage', function () {
});
it('can upload', async function () {
const sourceFile = path.join(__dirname, 'storage/data/test.txt');
const sourceFile = path.join(import.meta.dirname, 'storage/data/test.txt');
const sourceStream = fs.createReadStream(sourceFile);
const destFile = path.join(gBackupConfig.backupDir, gBackupConfig.prefix, '/uploadtest/test.txt');
const uploader = await filesystem.upload(gBackupConfig, {}, 'uploadtest/test.txt');
@@ -73,7 +72,7 @@ describe('Storage', function () {
});
xit('upload waits for empty file to be created', async function () {
const sourceFile = path.join(__dirname, 'storage/data/empty');
const sourceFile = path.join(import.meta.dirname, 'storage/data/empty');
const sourceStream = fs.createReadStream(sourceFile);
const destFile = path.join(gBackupConfig.backupDir, gBackupConfig.prefix, '/uploadtest/empty');
const uploader = await filesystem.upload(gBackupConfig, {}, destFile);
@@ -84,7 +83,7 @@ describe('Storage', function () {
});
it('upload unlinks old file', async function () {
const sourceFile = path.join(__dirname, 'storage/data/test.txt');
const sourceFile = path.join(import.meta.dirname, 'storage/data/test.txt');
const sourceStream = fs.createReadStream(sourceFile);
const destFile = path.join(gBackupConfig.backupDir, gBackupConfig.prefix, '/uploadtest/test.txt');
const oldStat = fs.statSync(destFile);
@@ -111,7 +110,7 @@ describe('Storage', function () {
});
it('list dir lists the source dir', async function () {
const sourceDir = path.join(__dirname, 'storage');
const sourceDir = path.join(import.meta.dirname, 'storage');
execSync(`cp -r ${sourceDir} ${gBackupConfig.backupDir}/${gBackupConfig.prefix}`, { encoding: 'utf8' });
let allFiles = [], marker = null;
@@ -242,7 +241,7 @@ describe('Storage', function () {
});
it('can upload', async function () {
const sourceFile = path.join(__dirname, 'storage/data/test.txt');
const sourceFile = path.join(import.meta.dirname, 'storage/data/test.txt');
const sourceStream = fs.createReadStream(sourceFile);
const destKey = 'uploadtest/test.txt';
const uploader = await s3.upload(backupConfig, {}, destKey);
@@ -276,7 +275,7 @@ describe('Storage', function () {
fs.writeFileSync(path.join(bucketPath, 'uploadtest/C++.gitignore'), 'special', 'utf8');
await s3.copyDir(backupConfig, {}, 'uploadtest', 'uploadtest-copy', () => {});
const sourceFile = path.join(__dirname, 'storage/data/test.txt');
const sourceFile = path.join(import.meta.dirname, 'storage/data/test.txt');
expect(fs.statSync(path.join(bucketPath, 'uploadtest-copy/test.txt')).size).to.be(fs.statSync(sourceFile).size);
expect(fs.statSync(path.join(bucketPath, 'uploadtest-copy/C++.gitignore')).size).to.be(7);
});
@@ -379,7 +378,7 @@ describe('Storage', function () {
});
it('can upload', async function () {
const sourceFile = path.join(__dirname, 'storage/data/test.txt');
const sourceFile = path.join(import.meta.dirname, 'storage/data/test.txt');
const sourceStream = fs.createReadStream(sourceFile);
const destKey = 'uploadtest/test.txt';
const uploader = await gcs.upload(backupConfig, {}, destKey);
@@ -413,7 +412,7 @@ describe('Storage', function () {
fs.writeFileSync(path.join(bucketPath, 'uploadtest/C++.gitignore'), 'special', 'utf8');
await gcs.copyDir(backupConfig, {}, 'uploadtest', 'uploadtest-copy', () => {});
const sourceFile = path.join(__dirname, 'storage/data/test.txt');
const sourceFile = path.join(import.meta.dirname, 'storage/data/test.txt');
expect(fs.statSync(path.join(bucketPath, 'uploadtest-copy/test.txt')).size).to.be(fs.statSync(sourceFile).size);
expect(fs.statSync(path.join(bucketPath, 'uploadtest-copy/C++.gitignore')).size).to.be(7);
});
+5 -6
View File
@@ -1,12 +1,11 @@
/* global it:false */
import expect from 'expect.js';
import safe from 'safetydance';
import superagent from '@cloudron/superagent';
/* global describe:false */
'use strict';
const expect = require('expect.js'),
safe = require('safetydance'),
superagent = require('@cloudron/superagent');
describe('Superagent', function () {
it('can get URL', async function () {
await superagent.get('https://www.cloudron.io').set('User-Agent', 'Mozilla').timeout(10*1000);
+13 -13
View File
@@ -1,20 +1,20 @@
/* global it:false */
import * as common from './common.js';
const { createTree } = common;
import DataLayout from '../datalayout.js';
import { execSync } from 'node:child_process';
import expect from 'expect.js';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import paths from '../paths.js';
import safe from 'safetydance';
import * as syncer from '../syncer.js';
/* global describe:false */
/* global before:false */
'use strict';
const createTree = require('./common.js').createTree,
DataLayout = require('../datalayout.js'),
execSync = require('node:child_process').execSync,
expect = require('expect.js'),
fs = require('node:fs'),
os = require('node:os'),
path = require('node:path'),
paths = require('../paths.js'),
safe = require('safetydance'),
syncer = require('../syncer.js');
const gTmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'syncer-test')),
gCacheFile = path.join(paths.BACKUP_INFO_DIR, 'syncer-test.sync.cache');
+10 -12
View File
@@ -1,20 +1,18 @@
#!/usr/bin/env node
/* global it:false */
import expect from 'expect.js';
import fs from 'node:fs';
import net from 'node:net';
import path from 'node:path';
import paths from '../paths.js';
import safe from 'safetydance';
import * as syslogServer from '../../syslog.js';
import timers from 'timers/promises';
/* global describe:false */
/* global after:false */
'use strict';
const expect = require('expect.js'),
fs = require('node:fs'),
net = require('node:net'),
path = require('node:path'),
paths = require('../paths.js'),
safe = require('safetydance'),
syslogServer = require('../../syslog.js'),
timers = require('timers/promises');
async function sendMessage(message) {
const client = net.createConnection(paths.SYSLOG_SOCKET_FILE);
+10 -10
View File
@@ -1,16 +1,16 @@
/* jslint node:true */
import child_process from 'node:child_process';
import * as common from './common.js';
import expect from 'expect.js';
import nock from 'nock';
import * as system from '../system.js';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const common = require('./common.js'),
expect = require('expect.js'),
nock = require('nock'),
system = require('../system.js');
describe('System', function () {
const { setup, cleanup } = common;
@@ -22,7 +22,7 @@ describe('System', function () {
it('can get filesystems', async function () {
// does not work on archlinux 8!
if (require('node:child_process').execSync('uname -a').toString().indexOf('-arch') !== -1) return;
if (child_process.execSync('uname -a').toString().indexOf('-arch') !== -1) return;
const filesystems = await system.getFilesystems();
expect(filesystems).to.be.ok();
@@ -31,7 +31,7 @@ describe('System', function () {
it('can get swaps', async function () {
// does not work on archlinux 8!
if (require('node:child_process').execSync('uname -a').toString().indexOf('-arch') !== -1) return;
if (child_process.execSync('uname -a').toString().indexOf('-arch') !== -1) return;
const swaps = await system.getSwaps();
expect(swaps).to.be.ok();
@@ -40,7 +40,7 @@ describe('System', function () {
it('can check for disk space', async function () {
// does not work on archlinux 8!
if (require('node:child_process').execSync('uname -a').toString().indexOf('-arch') !== -1) return;
if (child_process.execSync('uname -a').toString().indexOf('-arch') !== -1) return;
await system.checkDiskSpace();
});
+10 -11
View File
@@ -1,20 +1,19 @@
/* jslint node:true */
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import fs from 'node:fs';
import paths from '../paths.js';
import safe from 'safetydance';
import tasks from '../tasks.js';
import * as _ from '../underscore.js';
/* global it:false */
/* global before:false */
/* global after:false */
/* global describe:false */
'use strict';
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
fs = require('node:fs'),
paths = require('../paths.js'),
safe = require('safetydance'),
tasks = require('../tasks.js'),
_ = require('../underscore.js');
describe('task', function () {
const { setup, cleanup } = common;
+8 -9
View File
@@ -1,18 +1,17 @@
/* jslint node:true */
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import oidcClients from '../oidcclients.js';
import safe from 'safetydance';
import * as tokens from '../tokens.js';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
oidcClients = require('../oidcclients.js'),
safe = require('safetydance'),
tokens = require('../tokens.js');
describe('Tokens', function () {
const { setup, cleanup } = common;
+4 -5
View File
@@ -1,12 +1,11 @@
/* jslint node:true */
import expect from 'expect.js';
import * as translations from '../translations.js';
/* global it:false */
/* global describe:false */
'use strict';
const expect = require('expect.js'),
translations = require('../translations.js');
describe('translation', function () {
describe('translate', function () {
+2 -4
View File
@@ -1,9 +1,7 @@
'use strict';
/* global it, describe, before, after */
const expect = require('expect.js'),
_ = require('../underscore.js');
import expect from 'expect.js';
import * as _ from '../underscore.js';
describe('Underscore', function () {
it('pick', function () {
+12 -13
View File
@@ -1,21 +1,20 @@
/* global it:false */
import apps from '../apps.js';
import BoxError from '../boxerror.js';
import * as common from './common.js';
import constants from '../constants.js';
import expect from 'expect.js';
import nock from 'nock';
import paths from '../paths.js';
import safe from 'safetydance';
import semver from 'semver';
import * as updater from '../updater.js';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const apps = require('../apps.js'),
BoxError = require('../boxerror.js'),
common = require('./common.js'),
constants = require('../constants.js'),
expect = require('expect.js'),
nock = require('nock'),
paths = require('../paths.js'),
safe = require('safetydance'),
semver = require('semver'),
updater = require('../updater.js');
const UPDATE_VERSION = semver.inc(constants.VERSION, 'major');
describe('updater', function () {
+7 -8
View File
@@ -1,16 +1,15 @@
/* global it:false */
import * as common from './common.js';
import expect from 'expect.js';
import oidcClients from '../oidcclients.js';
import * as tokens from '../tokens.js';
import * as userDirectory from '../user-directory.js';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const common = require('./common.js'),
expect = require('expect.js'),
oidcClients = require('../oidcclients.js'),
tokens = require('../tokens.js'),
userDirectory = require('../user-directory.js');
describe('User Directory', function () {
const { setup, cleanup, admin, auditSource } = common;
+9 -10
View File
@@ -1,18 +1,17 @@
/* global it:false */
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import safe from 'safetydance';
import speakeasy from 'speakeasy';
import * as users from '../users.js';
import * as _ from '../underscore.js';
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
safe = require('safetydance'),
speakeasy = require('speakeasy'),
users = require('../users.js'),
_ = require('../underscore.js');
describe('User', function () {
const { domainSetup, cleanup, admin, user, auditSource, checkMails, clearMailQueue } = common;
+2 -4
View File
@@ -1,9 +1,7 @@
'use strict';
/* global it, describe, before, after */
const expect = require('expect.js'),
validator = require('../validator.js');
import expect from 'expect.js';
import * as validator from '../validator.js';
describe('Validator', function () {
const goodEmails = [
+8 -9
View File
@@ -1,18 +1,17 @@
/* jslint node:true */
import BoxError from '../boxerror.js';
import * as common from './common.js';
import expect from 'expect.js';
import paths from '../paths.js';
import safe from 'safetydance';
import * as volumes from '../volumes.js';
/* global it:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
const BoxError = require('../boxerror.js'),
common = require('./common.js'),
expect = require('expect.js'),
paths = require('../paths.js'),
safe = require('safetydance'),
volumes = require('../volumes.js');
describe('Volumes', function () {
const { setup, cleanup, auditSource } = common;