Js-ipfs jest cannot stop node in test

Hello guys,

i work on personal project in node js for testing i use jest and i try that

const IPFSAdapter = require('../index')
const IPFS = require('ipfs')
const path = require('path')
const os = require('os')
const hat = require('hat')
const crypto = require('crypto')
const obj = { a: 1, _parentHash: null }
const password = 'mySecretTest'
const salt = 'MySalt'
const keyLength = 24

describe('simple test', () => {
  it('should be read and write', (done) => {
      IPFS.create({
        repo: path.join(os.tmpdir(), 'ipfs-repo-' + hat()),
        init: { bits: 512 },
        config: {
          Addresses: {
            Swarm: []
          }
        },
        preload: { enabled: false }
      }).then((node) => {
        node.start(() => {
          expect(true).toEqual(true);
          node.stop().then(() => {done()});
        });
      });      
  });
})

when i run jest i have this message

Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren’t stopped in your tests. Consider running Jest with --detectOpenHandles to troubleshoot this issue.

and Jest seems stuck

thx and regards

1 Like