Making Jest work with node modules are not es5

  1. Install these packages:
yarn install --dev @babel/core @babel/preset-env jest babel-jest
  1. Add babel.config.js (exactly babel.config.js, not .babelrc, not .babelrc.json etc):
module.exports = {
  presets: ["@babel/preset-env"],
};
  1. Add jest.config.js:
module.exports = {
  testEnvironment: "node",
  testRegex: "tests/.*\\.bs\\.js$", // optional, defines custom tests location
  transformIgnorePatterns: [
    "/node_modules/(?!bs-platform|ALL-BS-DEPS-THAT-APPEAR-IN-TESTS).+\\.bs\\.js$",
  ]
};
  1. Run jest and pray