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

Cyress e2e plugin generates _eslintrc.js instead of .eslintrc.js #2424

Closed
dobromir-hristov opened this issue Sep 2, 2018 · 9 comments
Closed

Comments

@dobromir-hristov
Copy link

dobromir-hristov commented Sep 2, 2018

Version

3.0.1

Node and OS info

node v9.3.0 / npm 6.1.0 / Windows 10

Steps to reproduce

Start a new app with cli.
Select Cypress as e2e testing framework

What is expected?

installation finishes without errors

What is actually happening?

Lint rules are failing
https://gyazo.com/04e0ba22ffa2617e0d0e816623419ded


The _eslintrc.js file inside the templates folder of the cypress plugin is not being transformed to .eslintrc.js as per docs, so it just gets copied with the underscore in the name.

I can make a PR and rename it, but I am not sure that's the proper thing to do, as per the docs at least.

@dobromir-hristov dobromir-hristov changed the title Cyress e2e plugin generates _eslitrc.js instead of .eslintrc.js Cyress e2e plugin generates _eslintrc.js instead of .eslintrc.js Sep 2, 2018
@Akryum
Copy link
Member

Akryum commented Sep 2, 2018

Can't reproduce on Node 10.8.0/linux

@Akryum Akryum added scope: eslint scope: e2e-cypress needs team repro We acknowledged your report and will soon try to reproduce it labels Sep 2, 2018
@dobromir-hristov
Copy link
Author

I will do more tests later today. Going to make a custom local plugin to check if it's OS dependent or something.

@Akryum
Copy link
Member

Akryum commented Sep 2, 2018

Did you try with an more recent version? BTW, node 9.x shouldn't really be used, it's a development branch.

@dobromir-hristov
Copy link
Author

OK so I tried again, updated node, same results. However, when creating custom plugin, with a file with underscore as first char, I dont see the problem.

Versions:
Windows 10
node 10.9.0
npm 6.1.0
vue-cli 3.0.1

@dobromir-hristov
Copy link
Author

I played around with creating custom plugins, cloning the cli locally. What I gathered is this:

cli-plugin-whatever/generator/templates/_file.js gets rendered as .file.js top level in the project.
cli-plugin-whatever/generator/templates/tests/e2e/_file.js gets rendered as _file.js in tests/e2e inside the project.

This is both with custom plugins and augmenting the shipped cypress one.

Should I delve deeper into this? I will try tomorrow with a fresh Windows 10 install just in case.

@dobromir-hristov
Copy link
Author

dobromir-hristov commented Sep 3, 2018

I think I found the culprit. Globby returns paths with forward slash on Windows, i.e. tests/e2e/_eslintrc.js, but we are splitting the target path by the OS separator defined in path.sep, thus by \.

const _files = await globby(['**/*'], { cwd: source })
for (const rawPath of _files) {
const targetPath = rawPath.split(path.sep).map(filename => {

Top level files work fine, because they start with underscore, _super_duper_cypress.js, thus matching the first char works.

if (filename.charAt(0) === '_' && filename.charAt(1) !== '_') {

Should I test other globbing libs, to see if they return paths based on OS? Or we can safely assume that we can split by forward slash / because of globby's implementation and call it a day?

@LinusBorg
Copy link
Member

LinusBorg commented Sep 3, 2018

Thanks for diggign into this!

Or we can safely assume that we can split by forward slash / because of globby's implementation and call it a day?

I think we should do that. Can you send a PR?

@LinusBorg LinusBorg added bug and removed needs team repro We acknowledged your report and will soon try to reproduce it scope: eslint labels Sep 3, 2018
@dobromir-hristov
Copy link
Author

Sure :)

@dobromir-hristov
Copy link
Author

#2427 here you go.
Added a file to the test cases as well.

dobromir-hristov added a commit to dobromir-hristov/vue-cli that referenced this issue Sep 3, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
close vuejs#2424
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants