serverless-bundle icon indicating copy to clipboard operation
serverless-bundle copied to clipboard

VS Code "Unexpected token import"

Open serverlesspolska opened this issue 4 years ago • 3 comments

Hello,

Probably this is trivial but I don't know how to handle that.

When running npm test tests pass, however, jest plugin for VS Code fails with SyntaxError: Unexpected token import.

I think Orta's Jest plugin for VS Code can't figure out to use babel-jest.

What should I do to make it work?

serverlesspolska avatar Nov 09 '19 16:11 serverlesspolska

Hmmm I'm actually not sure about this. I don't have a lot of experience with VSCode. The npm test command internally runs serverless-bundle test. Do you know what the Jest plugin is doing?

jayair avatar Nov 17 '19 17:11 jayair

Make sure your test config as documented in serverles-bundle:

To run your tests using the same Babel config used in the plugin add the following to your package.json:

"scripts": { "test": "serverless-bundle test" }

softberry avatar Mar 15 '21 19:03 softberry

Hi @jayair this issue probably be closed.

softberry avatar Mar 15 '21 19:03 softberry