TestServer

TestServer

TestServer

A real Vendure server against which the e2e tests should be run.

Signature

class TestServer {
  constructor(vendureConfig: Required<VendureConfig>)
  async init(options: TestServerOptions) => Promise<void>;
  async destroy() => ;
}

Members

constructor

method
type:
(vendureConfig: Required<VendureConfig>) => TestServer

init

async method
type:
(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.

destroy

async method
type:
() =>
Destroy the Vendure server instance and clean up all resources. Should be called after all tests have run, e.g. in an afterAll function.