2

Using protractor and trying to switch to using es6 import instead of commonjs require approach

  • I changed package.json and added (in the top section) "type": "module"
  • I renamed my two app files from .js to .mjs
  • I changed my protractor conf.js to be conf.mjs
  • I changed my protractor conf file to use specs: ['spec.mjs'] as the test file to run
  • I changed my conf file extension from .js to .cjs
  • I changed the require to be import { httpGet } from './support'
  • I tried --experimental-modules but that gave an error with above setup

However when I run

protractor conf.mjs

I get

Must use import to load ES Module

Michael Durrant
  • 93,410
  • 97
  • 333
  • 497

0 Answers0