Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle babel-node transcompilation #53

Open
jankoprowski opened this issue Jan 29, 2019 · 4 comments
Open

Handle babel-node transcompilation #53

jankoprowski opened this issue Jan 29, 2019 · 4 comments

Comments

@jankoprowski
Copy link

Hi,

My protractor configuration and tests use babel-node to transcompile from ES6 to ES5.
I'm starting them like babel-node node_modules/.bin/protractor protractor.conf.js
However protractor-retry can't handle this and returns

[15:29:17] E/configParser - protractor.conf.js:13
import {BaseConf} from '../protractor.base.conf.js';
^^^^^^

This is caused by ES6 transcompiled by babel used in protractor configuration.
Is it possible to handle such case in protractor-retry?

@amrot17
Copy link
Contributor

amrot17 commented Jan 29, 2019

HI @jankoprowski

try to add this to the top of your protractor config . this should solve the issue

require("babel-core/register")({
  presets: ["env"]
});

@dreuxl
Copy link
Contributor

dreuxl commented Jan 31, 2019

@jankoprowski did it help?

@jankoprowski
Copy link
Author

jankoprowski commented Jan 31, 2019

No it did not helped :(
I'm still getting:

[10:06:17] E/configParser - Error code: 105
[10:06:17] E/configParser - Error message: failed loading configuration file protractor.conf.js
[10:06:17] E/configParser - protractor.conf.js:13
import {BaseConf} from '../protractor.base.conf.js';
^^^^^^

SyntaxError: Unexpected token import

I have edited .babelrc to contain:

{
"presets": [
[
"env",
{
"targets": {
"esmodules": true
}
}
]
]
}

and

require("babel-core/register")({
presets: [["env", { "targets": { "esmodules": true } }]]
});

in protractor.conf.js

Now I'm getting:

import {BaseConf} from '../protractor.base.conf.js';
^

SyntaxError: Unexpected token {

@jankoprowski
Copy link
Author

We abandoned babel, rewrote our test imports to NodeJS 10 and now tests are retrying successfully.
However now protractor retries all tests in all files instead only failures. I do not know why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants