doublesharp / nodemailer-mock Goto Github PK
View Code? Open in Web Editor NEWMocked nodemailer module for testing
License: MIT License
Mocked nodemailer module for testing
License: MIT License
I don't think it is fair to silently install git hooks for pre-commit and pre-push as well as all the additional scripts added to our package.json.
It would be nice if the template sender was also mockable.
The Mockery project seems dead and untouched since 2017.
Add or change the existing exemple by using an other project will be great ! Something like sinon.js ?
Is there the possibility to mock the array returned by SMTP transports that includes recipient addresses that were rejected by the server?
Hi.
Thanks for providing this module.
Problem:
I am maintaining npm-shrinkwrap.json in my application. Now if I try install nodemailer-mock, my application's shrink wrapping is failing by giving many extraneous errors.
Example error:
npm WARN saveError extraneous: [email protected] /Users/sravankumarrekandar/workarea/nodemailer-test/node_modules/nodemailer-mock/node_modules/lodash.keys
..
The issue was fixed when I deleted both my-app/node_modules/nodemailer-mock/node_modules and my-app/node_modules/nodemailer-mock/npm-shrinkwrap.json
Then reinstalled my-app dependencies.
And everything is working fine.
However, we cannot maintain the hack. Please make sure the module is compatible with other apps.
Thanks.
@dlindahl - adding back 'use strict' for node 4
I installed and used this package. It works great but since it has developer-tools as a dependency, it wound up installing git hooks, and npm scripts as well as some .eslintrc, and other files. I didn't want the developer-tools package to install these files and settings. I imagine other's wouldn't want it either.
Is the developer-tools package needed? If so, can a note be added to the README to mention that it uses the package and to expect some files and settings to be installed? Or even an option to add/remove the package?
Thanks
Nodemailer conveniently provides a Promise wrapper for sendMail()
(see the note at the bottom of https://nodemailer.com/usage/, If callback argument is not set then the method returns a Promise object.
The mock sendMail()
only provides the callback-based interface, without the Promise wrapper.
Would you accept a PR to add the Promise wrapper, to have the same semantics as nodemailer's?
When trying to use nodemailer-mock
, I get this error:
Cannot set property 'mailer' of undefined
Repro:
npm init -y
yarn add nodemailer
yarn add nodemailer-mock --dev
index.js
:
const nodemailerMock = require('nodemailer-mock');
const transport = nodemailerMock.createTransport();
node index.js
Result:
/Users/alexzeitler/src/spikes/nodemailer-mock-spike/node_modules/nodemailer-mock/node_modules/nodemailer/lib/mailer/index.js:45
this.transporter.mailer = this;
^
TypeError: Cannot set property 'mailer' of undefined
at new Mail (/Users/alexzeitler/src/spikes/nodemailer-mock-spike/node_modules/nodemailer-mock/node_modules/nodemailer/lib/mailer/index.js:45:33)
at Object.module.exports.createTransport (/Users/alexzeitler/src/spikes/nodemailer-mock-spike/node_modules/nodemailer-mock/node_modules/nodemailer/lib/nodemailer.js:58:14)
at Object.createTransport (/Users/alexzeitler/src/spikes/nodemailer-mock-spike/node_modules/nodemailer-mock/nodemailer-mock.js:48:28)
at Object.<anonymous> (/Users/alexzeitler/src/spikes/nodemailer-mock-spike/index.js:2:34)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
Node.js version : 10.15.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.