TestServer
TestServer
A real Vendure server against which the e2e tests should be run.
Signature
class TestServer {
public public app: INestApplication;
constructor(vendureConfig: Required<VendureConfig>)
async init(options: TestServerOptions) => Promise<void>;
async bootstrap() => ;
async destroy() => ;
}
Members
app
INestApplication
constructor
(vendureConfig: Required<VendureConfig>) => TestServer
init
(options: TestServerOptions) => Promise<void>
Bootstraps an instance of Vendure server and populates the database according to the options
passed in. Should be called in the beforeAll
function.
The populated data is saved into an .sqlite file for each test file. On subsequent runs, this file is loaded so that the populate step can be skipped, which speeds up the tests significantly.
bootstrap
() =>
.init()
method should be used, as that will also
populate the test data. However, the bootstrap()
method is sometimes useful in tests which need to
start and stop a Vendure instance multiple times without re-populating data.
destroy
() =>
afterAll
function.