How to use jest-leak-detector - 3 common examples

To help you get started, we’ve selected a few jest-leak-detector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cesarenaldi / iniettore / packages / iniettore / src / __tests__ / memoryManagement.spec.js View on Github external
it('should remove any internal reference to the child context itself so that memory can be freed correctly', () => {
        class Foo {}
        const rootContext = iniettore.create(() => void 0)
        let childContext = rootContext.createChild(map => {
          map('foo')
            .to(Foo)
            .as(LAZY, SINGLETON, CONSTRUCTOR)
        })
        const detector = new LeakDetector(childContext)

        childContext.get('foo')
        childContext.dispose()
        childContext = null

        expect(detector.isLeaking()).toBe(false)
      })
    })
github cesarenaldi / iniettore / packages / iniettore / __tests__ / container.spec.js View on Github external
bar: singleton(() => {
            const instance = new Bar()
            detector = new LeakDetector(instance)
            return instance
          })
        }))
github cesarenaldi / iniettore / packages / iniettore / src / __tests__ / memoryManagement.spec.js View on Github external
.to(() => {
              const instance = new Foo()
              detector = new LeakDetector(instance)
              return instance
            })
            .as(TRANSIENT, SINGLETON, PROVIDER)

jest-leak-detector

Module for verifying whether an object has been garbage collected or not.

MIT
Latest version published 7 months ago

Package Health Score

93 / 100
Full package analysis

Popular jest-leak-detector functions

Similar packages