import { pathExists, rm } from 'fs-extra';

let setupHappened = false;

export async function setup() {
  if (setupHappened) {
    throw new Error('setup called twice');
  }

  setupHappened = true;

  globalThis.__ENTRYPOINT__ = 'test';

  const e2eDistPath = './e2e/dist/';
  if (await pathExists(e2eDistPath)) {
    await rm(e2eDistPath, { recursive: true, force: true });
  }
}
