webdriverio / codemod

A codemod to transform Protractor into WebdriverIO tests
MIT License
25 stars 12 forks source link

Transformation error (Cannot read properties of undefined (reading 'map')) #75

Open vidyashv-carbon opened 1 year ago

vidyashv-carbon commented 1 year ago

We are trying to migrate protractor automation suits to webdriverio. we are seeing type error for transforming config.js using command npx jscodeshift -t ./node_modules/@wdio/codemod/protractor config/config.js

Error message : ERR config/config.js Transformation error (Cannot read properties of undefined (reading 'map'))exact error is Transformation error (Cannot read properties of undefined (reading 'map'))

From stacktrace : node_modules/@wdio/codemod/protractor/utils.js:297:61)

const suites = require('./suites').suites

I have installed codemod and wdio/cli using command

npm install jscodeshift @wdio/codemod

npm install --save-dev @wdio/cli

Attached config file

config.js.zip

christian-bromann commented 1 year ago

Thanks for reporting.

Can you provide the code section that causes this error to appear?

We would appreciate any help on this so please help us out! Have a look at our contributing guidelines and reach out if you have any questions. Cheers!

vidyashv-carbon commented 1 year ago

Here is the stack trace

image

ERR config/config.js Transformation error (Cannot read properties of undefined (reading 'map')) TypeError: Cannot read properties of undefined (reading 'map') at Function.map (/Users/xyz/Documents/towebdriverio/ui-test/node_modules/@wdio/codemod/protractor/utils.js:297:61) at Array.map () at NodePath. (/Users/xyz/Documents/towebdriverio/ui-test/node_modules/@wdio/codemod/protractor/index.js:85:34) at NodePath. (/Users/xyz/Documents/towebdriverio/ui-test/node_modules/jscodeshift/src/collections/Node.js:142:47) at /Users/xyz/Documents/towebdriverio/ui-test/node_modules/jscodeshift/src/Collection.js:75:36 at Array.forEach () at Collection.forEach (/Users/xyz/Documents/towebdriverio/ui-test/node_modules/jscodeshift/src/Collection.js:74:18) at Collection.replaceWith (/Users/xyz/Documents/towebdriverio/ibm-api-hub-ui-test/node_modules/jscodeshift/src/collections/Node.js:140:17) at Collection.replaceWith (/Users/xyz/Documents/towebdriverio/ui-test/node_modules/jscodeshift/src/Collection.js:413:43) at transformer (/Users/xyz/Documents/towebdriverio/ui-test/node_modules/@wdio/codemod/protractor/index.js:57:8)