test-smtp-server 0.9.4 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/build/lib/test-smtp-server.d.ts +2 -2
- package/build/lib/test-smtp-server.js +2 -2
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -4,13 +4,14 @@ Test SMTP Server is a lightweight wrapper for
|
|
|
4
4
|
[smtp-server](<https://nodemailer.com/extras/smtp-server/>).
|
|
5
5
|
It is primarily intended for development and testing. The test code can start the server, run email tests and then validate the email contents. It can replace the use of external fake SMTP services which may have availablility issues.
|
|
6
6
|
|
|
7
|
-
All received emails are stored in an array. The emails
|
|
7
|
+
All received emails are stored in an array in the order received. The emails
|
|
8
|
+
may be viewed as raw data or a parsed object that is easily examined.
|
|
8
9
|
|
|
9
10
|
## Getting Started
|
|
10
11
|
|
|
11
12
|
### Prerequisites
|
|
12
13
|
|
|
13
|
-
Tested on Node
|
|
14
|
+
Tested on Node v18 with npm v9.
|
|
14
15
|
|
|
15
16
|
### Installation
|
|
16
17
|
|
|
@@ -31,8 +32,9 @@ import { testSmtpServer } from "test-smtp-server";
|
|
|
31
32
|
await smtpserver.startServer(); // start listening
|
|
32
33
|
|
|
33
34
|
// send some emails capturing ids ..
|
|
34
|
-
messageId.
|
|
35
|
+
messageId.push( await sendMail(email, smtpOptions));
|
|
35
36
|
|
|
37
|
+
// get emails in sent order
|
|
36
38
|
const mails = smtpserver.getEmails();
|
|
37
39
|
|
|
38
40
|
// validate/dump emails
|
|
@@ -23,7 +23,7 @@ export declare class eMail {
|
|
|
23
23
|
/**
|
|
24
24
|
* testSmtpServer optional parameters
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
26
|
+
export type testSmtpServerOptions = {
|
|
27
27
|
/** the port number to use (default: 1025) */
|
|
28
28
|
smtpPort?: number;
|
|
29
29
|
/** restrict ip addresses to localhost */
|
|
@@ -51,7 +51,7 @@ export declare class testSmtpServer {
|
|
|
51
51
|
*/
|
|
52
52
|
clearEmails(): number;
|
|
53
53
|
/**
|
|
54
|
-
* Retrieve the set of emails in order from
|
|
54
|
+
* Retrieve the set of emails in order from oldest to most recent.
|
|
55
55
|
*
|
|
56
56
|
* @returns array of eMail objects
|
|
57
57
|
*/
|
|
@@ -90,7 +90,7 @@ class testSmtpServer {
|
|
|
90
90
|
stream.on("end", () => {
|
|
91
91
|
const buffer = Buffer.concat(buffers);
|
|
92
92
|
const email = new eMail(session.envelope, buffer);
|
|
93
|
-
that.emails.
|
|
93
|
+
that.emails.push(email);
|
|
94
94
|
if (that.isDebugging) {
|
|
95
95
|
that.debug(JSON.stringify(email, (key, value) => {
|
|
96
96
|
if ("buffer" === key) {
|
|
@@ -118,7 +118,7 @@ class testSmtpServer {
|
|
|
118
118
|
return count;
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
|
-
* Retrieve the set of emails in order from
|
|
121
|
+
* Retrieve the set of emails in order from oldest to most recent.
|
|
122
122
|
*
|
|
123
123
|
* @returns array of eMail objects
|
|
124
124
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "test-smtp-server",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "The test-smtp-server package allows internal testing of projects needing an SMTP server.",
|
|
5
5
|
"main": "./build/lib/test-smtp-server.js",
|
|
6
6
|
"types": "./build/lib/test-smtp-server.d.ts",
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
"lint": "eslint --ignore-path .gitignore -c .eslintrc.js --ext .ts,.js \"{lib,test}/**/*.{ts,tsx,mjs,js}\"",
|
|
18
18
|
"test": "npm run test:ts && npm run test:js",
|
|
19
19
|
"test:ts": "node build/test/index.js",
|
|
20
|
-
"test:js": "node test/jstest.mjs"
|
|
20
|
+
"test:js": "node test/jstest.mjs",
|
|
21
|
+
"preversion": "npm run build && npm test",
|
|
22
|
+
"postversion": "git push --follow-tags"
|
|
21
23
|
},
|
|
22
24
|
"bugs": {
|
|
23
25
|
"url": "https://github.com/webstech/test-smtp-server/issues"
|
|
@@ -44,20 +46,20 @@
|
|
|
44
46
|
"url": "git+https://github.com/webstech/test-smtp-server"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
|
-
"@types/nodemailer": "^6.4.
|
|
49
|
+
"@types/nodemailer": "^6.4.7",
|
|
48
50
|
"@types/smtp-server": "^3.5.7",
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
50
|
-
"@typescript-eslint/parser": "^5.
|
|
51
|
-
"commander": "^9.
|
|
52
|
-
"eslint": "^8.
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
|
52
|
+
"@typescript-eslint/parser": "^5.47.0",
|
|
53
|
+
"commander": "^9.4.1",
|
|
54
|
+
"eslint": "^8.30.0",
|
|
53
55
|
"eslint-config-prettier": "^8.5.0",
|
|
54
|
-
"eslint-plugin-jsdoc": "^39.
|
|
56
|
+
"eslint-plugin-jsdoc": "^39.6.4",
|
|
55
57
|
"nodemailer": "^6.7.5",
|
|
56
|
-
"typescript": "^4.
|
|
58
|
+
"typescript": "^4.9.4"
|
|
57
59
|
},
|
|
58
60
|
"dependencies": {
|
|
59
61
|
"@types/mailparser": "^3.4.0",
|
|
60
|
-
"mailparser": "^3.
|
|
62
|
+
"mailparser": "^3.6.2",
|
|
61
63
|
"smtp-server": "^3.11.0"
|
|
62
64
|
},
|
|
63
65
|
"engines": {
|