Repository: haraka/Haraka
Pull request #3340 (2024-04-29 04:45:51)

mv tests test
- Puts our tests where modern test runners expect to find them.


Checklist:
- [x] docs updated
- [x] tests updated
- [x] [Changes](https://github.com/haraka/Haraka/blob/master/Changes.md) updated



Patch:
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 2dc8a281..321ec853 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -45,4 +45,4 @@ To submit new_branch as a Pull Request, visit the [Haraka project page](https://
 ## Tests
 
 * run all tests: ./run_tests  (or "npm test")
-* run tests for a single plugin: ./run_tests tests/plugins/bounce.js
\ No newline at end of file
+* run tests for a single plugin: ./run_tests test/plugins/bounce.js
diff --git a/.gitignore b/.gitignore
index 8bf6f6a4..cd6522eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,12 +8,17 @@ bower_components
 coverage
 .nyc_output
 .idea
+test/node_modules
+test/queue/plain
+test/queue/multibyte
+test/test-queue
 config/me
 config/dhparams.pem
 config/tls_cert.pem
 config/tls_key.pem
-tests/node_modules
-tests/queue/plain
-tests/queue/multibyte
-tests/test-queue
 package-lock.json
+config/dhparams.pem
+config/me
+config/tls_cert.pem
+config/tls_key.pem
+queue
diff --git a/Changes.md b/Changes.md
index f1572b5c..2f9f9086 100644
--- a/Changes.md
+++ b/Changes.md
@@ -51,6 +51,7 @@
 - tls_socket: remove secureConnection. Fixes #2743
 - .gitignore: add config/me and config/*.pem
 - test: convert test runner to mocha
+- test: rename tests -> test (where test runner expect) #3340
 
 #### Fixed
 
diff --git a/contrib/plugin2npm.sh b/contrib/plugin2npm.sh
index 9efa5f37..1aed7208 100755
--- a/contrib/plugin2npm.sh
+++ b/contrib/plugin2npm.sh
@@ -73,39 +73,8 @@ DEPRECATED
     $GIT_CMD add index.js
 fi
 
-
-if [ -f "tests/plugins/$1.js" ]; then
-    echo "copying tests/plugins/$1.js"
-    cp "tests/plugins/$1.js" "$PLUGIN_REPO/test/index.js"
-    git rm "tests/plugins/$1.js"
-    if [ ! -f "$PLUGIN_REPO/run_tests" ]; then
-        tee "$PLUGIN_REPO/run_tests" <<'EO_TEST_RUN'
-#!/usr/bin/env node
-'use strict'
-try {
-    var reporter = require('nodeunit-x').reporters.default;
-}
-catch (e) {
-    console.log(`
-Error: ${e.message}
-
-Cannot find nodeunit. Did you run 'npm install'?
-`)
-    process.exit()
-}
-
-process.chdir(__dirname);
-
-reporter.run([ 'test' ], undefined, (err) => {
-    process.exit(((err) ? 1 : 0));
-});
-EO_TEST_RUN
-
-        sed -i '' \
-            -e 's/"_mocha"/"nodeunit-x"/' \
-            -e 's/"mocha"/"nodeunit-x"/' \
-            "$PLUGIN_REPO/package.json"
-
-        $GIT_CMD add package.json
-    fi
+if [ -f "test/plugins/$1.js" ]; then
+    echo "copying test/plugins/$1.js"
+    cp "test/plugins/$1.js" "$PLUGIN_REPO/test/index.js"
+    git rm "test/plugins/$1.js"
 fi
diff --git a/outbound/queue.js b/outbound/queue.js
index 74173f3a..74a9355c 100644
--- a/outbound/queue.js
+++ b/outbound/queue.js
@@ -25,7 +25,7 @@ else if (process.env.HARAKA) {
     queue_dir = path.resolve(process.env.HARAKA, 'queue');
 }
 else {
-    queue_dir = path.resolve('tests', 'test-queue');
+    queue_dir = path.resolve('test', 'test-queue');
 }
 
 exports.queue_dir = queue_dir;
diff --git a/package.json b/package.json
index 04717160..671febba 100644
--- a/package.json
+++ b/package.json
@@ -90,9 +90,9 @@
     "haraka_grep": "./bin/haraka_grep"
   },
   "scripts": {
-    "test": "npx mocha --exit --timeout=3000 tests tests/outbound tests/plugins/auth tests/plugins/queue tests/plugins",
-    "lint": "npx eslint@^8 *.js outbound plugins plugins/*/*.js tests tests/*/*.js tests/*/*/*.js bin/haraka",
-    "lint:fix": "npx eslint@^8 --fix *.js outbound plugins plugins/*/*.js tests tests/*/*.js tests/*/*/*.js bin/haraka",
+    "test": "npx mocha --exit --timeout=3000 test test/outbound test/plugins/auth test/plugins/queue test/plugins",
+    "lint": "npx eslint@^8 *.js outbound plugins plugins/*/*.js test test/*/*.js test/*/*/*.js bin/haraka",
+    "lint:fix": "npx eslint@^8 --fix *.js outbound plugins plugins/*/*.js test test/*/*.js test/*/*/*.js bin/haraka",
     "versions": "npx dependency-version-checker check",
     "versions:fix": "npx dependency-version-checker update && npm run prettier:fix"
   }


Test patch:
diff --git a/run_tests b/run_tests
index 8bf01d54..6745a68e 100755
--- a/run_tests
+++ b/run_tests
@@ -1,5 +1,5 @@
 #!/bin/sh
 
-TESTS=${1:-"tests tests/outbound tests/plugins/auth tests/plugins/queue tests/plugins"}
+TESTS=${1:-"test test/outbound test/plugins/auth test/plugins/queue test/plugins"}
 
 npx mocha --exit $TESTS
diff --git a/tests/.eslintrc.yaml b/test/.eslintrc.yaml
similarity index 100%
rename from tests/.eslintrc.yaml
rename to test/.eslintrc.yaml
diff --git a/tests/config/auth_flat_file.ini b/test/config/auth_flat_file.ini
similarity index 100%
rename from tests/config/auth_flat_file.ini
rename to test/config/auth_flat_file.ini
diff --git a/tests/config/dhparams.pem b/test/config/dhparams.pem
similarity index 100%
rename from tests/config/dhparams.pem
rename to test/config/dhparams.pem
diff --git a/tests/config/helo.checks.ini b/test/config/helo.checks.ini
similarity index 100%
rename from tests/config/helo.checks.ini
rename to test/config/helo.checks.ini
diff --git a/tests/config/host_list b/test/config/host_list
similarity index 100%
rename from tests/config/host_list
rename to test/config/host_list
diff --git a/tests/config/outbound_tls_cert.pem b/test/config/outbound_tls_cert.pem
similarity index 100%
rename from tests/config/outbound_tls_cert.pem
rename to test/config/outbound_tls_cert.pem
diff --git a/tests/config/outbound_tls_key.pem b/test/config/outbound_tls_key.pem
similarity index 100%
rename from tests/config/outbound_tls_key.pem
rename to test/config/outbound_tls_key.pem
diff --git a/tests/config/plugins b/test/config/plugins
similarity index 100%
rename from tests/config/plugins
rename to test/config/plugins
diff --git a/tests/config/smtp.ini b/test/config/smtp.ini
similarity index 72%
rename from tests/config/smtp.ini
rename to test/config/smtp.ini
index 971cbd1d..65c0a725 100644
--- a/tests/config/smtp.ini
+++ b/test/config/smtp.ini
@@ -6,4 +6,4 @@ nodes=0
 
 daemonize=false
 
-spool_dir=tests/tmp/queue
+spool_dir=test/tmp/queue
diff --git a/tests/config/smtp_forward.ini b/test/config/smtp_forward.ini
similarity index 100%
rename from tests/config/smtp_forward.ini
rename to test/config/smtp_forward.ini
diff --git a/tests/config/tls.ini b/test/config/tls.ini
similarity index 100%
rename from tests/config/tls.ini
rename to test/config/tls.ini
diff --git a/tests/config/tls/ec.pem b/test/config/tls/ec.pem
similarity index 100%
rename from tests/config/tls/ec.pem
rename to test/config/tls/ec.pem
diff --git a/tests/config/tls/haraka.local.pem b/test/config/tls/haraka.local.pem
similarity index 100%
rename from tests/config/tls/haraka.local.pem
rename to test/config/tls/haraka.local.pem
diff --git a/tests/config/tls/mismatched.pem b/test/config/tls/mismatched.pem
similarity index 100%
rename from tests/config/tls/mismatched.pem
rename to test/config/tls/mismatched.pem
diff --git a/tests/config/tls_cert.pem b/test/config/tls_cert.pem
similarity index 100%
rename from tests/config/tls_cert.pem
rename to test/config/tls_cert.pem
diff --git a/tests/config/tls_key.pem b/test/config/tls_key.pem
similarity index 100%
rename from tests/config/tls_key.pem
rename to test/config/tls_key.pem
diff --git a/tests/connection.js b/test/connection.js
similarity index 100%
rename from tests/connection.js
rename to test/connection.js
diff --git a/tests/endpoint.js b/test/endpoint.js
similarity index 100%
rename from tests/endpoint.js
rename to test/endpoint.js
diff --git a/tests/fixtures/line_socket.js b/test/fixtures/line_socket.js
similarity index 100%
rename from tests/fixtures/line_socket.js
rename to test/fixtures/line_socket.js
diff --git a/tests/fixtures/todo_qfile.txt b/test/fixtures/todo_qfile.txt
similarity index 100%
rename from tests/fixtures/todo_qfile.txt
rename to test/fixtures/todo_qfile.txt
diff --git a/tests/fixtures/util_hmailitem.js b/test/fixtures/util_hmailitem.js
similarity index 100%
rename from tests/fixtures/util_hmailitem.js
rename to test/fixtures/util_hmailitem.js
diff --git a/tests/host_pool.js b/test/host_pool.js
similarity index 100%
rename from tests/host_pool.js
rename to test/host_pool.js
diff --git a/tests/installation/config/test-plugin-flat b/test/installation/config/test-plugin-flat
similarity index 100%
rename from tests/installation/config/test-plugin-flat
rename to test/installation/config/test-plugin-flat
diff --git a/tests/installation/config/test-plugin.ini b/test/installation/config/test-plugin.ini
similarity index 100%
rename from tests/installation/config/test-plugin.ini
rename to test/installation/config/test-plugin.ini
diff --git a/tests/installation/config/tls.ini b/test/installation/config/tls.ini
similarity index 100%
rename from tests/installation/config/tls.ini
rename to test/installation/config/tls.ini
diff --git a/tests/installation/node_modules/load_first/index.js b/test/installation/node_modules/load_first/index.js
similarity index 100%
rename from tests/installation/node_modules/load_first/index.js
rename to test/installation/node_modules/load_first/index.js
diff --git a/tests/installation/node_modules/load_first/package.json b/test/installation/node_modules/load_first/package.json
similarity index 100%
rename from tests/installation/node_modules/load_first/package.json
rename to test/installation/node_modules/load_first/package.json
diff --git a/tests/installation/node_modules/test-plugin/config/test-plugin-flat b/test/installation/node_modules/test-plugin/config/test-plugin-flat
similarity index 100%
rename from tests/installation/node_modules/test-plugin/config/test-plugin-flat
rename to test/installation/node_modules/test-plugin/config/test-plugin-flat
diff --git a/tests/installation/node_modules/test-plugin/config/test-plugin.ini b/test/installation/node_modules/test-plugin/config/test-plugin.ini
similarity index 100%
rename from tests/installation/node_modules/test-plugin/config/test-plugin.ini
rename to test/installation/node_modules/test-plugin/config/test-plugin.ini
diff --git a/tests/installation/node_modules/test-plugin/package.json b/test/installation/node_modules/test-plugin/package.json
similarity index 100%
rename from tests/installation/node_modules/test-plugin/package.json
rename to test/installation/node_modules/test-plugin/package.json
diff --git a/tests/installation/node_modules/test-plugin/test-plugin.js b/test/installation/node_modules/test-plugin/test-plugin.js
similarity index 100%
rename from tests/installation/node_modules/test-plugin/test-plugin.js
rename to test/installation/node_modules/test-plugin/test-plugin.js
diff --git a/tests/installation/plugins/base_plugin.js b/test/installation/plugins/base_plugin.js
similarity index 100%
rename from tests/installation/plugins/base_plugin.js
rename to test/installation/plugins/base_plugin.js
diff --git a/tests/installation/plugins/folder_plugin/index.js b/test/installation/plugins/folder_plugin/index.js
similarity index 100%
rename from tests/installation/plugins/folder_plugin/index.js
rename to test/installation/plugins/folder_plugin/index.js
diff --git a/tests/installation/plugins/folder_plugin/package.json b/test/installation/plugins/folder_plugin/package.json
similarity index 100%
rename from tests/installation/plugins/folder_plugin/package.json
rename to test/installation/plugins/folder_plugin/package.json
diff --git a/tests/installation/plugins/inherits.js b/test/installation/plugins/inherits.js
similarity index 100%
rename from tests/installation/plugins/inherits.js
rename to test/installation/plugins/inherits.js
diff --git a/tests/installation/plugins/load_first.js b/test/installation/plugins/load_first.js
similarity index 100%
rename from tests/installation/plugins/load_first.js
rename to test/installation/plugins/load_first.js
diff --git a/tests/installation/plugins/plugin.js b/test/installation/plugins/plugin.js
similarity index 100%
rename from tests/installation/plugins/plugin.js
rename to test/installation/plugins/plugin.js
diff --git a/tests/installation/plugins/tls.js b/test/installation/plugins/tls.js
similarity index 100%
rename from tests/installation/plugins/tls.js
rename to test/installation/plugins/tls.js
diff --git a/tests/logger.js b/test/logger.js
similarity index 100%
rename from tests/logger.js
rename to test/logger.js
diff --git a/tests/loud/config/dhparams.pem b/test/loud/config/dhparams.pem
similarity index 100%
rename from tests/loud/config/dhparams.pem
rename to test/loud/config/dhparams.pem
diff --git a/tests/loud/config/tls.ini b/test/loud/config/tls.ini
similarity index 100%
rename from tests/loud/config/tls.ini
rename to test/loud/config/tls.ini
diff --git a/tests/loud/config/tls/goobered.pem b/test/loud/config/tls/goobered.pem
similarity index 100%
rename from tests/loud/config/tls/goobered.pem
rename to test/loud/config/tls/goobered.pem
diff --git a/tests/mail_specimen/base64-root-part.txt b/test/mail_specimen/base64-root-part.txt
similarity index 100%
rename from tests/mail_specimen/base64-root-part.txt
rename to test/mail_specimen/base64-root-part.txt
diff --git a/tests/mail_specimen/varied-fold-lengths-preserve-data.txt b/test/mail_specimen/varied-fold-lengths-preserve-data.txt
similarity index 100%
rename from tests/mail_specimen/varied-fold-lengths-preserve-data.txt
rename to test/mail_specimen/varied-fold-lengths-preserve-data.txt
diff --git a/tests/outbound/hmail.js b/test/outbound/hmail.js
similarity index 88%
rename from tests/outbound/hmail.js
rename to test/outbound/hmail.js
index 05b57470..9f7973ba 100644
--- a/tests/outbound/hmail.js
+++ b/test/outbound/hmail.js
@@ -9,7 +9,7 @@ const outbound = require('../../outbound/index');
 
 describe('outbound/hmail', () => {
     beforeEach((done) => {
-        this.hmail = new Hmail('1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka', 'tests/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka', {});
+        this.hmail = new Hmail('1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka', 'test/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka', {});
         done()
     })
 
@@ -44,7 +44,7 @@ describe('outbound/hmail', () => {
 
 describe('outbound/hmail.HMailItem', () => {
     it('normal queue file', (done) => {
-        this.hmail = new Hmail('1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka', 'tests/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka', {});
+        this.hmail = new Hmail('1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka', 'test/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka', {});
         this.hmail.on('ready', () => {
             // console.log(this.hmail);
             assert.ok(this.hmail)
@@ -57,7 +57,7 @@ describe('outbound/hmail.HMailItem', () => {
         })
     })
     it('normal TODO w/multibyte chars loads w/o error', (done) => {
-        this.hmail = new Hmail('1507509981169_1507509981169_0_61403_e0Y0Ym_1_qfile', 'tests/fixtures/todo_qfile.txt', {});
+        this.hmail = new Hmail('1507509981169_1507509981169_0_61403_e0Y0Ym_1_qfile', 'test/fixtures/todo_qfile.txt', {});
         this.hmail.on('ready', () => {
             // console.log(this.hmail);
             assert.ok(this.hmail)
@@ -70,7 +70,7 @@ describe('outbound/hmail.HMailItem', () => {
         })
     })
     it('too short TODO length declared', (done) => {
-        this.hmail = new Hmail('1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka', 'tests/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka', {});
+        this.hmail = new Hmail('1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka', 'test/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka', {});
         this.hmail.on('ready', () => {
             // console.log(this.hmail);
             assert.ok(this.hmail)
@@ -83,7 +83,7 @@ describe('outbound/hmail.HMailItem', () => {
         })
     })
     it('too long TODO length declared', (done) => {
-        this.hmail = new Hmail('1508269674999_1508269674999_0_34002_socVUF_1_haraka', 'tests/queue/1508269674999_1508269674999_0_34002_socVUF_1_haraka', {});
+        this.hmail = new Hmail('1508269674999_1508269674999_0_34002_socVUF_1_haraka', 'test/queue/1508269674999_1508269674999_0_34002_socVUF_1_haraka', {});
         this.hmail.on('ready', () => {
             // console.log(this.hmail);
             assert.ok(this.hmail)
@@ -96,7 +96,7 @@ describe('outbound/hmail.HMailItem', () => {
         })
     })
     it('zero-length file load skip w/o crash', (done) => {
-        this.hmail = new Hmail('1507509981169_1507509981169_0_61403_e0Y0Ym_2_zero', 'tests/queue/zero-length', {});
+        this.hmail = new Hmail('1507509981169_1507509981169_0_61403_e0Y0Ym_2_zero', 'test/queue/zero-length', {});
         this.hmail.on('ready', () => {
             assert.ok(this.hmail)
             done();
@@ -109,7 +109,7 @@ describe('outbound/hmail.HMailItem', () => {
     })
     it('lifecycle, reads and writes a haraka queue file', (done) => {
 
-        this.hmail = new Hmail('1507509981169_1507509981169_0_61403_e0Y0Ym_2_qfile', 'tests/fixtures/todo_qfile.txt', {});
+        this.hmail = new Hmail('1507509981169_1507509981169_0_61403_e0Y0Ym_2_qfile', 'test/fixtures/todo_qfile.txt', {});
 
         this.hmail.on('error', (err) => {
             // console.log(err);
@@ -119,7 +119,7 @@ describe('outbound/hmail.HMailItem', () => {
 
         this.hmail.on('ready', () => {
 
-            const tmpfile = path.resolve('tests', 'test-queue', 'delete-me');
+            const tmpfile = path.resolve('test', 'test-queue', 'delete-me');
             const ws = new fs.createWriteStream(tmpfile)
 
             outbound.build_todo(this.hmail.todo, ws, () => {
diff --git a/tests/outbound/index.js b/test/outbound/index.js
similarity index 90%
rename from tests/outbound/index.js
rename to test/outbound/index.js
index 069795bb..e5af7559 100644
--- a/tests/outbound/index.js
+++ b/test/outbound/index.js
@@ -76,13 +76,13 @@ describe('outbound', () => {
 
     describe('get_tls_options', () => {
         beforeEach((done) => {
-            process.env.HARAKA_TEST_DIR=path.resolve('tests');
+            process.env.HARAKA_TEST_DIR=path.resolve('test');
             this.outbound = require('../../outbound');
             this.obtls = require('../../outbound/tls');
             const tls_socket = require('../../tls_socket');
 
             // reset config to load from tests directory
-            const testDir = path.resolve('tests');
+            const testDir = path.resolve('test');
             this.outbound.config = this.outbound.config.module_config(testDir);
             this.obtls.test_config(tls_socket.config.module_config(testDir), this.outbound.config);
             this.obtls.init(done)
@@ -100,9 +100,9 @@ describe('outbound', () => {
 
             assert.deepEqual(tls_config, {
                 servername: 'mail.example.com',
-                key: fs.readFileSync(path.resolve('tests','config','outbound_tls_key.pem')),
-                cert: fs.readFileSync(path.resolve('tests','config','outbound_tls_cert.pem')),
-                dhparam: fs.readFileSync(path.resolve('tests','config','dhparams.pem')),
+                key: fs.readFileSync(path.resolve('test','config','outbound_tls_key.pem')),
+                cert: fs.readFileSync(path.resolve('test','config','outbound_tls_cert.pem')),
+                dhparam: fs.readFileSync(path.resolve('test','config','dhparams.pem')),
                 ciphers: 'ECDHE-RSA-AES256-GCM-SHA384',
                 minVersion: 'TLSv1',
                 rejectUnauthorized: false,
@@ -119,8 +119,8 @@ describe('outbound', () => {
         beforeEach((done) => {
             this.outbound = require('../../outbound');
             try {
-                fs.unlinkSync('tests/queue/multibyte');
-                fs.unlinkSync('tests/queue/plain');
+                fs.unlinkSync('test/queue/multibyte');
+                fs.unlinkSync('test/queue/plain');
             }
             catch (ignore) {}
             done();
@@ -128,8 +128,8 @@ describe('outbound', () => {
 
         it('saves a file', () => {
             const todo = JSON.parse('{"queue_time":1507509981169,"domain":"redacteed.com","rcpt_to":[{"original":"<postmaster@redacteed.com>","original_host":"redacteed.com","host":"redacteed.com","user":"postmaster"}],"mail_from":{"original":"<matt@tnpi.net>","original_host":"tnpi.net","host":"tnpi.net","user":"matt"},"notes":{"authentication_results":["spf=pass smtp.mailfrom=tnpi.net"],"spf_mail_result":"Pass","spf_mail_record":"v=spf1 a mx include:mx.theartfarm.com ?include:forwards._spf.tnpi.net include:lists._spf.tnpi.net -all","attachment_count":0,"attachments":[{"ctype":"application/pdf","filename":"FileWithoutAccent Chars.pdf","extension":".pdf","md5":"6c1d5f5c047cff3f6320b1210970bdf6"}],"attachment_ctypes":["application/pdf","multipart/mixed","text/plain","application/pdf"],"attachment_files":["FileWithoutaccent Chars.pdf"],"attachment_archive_files":[]},"uuid":"1D5483B0-3E00-4280-A961-3AFD2017B4FC.1"}');
-            const fd = fs.openSync('tests/queue/plain', 'w');
-            const ws = new fs.createWriteStream('tests/queue/plain', { fd, flags: constants.WRITE_EXCL });
+            const fd = fs.openSync('test/queue/plain', 'w');
+            const ws = new fs.createWriteStream('test/queue/plain', { fd, flags: constants.WRITE_EXCL });
             ws.on('close', () => {
                 // console.log(arguments);
                 assert.ok(1);
@@ -145,8 +145,8 @@ describe('outbound', () => {
 
         it('saves a file with multibyte chars', () => {
             const todo = JSON.parse('{"queue_time":1507509981169,"domain":"redacteed.com","rcpt_to":[{"original":"<postmaster@redacteed.com>","original_host":"redacteed.com","host":"redacteed.com","user":"postmaster"}],"mail_from":{"original":"<matt@tnpi.net>","original_host":"tnpi.net","host":"tnpi.net","user":"matt"},"notes":{"authentication_results":["spf=pass smtp.mailfrom=tnpi.net"],"spf_mail_result":"Pass","spf_mail_record":"v=spf1 a mx include:mx.theartfarm.com ?include:forwards._spf.tnpi.net include:lists._spf.tnpi.net -all","attachment_count":0,"attachments":[{"ctype":"application/pdf","filename":"FileWîthÁccent Chars.pdf","extension":".pdf","md5":"6c1d5f5c047cff3f6320b1210970bdf6"}],"attachment_ctypes":["application/pdf","multipart/mixed","text/plain","application/pdf"],"attachment_files":["FileWîthÁccent Chars.pdf"],"attachment_archive_files":[]},"uuid":"1D5483B0-3E00-4280-A961-3AFD2017B4FC.1"}');
-            const fd = fs.openSync('tests/queue/multibyte', 'w');
-            const ws = new fs.WriteStream('tests/queue/multibyte', { fd, flags: constants.WRITE_EXCL });
+            const fd = fs.openSync('test/queue/multibyte', 'w');
+            const ws = new fs.WriteStream('test/queue/multibyte', { fd, flags: constants.WRITE_EXCL });
             ws.on('close', () => {
                 assert.ok(1);
             })
@@ -162,7 +162,7 @@ describe('outbound', () => {
 
     describe('timer_queue', () => {
         beforeEach((done) => {
-            process.env.HARAKA_TEST_DIR=path.resolve('tests');
+            process.env.HARAKA_TEST_DIR=path.resolve('test');
             this.outbound = require('../../outbound');
             const TimerQueue = require('../../outbound/timer_queue');
             this.ob_timer_queue = new TimerQueue(500);
diff --git a/tests/outbound/qfile.js b/test/outbound/qfile.js
similarity index 100%
rename from tests/outbound/qfile.js
rename to test/outbound/qfile.js
diff --git a/tests/outbound_bounce_net_errors.js b/test/outbound_bounce_net_errors.js
similarity index 100%
rename from tests/outbound_bounce_net_errors.js
rename to test/outbound_bounce_net_errors.js
diff --git a/tests/outbound_bounce_rfc3464.js b/test/outbound_bounce_rfc3464.js
similarity index 100%
rename from tests/outbound_bounce_rfc3464.js
rename to test/outbound_bounce_rfc3464.js
diff --git a/tests/plugins.js b/test/plugins.js
similarity index 94%
rename from tests/plugins.js
rename to test/plugins.js
index af509cf1..30338df4 100644
--- a/tests/plugins.js
+++ b/test/plugins.js
@@ -17,7 +17,7 @@ From: https://github.com/haraka/Haraka/pull/1278#issuecomment-172134064
     * Need to test installed mode + core mode
     * Need to test each variation of loading plugins
         INSTALLED MODE
-            * Create tests/installation/ with config/, plugins/, and node_modules
+            * Create test/installation/ with config/, plugins/, and node_modules
             * Plugin in <install_dir>/plugins/<name>.js
             * Plugin in <install_dir>/plugins/<name>/ with package.json
             * Plugin in <install_dir>/node_modules/<name>/ with package.json
@@ -31,10 +31,10 @@ From: https://github.com/haraka/Haraka/pull/1278#issuecomment-172134064
     * Need to test plugin not existing
         * Check <bogus_name_guaranteed_to_not_exist> fails
     * Need to test plugin existing and failing to compile
-        * Create bad plugin in tests/installation/plugins/bad_plugin.js
+        * Create bad plugin in test/installation/plugins/bad_plugin.js
     * Need to test plugin inheritance
-        * Base plugin in tests/installation/plugins/base_plugin.js
-        * Real plugin in tests/installation/plugins/inherits.js
+        * Base plugin in test/installation/plugins/base_plugin.js
+        * Real plugin in test/installation/plugins/inherits.js
         * Check base methods work
         * Check plugin.base.base_plugin is set/correct
     * Plugin timeouts (already tested)
@@ -101,7 +101,7 @@ describe('plugin', () => {
         })
 
         it('INSTALLED override: (tls)', () => {
-            process.env.HARAKA = path.resolve(__dirname, '..', 'tests', 'installation');
+            process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
 
             const p = new plugin.Plugin('tls');
 
@@ -109,7 +109,7 @@ describe('plugin', () => {
         })
 
         it('INSTALLED node_modules package plugin: (test-plugin)', () => {
-            process.env.HARAKA = path.resolve(__dirname, '..', 'tests', 'installation');
+            process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
 
             const p = new plugin.Plugin('test-plugin');
 
@@ -133,7 +133,7 @@ describe('plugin', () => {
         })
 
         it('plugins overrides node_modules', () => {
-            process.env.HARAKA = path.resolve(__dirname, '..', 'tests', 'installation');
+            process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
 
             const p = new plugin.Plugin('load_first');
 
@@ -150,7 +150,7 @@ describe('plugin', () => {
         })
 
         it('INSTALLED plugins folder plugin: (folder_plugin)', () => {
-            process.env.HARAKA = path.resolve(__dirname, '..', 'tests', 'installation');
+            process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
 
             const p = new plugin.Plugin('folder_plugin');
 
@@ -167,7 +167,7 @@ describe('plugin', () => {
         })
 
         it('Inheritance: (inherits)', () => {
-            process.env.HARAKA = path.resolve(__dirname, '..', 'tests', 'installation');
+            process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
 
             const p = new plugin.Plugin('inherits');
 
@@ -205,7 +205,7 @@ describe('plugin', () => {
 
         it('INSTALLED override: (tls)', () => {
 
-            process.env.HARAKA = path.resolve(__dirname, '..', 'tests', 'installation');
+            process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
 
             const p = new plugin.Plugin('tls');
 
@@ -217,7 +217,7 @@ describe('plugin', () => {
 
         it('INSTALLED node_modules package plugin: (test-plugin)', () => {
 
-            process.env.HARAKA = path.resolve(__dirname, '..', 'tests', 'installation');
+            process.env.HARAKA = path.resolve(__dirname, '..', 'test', 'installation');
 
             const p = new plugin.Plugin('test-plugin');
 
diff --git a/tests/plugins/auth/auth_base.js b/test/plugins/auth/auth_base.js
similarity index 100%
rename from tests/plugins/auth/auth_base.js
rename to test/plugins/auth/auth_base.js
diff --git a/tests/plugins/auth/auth_vpopmaild.js b/test/plugins/auth/auth_vpopmaild.js
similarity index 100%
rename from tests/plugins/auth/auth_vpopmaild.js
rename to test/plugins/auth/auth_vpopmaild.js
diff --git a/tests/plugins/bounce.js b/test/plugins/bounce.js
similarity index 100%
rename from tests/plugins/bounce.js
rename to test/plugins/bounce.js
diff --git a/tests/plugins/clamd.js b/test/plugins/clamd.js
similarity index 100%
rename from tests/plugins/clamd.js
rename to test/plugins/clamd.js
diff --git a/tests/plugins/early_talker.js b/test/plugins/early_talker.js
similarity index 100%
rename from tests/plugins/early_talker.js
rename to test/plugins/early_talker.js
diff --git a/tests/plugins/greylist.js b/test/plugins/greylist.js
similarity index 100%
rename from tests/plugins/greylist.js
rename to test/plugins/greylist.js
diff --git a/tests/plugins/helo.checks.js b/test/plugins/helo.checks.js
similarity index 99%
rename from tests/plugins/helo.checks.js
rename to test/plugins/helo.checks.js
index 519740ec..a1a3dbc8 100644
--- a/tests/plugins/helo.checks.js
+++ b/test/plugins/helo.checks.js
@@ -7,7 +7,7 @@ const fixtures = require('haraka-test-fixtures');
 const _set_up = (done) => {
 
     this.plugin = new fixtures.plugin('helo.checks');
-    this.plugin.config.root_path = path.resolve('tests', 'config');
+    this.plugin.config.root_path = path.resolve('test', 'config');
 
     this.connection = fixtures.connection.createConnection();
     this.connection.remote.ip='208.75.199.19';
diff --git a/tests/plugins/mail_from.is_resolvable.js b/test/plugins/mail_from.is_resolvable.js
similarity index 100%
rename from tests/plugins/mail_from.is_resolvable.js
rename to test/plugins/mail_from.is_resolvable.js
diff --git a/tests/plugins/queue/smtp_forward.js b/test/plugins/queue/smtp_forward.js
similarity index 99%
rename from tests/plugins/queue/smtp_forward.js
rename to test/plugins/queue/smtp_forward.js
index b29b8d74..2956ac7c 100644
--- a/tests/plugins/queue/smtp_forward.js
+++ b/test/plugins/queue/smtp_forward.js
@@ -11,8 +11,8 @@ const OK = 906;
 const _setup = (done) => {
     this.plugin = new fixtures.plugin('queue/smtp_forward');
 
-    // switch config directory to 'tests/config'
-    this.plugin.config = this.plugin.config.module_config(path.resolve('tests'));
+    // switch config directory to 'test/config'
+    this.plugin.config = this.plugin.config.module_config(path.resolve('test'));
 
     this.plugin.register();
     this.hmail = { todo: { notes: new Notes() } };
diff --git a/tests/plugins/rcpt_to.host_list_base.js b/test/plugins/rcpt_to.host_list_base.js
similarity index 100%
rename from tests/plugins/rcpt_to.host_list_base.js
rename to test/plugins/rcpt_to.host_list_base.js
diff --git a/tests/plugins/rcpt_to.in_host_list.js b/test/plugins/rcpt_to.in_host_list.js
similarity index 100%
rename from tests/plugins/rcpt_to.in_host_list.js
rename to test/plugins/rcpt_to.in_host_list.js
diff --git a/tests/plugins/relay.js b/test/plugins/relay.js
similarity index 100%
rename from tests/plugins/relay.js
rename to test/plugins/relay.js
diff --git a/tests/plugins/spamassassin.js b/test/plugins/spamassassin.js
similarity index 100%
rename from tests/plugins/spamassassin.js
rename to test/plugins/spamassassin.js
diff --git a/tests/plugins/status.js b/test/plugins/status.js
similarity index 100%
rename from tests/plugins/status.js
rename to test/plugins/status.js
diff --git a/tests/plugins/tls.js b/test/plugins/tls.js
similarity index 95%
rename from tests/plugins/tls.js
rename to test/plugins/tls.js
index 7e6fd763..2eb3ccbf 100644
--- a/tests/plugins/tls.js
+++ b/test/plugins/tls.js
@@ -10,9 +10,9 @@ const _set_up = (done) => {
     this.plugin = new Plugin('tls')
     this.connection = new fixtures.connection.createConnection();
 
-    // use tests/config instead of ./config
-    this.plugin.config = this.plugin.config.module_config(path.resolve('tests'));
-    this.plugin.net_utils.config = this.plugin.net_utils.config.module_config(path.resolve('tests'));
+    // use test/config instead of ./config
+    this.plugin.config = this.plugin.config.module_config(path.resolve('test'));
+    this.plugin.net_utils.config = this.plugin.net_utils.config.module_config(path.resolve('test'));
 
     this.plugin.tls_opts = {};
     done();
diff --git a/tests/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_fixed b/test/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_fixed
similarity index 100%
rename from tests/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_fixed
rename to test/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_fixed
diff --git a/tests/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka b/test/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka
similarity index 100%
rename from tests/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka
rename to test/queue/1507509981169_1507509981169_0_61403_e0Y0Ym_1_haraka
diff --git a/tests/queue/1508269674999_1508269674999_0_34002_socVUF_1_haraka b/test/queue/1508269674999_1508269674999_0_34002_socVUF_1_haraka
similarity index 100%
rename from tests/queue/1508269674999_1508269674999_0_34002_socVUF_1_haraka
rename to test/queue/1508269674999_1508269674999_0_34002_socVUF_1_haraka
diff --git a/tests/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka b/test/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka
similarity index 100%
rename from tests/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka
rename to test/queue/1508455115683_1508455115683_0_90253_9Q4o4V_1_haraka
diff --git a/tests/queue/zero-length b/test/queue/zero-length
similarity index 100%
rename from tests/queue/zero-length
rename to test/queue/zero-length
diff --git a/tests/rfc1869.js b/test/rfc1869.js
similarity index 100%
rename from tests/rfc1869.js
rename to test/rfc1869.js
diff --git a/tests/server.js b/test/server.js
similarity index 99%
rename from tests/server.js
rename to test/server.js
index a7f946ed..4467ae23 100644
--- a/tests/server.js
+++ b/test/server.js
@@ -12,10 +12,10 @@ const _set_up = (done) => {
 
 const _setupServer = (ip_port, done) => {
     process.env.YES_REALLY_DO_DISCARD=1;   // for queue/discard plugin
-    process.env.HARAKA_TEST_DIR=path.resolve('tests');
+    process.env.HARAKA_TEST_DIR=path.resolve('test');
 
     // test sets the default path for plugin instances to the test dir
-    const test_cfg_path=path.resolve('tests');
+    const test_cfg_path=path.resolve('test');
 
     this.server = require('../server');
     this.config = require('haraka-config').module_config(test_cfg_path);
@@ -121,7 +121,7 @@ describe('server', () => {
     describe('get_smtp_server', () => {
         beforeEach((done) => {
             this.config = require('haraka-config');
-            this.config = this.config.module_config(path.resolve('tests'));
+            this.config = this.config.module_config(path.resolve('test'));
 
             this.server = require('../server');
             this.server.config = this.config;
@@ -488,4 +488,4 @@ describe('server', () => {
             }, 500);
         })
     })
-})
\ No newline at end of file
+})
diff --git a/tests/smtp_client.js b/test/smtp_client.js
similarity index 99%
rename from tests/smtp_client.js
rename to test/smtp_client.js
index 01a0c430..95d7fcfc 100644
--- a/tests/smtp_client.js
+++ b/test/smtp_client.js
@@ -17,8 +17,8 @@ describe('smtp_client', () => {
 
         const plugin = new fixtures.plugin('queue/smtp_forward');
 
-        // switch config directory to 'tests/config'
-        plugin.config = plugin.config.module_config(path.resolve('tests'));
+        // switch config directory to 'test/config'
+        plugin.config = plugin.config.module_config(path.resolve('test'));
 
         plugin.register();
 
diff --git a/tests/tls_socket.js b/test/tls_socket.js
similarity index 97%
rename from tests/tls_socket.js
rename to test/tls_socket.js
index 1625855e..87bfe0f1 100644
--- a/tests/tls_socket.js
+++ b/test/tls_socket.js
@@ -7,8 +7,8 @@ const os     = require('os')
 const _setup = (done) => {
     this.socket = require('../tls_socket');
 
-    // use tests/config instead of ./config
-    this.socket.config = this.socket.config.module_config(path.resolve('tests'));
+    // use test/config instead of ./config
+    this.socket.config = this.socket.config.module_config(path.resolve('test'));
     done();
 }
 
@@ -65,8 +65,8 @@ describe('tls_socket', () => {
     describe('get_loud_certs_dir', () => {
         beforeEach(_setup)
 
-        it('loads certs from tests/loud/config/tls', () => {
-            this.socket.config = this.socket.config.module_config(path.resolve('tests', 'loud'));
+        it('loads certs from test/loud/config/tls', () => {
+            this.socket.config = this.socket.config.module_config(path.resolve('test', 'loud'));
             this.socket.get_certs_dir('tls', (err, certs) => {
                 assert.ifError(err);
                 assert.ok(certs);
@@ -77,8 +77,8 @@ describe('tls_socket', () => {
     describe('get_certs_dir', () => {
         beforeEach(_setup)
 
-        it('loads certs from tests/config/tls', () => {
-            this.socket.config = this.socket.config.module_config(path.resolve('tests'));
+        it('loads certs from test/config/tls', () => {
+            this.socket.config = this.socket.config.module_config(path.resolve('test'));
             this.socket.get_certs_dir('tls', (err, certs) => {
                 assert.ifError(err);
                 assert.ok(certs);
@@ -141,7 +141,7 @@ describe('tls_socket', () => {
         })
 
         it('loads tls.ini from test dir', () => {
-            this.socket.config = this.socket.config.module_config(path.resolve('tests'));
+            this.socket.config = this.socket.config.module_config(path.resolve('test'));
             assert.deepEqual(this.socket.load_tls_ini(), {
                 main: {
                     requestCert: true,
@@ -245,7 +245,7 @@ Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
         })
 
         it('returns cert and key from EC pem', () => {
-            const fp = fs.readFileSync(path.join('tests','config','tls','ec.pem'))
+            const fp = fs.readFileSync(path.join('test','config','tls','ec.pem'))
             const res = this.socket.parse_x509(fp.toString())
             assert.deepEqual(
                 res.key.toString().split(os.EOL).join('\n'),