如何在不使用 Jest 测试运行器的情况下使用 Jest 的断言库?

How to use Jest's assertion library without using the Jest test runner?

Jest creates this global called expect。我如何使用 而不 使用他们的测试运行器?即,我必须 import/require?

该模块简称为expect

例如

import expect from 'expect'

expect(1 + 1).toBe(2)

您可以在Jest lerna repo and the individual package on npm

中看到它