Error running tests with Jest using mysql2 1.7.0
See original GitHub issueI get the following error after updating from mysql2@^1.6.5
to mysql2@^1.7.0
.
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.
at Object.getCodec (node_modules/mysql2/node_modules/iconv-lite/lib/index.js:65:27)
at Object.getDecoder (node_modules/mysql2/node_modules/iconv-lite/lib/index.js:127:23)
at Object.<anonymous>.exports.decode (node_modules/mysql2/lib/parsers/string.js:10:25)
at Packet.readNullTerminatedString (node_modules/mysql2/lib/packets/packet.js:384:25)
at Function.fromPacket (node_modules/mysql2/lib/packets/handshake.js:58:33)
C:\Users\siroc\repositories\sphinxql\node_modules\mysql2\node_modules\iconv-lite\lib\index.js:106
throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')");
^
Error: Encoding not recognized: 'cesu8' (searched as: 'cesu8')
at Object.getCodec (C:\Users\siroc\repositories\sphinxql\node_modules\mysql2\node_modules\iconv-lite\lib\index.js:106:23)
at Object.getDecoder (C:\Users\siroc\repositories\sphinxql\node_modules\mysql2\node_modules\iconv-lite\lib\index.js:127:23)
at Object.<anonymous>.exports.decode (C:\Users\siroc\repositories\sphinxql\node_modules\mysql2\lib\parsers\string.js:10:25)
at Packet.readNullTerminatedString (C:\Users\siroc\repositories\sphinxql\node_modules\mysql2\lib\packets\packet.js:384:25)
siroc\repositories\sphinxql\node_modules\mysql2\lib\packets\handshake.js:58:33)
at ClientHandshake.handshakeInit (C:\Users\siroc\repositories\sphinxql\node_modules\mysql2\lib\commands\client_handshake.js:92:40)
at ClientHandshake.execute (C:\Users\siroc\repositories\sphinxql\node_modules\mysql2\lib\commands\command.js:39:22)
at Connection.handlePacket (C:\Users\siroc\repositories\sphinxql\node_modules\mysql2\lib\connection.js:449:32)
at PacketParser.Connection.packetParser.p [as onPacket] (C:\Users\siroc\repositories\sphinxql\node_modules\mysql2\lib\connection.js:72:12)
at PacketParser.executeStart (C:\Users\siroc\repositories\sphinxql\node_modules\mysql2\lib\packet_parser.js:75:16)
If you want to see the project with all updated (except the mysql2 package) to replicate the problem use https://github.com/SiroDiaz/sphinxql. Note that it is under develop branch. Just try to update mysql2 to latest version(1.7.0), start Manticore search 3.1.0 and run jest tests.
Start Manticore search daemon:
cd __tests__
searchd --config sphinx.conf
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Error running tests with Jest using mysql2 1.7.0 - Bountysource
Note that it is under develop branch. Just try to update mysql2 to latest version(1.7. 0), start Manticore search 3.1. 0 and run...
Read more >node.js - Encoding not recognized in jest.js - Stack Overflow
I have a problem testing a project using node-mysql2, react, sequelize and jest. This problem only occurs during testing.
Read more >Configuring Jest
By default, Jest runs all tests and produces all errors into the console upon completion. The bail config option can be used here...
Read more >Installing kubeadm | Kubernetes
To run containers in Pods, Kubernetes uses a container runtime. ... For example, the kubelet running 1.7.0 should be fully compatible with a ......
Read more >How To Test a React App with Jest and React Testing Library
You will use Jest to write and run unit tests, and you will implement ... when testing the absence of an element without...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There’s two errors here. The second one:
This can be resolved using this code (
tests/setup.js
):Then wire it in using
jest.config.json
:Not working with native ESM (
type=module
).What’s going on?