Frank
Frank

Reputation: 512

lowdb@3 and jest = Unexpected token 'export'

[email protected] does not seem to work with [email protected], I end up with the following error:

Unexpected token 'export'
({"Object.":function(module,exports,require,__dirname,__filename,jest){export * from './adapters/JSONFile.js';

Does anyone know how to fix it?

My sample index.test.ts code:

import { Low, JSONFile } from 'lowdb'
it('test file upload', async () => { 
  const adapter = new JSONFile("db.json")  
  const db = new Low(adapter)  
  console.log("Test:", db)  
})

I have tried the following babel.config.js:

module.exports = {
    presets: [
      ['@babel/preset-env', {targets: {node: 'current'}}],
      '@babel/preset-typescript',
    ],
  };

Upvotes: 1

Views: 263

Answers (0)

Related Questions