vscode-jest icon indicating copy to clipboard operation
vscode-jest copied to clipboard

Spread operator breaks inline errors

Open nfour opened this issue 8 years ago • 3 comments

This test updates the comment string each time:

  it('tests jest', () => {
    expect(33).toBe(new Date().getTime()); // Expected value to be (using ===): 1482978207691 Recieved: 33
  });

This test doesn't show it at all or doesn't update it after a ES7 spread operator is added.

  it('tests jest', () => {
    const test = { ...{} };
    expect(33).toBe(new Date().getTime());
  });

In the dev console it errors with:

workbench.main.js:132 Unexpected token (8:19): SyntaxError: Unexpected token (8:19)
    at Parser.pp$5.raise (/home/sam/.vscode/extensions/Orta.vscode-jest-2.0.3/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:4246:13)

Weird. I have JS validation enabled in vscode & am using v1.8.1.

Im guessing the plugin doesn't inherit the projects babel config?

nfour avatar Dec 29 '16 02:12 nfour

It should be - we pull the nearest babelrc and use that

orta avatar Dec 29 '16 15:12 orta

My babelrc uses stage-1 and my source code uses spreads fine so that's interesting. It may be being overwritten with a different babel instance or perhaps the plugins are being included from the wrong location (dependency mismatches)?

This is kinda odd:

    const configFilePath = path.join(directory, BABELRC_FILENAME);

It's referencing a static filename? What if you have .babelrc.json .babelrc.yml. I use .babelrc so this doesn't apply but that looks a bit weak.

I'll have to see whether it is indeed finding it.

nfour avatar Dec 30 '16 22:12 nfour

This issue has been inactive for over a year and has been marked as stale. It will be automatically closed in 30 days if no further activity occurs. Since significant changes have occurred in the codebase, please open a new issue with updated details if the problem still persists.

github-actions[bot] avatar Apr 10 '25 03:04 github-actions[bot]