Configure an Env with a Tester

The getTester method sets the Env to use a Tester implementation (for example, the Jest Aspect).

getTester(path: string, tester: any): Tester
CopiedCopy

For example:

// my-env.env.ts

import { TesterEnv } from '@teambit/envs';
import { JestMain } from '@teambit/jest';

export class MyEnv implements TesterEnv {
  constructor(
    // ...

    private jestAspect: JestMain
  ) {}

  // ...

  getTester(jestConfigPath: string, jestModule = jest): Tester {
    const jestConfig = require.resolve('./jest/jest.config');
    return this.jestAspect.createTester(jestConfig);
  }
}
CopiedCopy