You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using jest, and trying to test login, but apparently, it also need to establish sequelize MySQL connection.
It's about Encoding not recognized: 'cesu8' (searched as: 'cesu8')",
I've searched some "solutions", but none of them work. 1, 2
In case, of trying this solution require('mysql2/node_modules/iconv-lite').encodingExists('foo'); , I don't know what to put in "foo" ? If I put "cesu8", it's not supported, because truly there's nothing in that node folder , I checked, that would support. It's just utf16 , utf32 ,etc...
Please help, without this, I'm completely unable to test anything in my app
Error after running npx jest
Attempted to log "ErrorSequelizeConnectionError: Encoding not recognized: 'cesu8' (searched as: 'cesu8')".
23 |
24 |
> 25 |
| ^
26 |
27 |
28 | sequelize.authenticate()
at console.log (node_modules/@jest/console/build/CustomConsole.js:141:10)
at models/database.js:25:11
C:\Users\Igor\Downloads\Randolympics_backend\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:102
throw new SequelizeErrors.ConnectionError(err);
^
ConnectionError [SequelizeConnectionError]: Encoding not recognized: 'cesu8' (searched as: 'cesu8')
at ConnectionManager.connect (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\sequelize\src\dialects\mysql\connection-manager.js:126:17)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at ConnectionManager._connect (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\sequelize\src\dialects\abstract\connection-manager.js:332:24)
at C:\Users\Igor\Downloads\Randolympics_backend\node_modules\sequelize\src\dialects\abstract\connection-manager.js:250:32 {
parent: Error: Encoding not recognized: 'cesu8' (searched as: 'cesu8')
at Object.getCodec (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\node_modules\iconv-lite\lib\index.js:104:23)
at Object.getDecoder (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\node_modules\iconv-lite\lib\index.js:125:23)
at Object.<anonymous>.exports.decode (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\parsers\string.js:20:23)
at Packet.readNullTerminatedString (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\packets\packet.js:412:25)
at Function.fromPacket (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\packets\handshake.js:62:33)
at ClientHandshake.handshakeInit (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\commands\client_handshake.js:112:40)
at ClientHandshake.execute (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\commands\command.js:45:22) at Connection.handlePacket (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\connection.js:481:34)
at PacketParser.onPacket (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\connection.js:97:12)
at PacketParser.executeStart (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket.<anonymous> (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\connection.js:104:25)
at Socket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Socket.Readable.push (node:internal/streams/readable:390:5)
at TCP.onStreamRead (node:internal/stream_base_commons:191:23) {
fatal: true
},
original: Error: Encoding not recognized: 'cesu8' (searched as: 'cesu8')
at Object.getCodec (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\node_modules\iconv-lite\lib\index.js:104:23)
at Object.getDecoder (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\node_modules\iconv-lite\lib\index.js:125:23)
at Object.<anonymous>.exports.decode (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\parsers\string.js:20:23)
at Packet.readNullTerminatedString (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\packets\packet.js:412:25)
at Function.fromPacket (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\packets\handshake.js:62:33)
at ClientHandshake.handshakeInit (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\commands\client_handshake.js:112:40)
at ClientHandshake.execute (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\commands\command.js:45:22) at Connection.handlePacket (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\connection.js:481:34)
at PacketParser.onPacket (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\connection.js:97:12)
at PacketParser.executeStart (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\packet_parser.js:75:16)
at Socket.<anonymous> (C:\Users\Igor\Downloads\Randolympics_backend\node_modules\mysql2\lib\connection.js:104:25)
at Socket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Socket.Readable.push (node:internal/streams/readable:390:5)
at TCP.onStreamRead (node:internal/stream_base_commons:191:23) {
fatal: true
}
}
Node.js v20.16.0
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using jest, and trying to test login, but apparently, it also need to establish sequelize MySQL connection.
It's about Encoding not recognized: 'cesu8' (searched as: 'cesu8')",
I've searched some "solutions", but none of them work.
1, 2
In case, of trying this solution
require('mysql2/node_modules/iconv-lite').encodingExists('foo');
, I don't know what to put in "foo" ? If I put "cesu8", it's not supported, because truly there's nothing in that node folder , I checked, that would support. It's just utf16 , utf32 ,etc...Neither this
Please help, without this, I'm completely unable to test anything in my app
Error after running
npx jest
__tests__/account.test.js
models/database.js
Beta Was this translation helpful? Give feedback.
All reactions