snap-shot icon indicating copy to clipboard operation
snap-shot copied to clipboard

JSX in source file crashes `find-test-caller`

Open fatso83 opened this issue 7 years ago • 0 comments

I have tried following the steps outlined in various guides here, the main difference being that I am using Mocha and JSDOM instead of Jest. When running my tests I get the error Problem finding caller, which I debugged and traced to the function findTestCaller in the find-test-caller module.

After enabling debug output I got

  find-test-caller problem finding without transpiling /home/developer/dev/myproj/tests/mocha/client/unit/components/UserAccountInfo.test.js 87 +0ms
  find-test-caller Unexpected token (79:6) +1ms
  find-test-caller should transpile and search +1ms

Basically it advises me to transpile before searching, but I haven't seen any hints on doing this in the howtos I have seen. Any pointers? Of course, to run that test at all I already have transpiled the test inside Mocha (using babel-register).

This is the test code

  it('should render without regressions', function () {
    const renderer = ReactRenderer.create(
      <MuiThemeProvider muiTheme={muiTheme}>
        <UserAccountInfo {...createDefaultProps()}/>
      </MuiThemeProvider>
    );
    const json = renderer.toJSON();
    snapshot(json);
  });

fatso83 avatar May 18 '17 15:05 fatso83