protractor-perf icon indicating copy to clipboard operation
protractor-perf copied to clipboard

ConfigParser is not a constructor

Open afterbangx opened this issue 8 years ago • 10 comments

I just installed this library today and ran into a problem with Protractor 4.0.9. When I tried to run protractor-perf it was throwing the error

C:\**\npm\node_modules\protractor-perf\lib\cli.js:146
 var configParser = new ConfigParser();
               ^

 TypeError: ConfigParser is not a constructor 

I changed line 145 in cli.js from var ConfigParser = require('protractor/built/configParser').default; to var ConfigParser = require('protractor/built/configParser').ConfigParser;

It started running for me after I made this change. Should I have to do this to get it to work? Am I missing something else? Or is it just a breaking change with ptor 4+?

afterbangx avatar Oct 27 '16 15:10 afterbangx

@afterbangx Can you send in a PR with this ? @jahnavi310 also has this issue. @jahnavi310 are you aware of this change ?

axemclion avatar Oct 27 '16 16:10 axemclion

Sure thing. I'll send it in a bit.

afterbangx avatar Oct 27 '16 16:10 afterbangx

I am still getting this error . usr/local/lib/node_modules/protractor-perf/lib/cli.js:146 var configParser = new ConfigParser(); ^ TypeError: ConfigParser is not a constructor

protractor --version Version 4.0.11

protractor-perf --version Version 0.2.2

deepu105045 avatar Dec 02 '16 18:12 deepu105045

I see this error too.

PATH_TO_MY_PROJECT/node_modules/protractor-perf/lib/cli.js:146 var configParser = new ConfigParser(); ^ TypeError: ConfigParser is not a constructor

"protractor": "^4.0.13" "protractor-perf": "^0.2.2"

linwenting avatar Dec 16 '16 08:12 linwenting

Thanks for identifying the issue, this solved for me.

My versions are: "protractor": "^4.0.13", "protractor-perf": "^0.2.2"

@axemclion do you intend to add it to the new version? Is there any pending issue regarding this?

I thought about keeping compatibility with old versions:

var reqConfigParser = require('protractor/built/configParser');
var ConfigParser = reqConfigParser.default || reqConfigParser.ConfigParser;

Henrique.

henriquelbsouza avatar Dec 16 '16 16:12 henriquelbsouza

@henriquelbsouza I do want to add it to the new issue. Can you send in a PR and I can merge it in and publish a new version ?

axemclion avatar Dec 16 '16 17:12 axemclion

@axemclion sure, give me a moment.

henriquelbsouza avatar Dec 16 '16 18:12 henriquelbsouza

@axemclion this is created, I wasn't able to run npm test task, is this working as intended?

Just make sure that my changes didn't broke anything :P

Thanks for the fast answer by the way ;)

henriquelbsouza avatar Dec 16 '16 18:12 henriquelbsouza

@henriquelbsouza The npm tests require saucelabs credentials, so they only run on master unfortunately. I merged in the PR - thanks a lot for the work !!

axemclion avatar Dec 17 '16 03:12 axemclion

@axemclion @henriquelbsouza , I am trying to execute via grunt task and getting the below error. Warning: Cannot find module 'protractor/lib/configParser'. Any idea on this?

protractor: 5.1.1 protractor-perf: 0.2.3

raghulraj avatar Feb 20 '17 02:02 raghulraj