I'm trying to set up a basic automated test in the browser against a react app, using webdriver and Jasmine. I'm using page object models to describe my app under test, like so:
Example page object from JasmineBDD
I'm running Jasmine fine, and slurping up the spec. However after the browser spawns, I get a module error
import { SplashScreen } from './page_models/splash_screen.page'
^^^^^^
SyntaxError: Cannot use import statement outside a module
I'm initiating the test with a local call to wdio, node node_modules/.bin/wdio ./spec/support/wdio.conf.js
. How do I run my Jasmine spec code in an environment so that it's inside a module context ?
Thanks :)
Turns out I needed to call babel/register
in my jasmine config like so:
beforeSession: function (config, capabilities, specs) {
require('@babel/register');
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With