lundi 16 juillet 2018

Cannot create custom TestEnvironment in Jest

I am trying to create a custom test environment with Jest as described in their official docs
Unfortunately I get the following error:

Determining test suites to run...
FAIL acceptancetests/mongo.test.js
● Test suite failed to run

TypeError: TestEnvironment is not a constructor

at ../node_modules/jest-runner/build/run_test.js:88:25

My test is completely empty and my CustomTestEnvironment just calls the super classes. I am on the latest Jest version (24.3.1)

I think it is very weird, that the error is thrown within the Jest library.

This is my test-environment.js:

const NodeEnvironment = require('jest-environment-node');

class CustomEnvironment extends NodeEnvironment {
  constructor(config) {
    super(config);
  }

  async setup() {
    await super.setup();
  }

  async teardown() {
    await super.teardown();
  }

  runScript(script) {
    return super.runScript(script);
  }
}

Any help is appreciated!

Aucun commentaire:

Enregistrer un commentaire