default export syntax not being handled properly in Jasmine tests only

I have a piece of code with these relevant lines:

import convertToObject from 'my-components/utils/convertToObject';

export function* generateMaestroSum(props) {
  console.log(convertToObject);
  const primaryOcc = convertToObject(props, 'primaryOCC');
  ....
}

my convertToObject method is part of a different library shared across applications. the utils folder has a convertToObject folder with two files, an index.js and convertToObject.js. convertToObject.js has the actual logic for this method:

convertToObject.js:

(assorted other methods...)

export default function convertToObject.js(component, field) {
   let object = component;

   if (field !== undefined) {
       object = getProp(component, field);
   }

   return convertComponent(object);
}

index.js:

export default from './convertToObject';

This works find when run directly. However, I’m having issues with my test files.

sagas.test.js:

const maestroTestData = require('./maestro.json');

describe('generator methods'), () => {
  describe('generate summation'), () => {
    const temp = generateMaestroSum(maestroTestData);

    console.log('never gets here: ${temp.next().value});

  });
});

I left in some print statements just to show what’s happening. This fails with the message:

TypeError: Object is not a function (evaluating '(0, _convertToObject2.default)(props, 'primaryOCC')')

the print statement I added as the first line of generateMaestroSum shows that normally it’s a method as expected, but when jasmine tests are running convertToObject is an object, specifically an object with a key ‘default’ and it’s value is the method I want.

It seems as if some aspect of phantomjs/karma is causing the default import not to function correctly, with it instead reading my index.js literally as a js object. I’m not sure why this would happen.

I’m using babel to shim for es6, which seems to be working in my karma tests elsewhere without issues.