Vue-cli: Cyress e2e plugin generates _eslintrc.js instead of .eslintrc.js

Created on 2 Sep 2018  路  9Comments  路  Source: vuejs/vue-cli

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.

bug e2e-cypress

All 9 comments

Can't reproduce on Node 10.8.0/linux

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

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

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

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.

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 \.

https://github.com/vuejs/vue-cli/blob/5efbd1b632eac3eda2a0293c54dd06b068e7f0e4/packages/%40vue/cli/lib/GeneratorAPI.js#L170-L172

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

https://github.com/vuejs/vue-cli/blob/5efbd1b632eac3eda2a0293c54dd06b068e7f0e4/packages/%40vue/cli/lib/GeneratorAPI.js#L175

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?

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?

Sure :)

https://github.com/vuejs/vue-cli/pull/2427 here you go.
Added a file to the test cases as well.

Was this page helpful?
0 / 5 - 0 ratings