EC-Nordbund / denomailer

A SMTP-Client implementation for deno (to send mails!)
https://deno.land/x/denomailer
MIT License
50 stars 16 forks source link

denomailer broken since `1.42.2` deno release #86

Open MarcLoupias opened 2 months ago

MarcLoupias commented 2 months ago

Describe the bug

denomailer is broken since 1.42.2 deno release.

The denomailer e2e tests exec output this :

marco@marco-ubuntu:~/dev/open-source/denomailer$ deno test --unstable -A ./test/e2e/
⚠️  The `--unstable` flag is deprecated and will be removed in Deno 2.0. Use granular `--unstable-*` flags instead.
Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags
Check file:///home/marco/dev/open-source/denomailer/test/e2e/attachment.test.ts
Check file:///home/marco/dev/open-source/denomailer/test/e2e/basic.test.ts
error: TS2345 [ERROR]: Argument of type 'Conn<Addr>' is not assignable to parameter of type 'TcpConn'.
  Type 'Conn<Addr>' is missing the following properties from type 'TcpConn': setNoDelay, setKeepAlive
      const conn = await Deno.startTls(this.#connection.conn, {
                                       ~~~~~~~~~~~~~~~~~~~~~
    at file:///home/marco/dev/open-source/denomailer/client/basic/client.ts:339:40

To Reproduce

Set your deno version to 1.42.2 :

marco@marco-ubuntu:~/dev/open-source/denomailer$ deno upgrade --version 1.42.2
Downloading https://github.com/denoland/deno/releases/download/v1.42.2/deno-x86_64-unknown-linux-gnu.zip
Deno is upgrading to version 1.42.2
Archive:  /tmp/.tmp9PZqIv/deno.zip
  inflating: deno                    
Upgraded successfully
Release notes: https://github.com/denoland/deno/releases/tag/v1.42.2
Blog post: https://deno.com/blog/v1.42

Run the fake smtp server :

marco@marco-ubuntu:~/dev/open-source/denomailer$ docker run -d -p 1080:1080 -p 1025:1025 reachfive/fake-smtp-server
Unable to find image 'reachfive/fake-smtp-server:latest' locally
latest: Pulling from reachfive/fake-smtp-server
169185f82c45: Pull complete 
53e52a67e355: Pull complete 
fc2cb9a5e98e: Pull complete 
67e7f49d4884: Pull complete 
702661cf2202: Pull complete 
Digest: sha256:4b6d2f1e24481527de1429f88db18a377252a5e9e95bc083fa3d77e402cdadc8
Status: Downloaded newer image for reachfive/fake-smtp-server:latest
f43b730f5e89b24c1bae2e9f41ca6d569ed2200a04b5fa113335f717a0840120

Run the e2e tests :

marco@marco-ubuntu:~/dev/open-source/denomailer$ deno test --unstable -A ./test/e2e/
⚠️  The `--unstable` flag is deprecated and will be removed in Deno 2.0. Use granular `--unstable-*` flags instead.
Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags
Check file:///home/marco/dev/open-source/denomailer/test/e2e/attachment.test.ts
Check file:///home/marco/dev/open-source/denomailer/test/e2e/basic.test.ts
error: TS2345 [ERROR]: Argument of type 'Conn<Addr>' is not assignable to parameter of type 'TcpConn'.
  Type 'Conn<Addr>' is missing the following properties from type 'TcpConn': setNoDelay, setKeepAlive
      const conn = await Deno.startTls(this.#connection.conn, {
                                       ~~~~~~~~~~~~~~~~~~~~~
    at file:///home/marco/dev/open-source/denomailer/client/basic/client.ts:339:40

Expected behavior

Works as expected with deno 1.42.1.

Set deno to 1.42.1 :

marco@marco-ubuntu:~/dev/open-source/denomailer$ deno upgrade --version 1.42.1
Downloading https://github.com/denoland/deno/releases/download/v1.42.1/deno-x86_64-unknown-linux-gnu.zip
Deno is upgrading to version 1.42.1
Archive:  /tmp/.tmp1kqjid/deno.zip
  inflating: deno                    
Upgraded successfully
Release notes: https://github.com/denoland/deno/releases/tag/v1.42.1
Blog post: https://deno.com/blog/v1.42

Then run the tests assuming fake-smtp-server docker image is running on background :

marco@marco-ubuntu:~/dev/open-source/denomailer$ deno test --unstable -A ./test/e2e/
⚠️  The `--unstable` flag is deprecated and will be removed in Deno 2.0. Use granular `--unstable-*` flags instead.
Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags
Check file:///home/marco/dev/open-source/denomailer/test/e2e/attachment.test.ts
Check file:///home/marco/dev/open-source/denomailer/test/e2e/basic.test.ts
running 3 tests from ./test/e2e/attachment.test.ts
test text attachment ... ok (383ms)
test binary attachment ... ok (2s)
test more text attachment ... ok (611ms)
running 4 tests from ./test/e2e/basic.test.ts
test simplest mail ... ok (323ms)
test simplest mail with pool ...⚠️  The `Worker.deno.permissions` API was used with `--unstable` flag. The `--unstable` flag is deprecated and will be removed in Deno 2.0. Use granular `--unstable-worker-options` instead.
Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags

------- post-test output -------
started idle
----- post-test output end -----
test simplest mail with pool ... ok (2s)
test subject ... ok (2s)
test html ... ok (480ms)

ok | 7 passed | 0 failed (8s)

If this package is not maintained anymore it should be archived ;)

MarcLoupias commented 2 months ago

Added a PR, it is just a type check failing.