Testing with Jest requires `babel-preset-env`

This is my sum_two.test.js. It generates random numbers and tests them against sum_two function which should return sum of two numbers.

require('jasmine-check').install();
import sum_two from './sum_two'

describe('sum_two', () => {
	
	check.it('returns sum of two numbers', gen.number, gen.number, (x, y) => {
		
		expect(sum_two(x, y)).toEqual(x + y)
	})
});

In spite of meteor docs saying that ecmascript package bundles its own babel settings, I cannot run jest tests without 'babel-preset-env' in package.json and 'env' preset in .babelrc.
Jest throws SyntaxError: Unexpected token import.

When I install 'env' preset - everything’s fine.

What’s the catch? Should I open a bug report on Meteor issue trackrer?

1 Like