lyquocnam / fastify-sequelize

Fastity plugin work with Sequelize (adapter for NodeJS -> Sqlite, Mysql, Mssql, Posgres)
23 stars 12 forks source link

Problems with fastify.close with fastify-sequelize #12

Closed mitry1974 closed 3 years ago

mitry1974 commented 3 years ago

Hello, I have strange problem with fastify-sequelize in tests - fastify.close throw an exception on app.close. And I have that problem only with fastify-sequelize. I made small test and put it on github - git@github.com:mitry1974/testFSP.git Can you help me - what is going wrong in that case?

const fastify = require('fastify'); const fastifySequelize = require('fastify-sequelize'); const config = require('../dbconfig');

let app;

beforeEach(async () => { try { app = fastify (); app.register(fastifySequelize, config); await app.ready(); } catch(e) { console.log('application start throw an error'); console.log(e); } });

afterEach(async () => { try{ await app.close(); } catch (e) { console.log('app.close throw an error'); console.log(e); } app = null; });

test('1', () => { expect(5).toBe(5); });

test('2', () => { expect(6).toBe(6); });