webdriverio-boneyard / wdio-cucumber-framework

A WebdriverIO v4 plugin. Adapter for Cucumber testing framework.
MIT License
77 stars 61 forks source link

Loading module using an alias path #122

Closed musab closed 6 years ago

musab commented 6 years ago

In my webpack.config.js I have the following alias path defined:

  resolve: {
    ...
    alias: {
      __features__: path.resolve(__dirname, 'src/__features__/')
    }
  },

In my steps directory, each step file I import the .page. files as:

import { CreateAnalysisPage } from '__features__/model/pages/createAnalysis.page'
import { LoginPage } from '__features__/model/pages/login.page'

Which work with no linting errors (ie: module not found)

But when running my tests I receive the following errors:

ERROR: Cannot find module '__features__/model/pages/analysesList.page'
chrome
    at Function.Module._resolveFilename (module.js:542:15)
    at Module._load (module.js:472:25)
    at Function.hookedLoader [as _load] (/node_modules/mockery/mockery.js:111:12)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/src/__features__/steps/analysesListSteps.ts:1:1)
    at Module._compile (module.js:641:30)
    at Module.m._compile (/node_modules/ts-node/src/index.ts:400:23)
    at Module._extensions..js (module.js:652:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/node_modules/ts-node/src/index.ts:403:12)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Module._load (module.js:495:3)
    at Function.hookedLoader [as _load] (/node_modules/mockery/mockery.js:111:12)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)

Am I missing something on my separate wdio config maybe to resolve these paths?

christian-bromann commented 6 years ago

Not sure how this is related to WebdriverIO. If you want to use next gen javascript follow this guide. Also, join our Gitter if you have more questions.