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

JS Static tests added to CI (ESLint + JSCS) #9093

Merged
merged 10 commits into from May 16, 2017

Conversation

Igloczek
Copy link
Contributor

@Igloczek Igloczek commented Apr 2, 2017

This PR is part of #9089.

I adjusted Travis config files to run gulp static task (ESLint + JSCS).
I changed default target of static task to file, b/c by previously all output was saved to XML files, that's not so useful on daily basics.

Test are not green, b/c of reported JS issues.

PS. Upgrading dependencies (#9062) will increase number of reported issues 😉

@@ -0,0 +1,18 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, convert jscs config to json too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -17,7 +17,7 @@ module.exports = function (grunt) {
};

grunt.registerTask('static', function (target) {
var currentTarget = target || 'test',
var currentTarget = target || 'file',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we use grunt static to run all test with generating log file and grunt static:file --file=<path_to_file> for single file validation. What reason to switch this?

Copy link
Contributor Author

@Igloczek Igloczek Apr 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UX. Dev should be able to quickly run grunt static to get some instant, readable feedback, without trying to find undocumented tasks options.

If you need to generate this XML files for some reason, run gulp static:test instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, make sense. But change, please, in dev/travis/script.sh grunt static to grunt static:test.

Copy link
Contributor Author

@Igloczek Igloczek May 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But... the whole point is to not use test on CI, b/c output is saved only as JUnit XML file, which isn't available, b/c build artifacts are not saved anywhere (even if they will be publicly available, it's way more complicated way than just read the tests output).

Also, quiet option do more harm than good, b/c ignore all warnings.

Results of gulp static:test

Running "eslint:test" (eslint) task
Warning: Task "eslint:test" failed. Used --force, continuing.

Results of gulp static aka. gulp static:file

Running "eslint:file" (eslint) task
/Users/igloczek/Sites/magento2-dev/lib/web/mage/accordion.js
  7:9  error  Parsing error: Unexpected token 'jquery'

✖ 1 problem (1 error, 0 warnings)

Warning: Task "eslint:file" failed. Used --force, continuing.

@@ -26,7 +26,11 @@ module.exports = function (grunt) {

setConfig('eslint', currentTarget, cvf.getFiles(file));
setConfig('jscs', currentTarget, cvf.getFiles(file));
grunt.option('force', true);

if (grunt.option('force') !== false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, revert this changes, we already solve this issue. We add grunt-continue, that provide ability to run in force mode(for collect eslint and jscs errors) and fail on warnings. Internal ticket MAGETWO-67342 now in delivery process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

static)
TEST_FILTER='--filter "Magento\\Test\\Php\\LiveCodeTest"' || true
phpunit -c dev/tests/$TEST_SUITE $TEST_FILTER
grunt static --force=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove --force.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@ishakhsuvarov
Copy link
Contributor

Hi @Igloczek
I see some review comments unresolved, are you going to continue with this one?
Thanks!

@Igloczek
Copy link
Contributor Author

@ishakhsuvarov I'm just busy as f... Let's keep it open, I'll finish this ASAP.

@ishakhsuvarov
Copy link
Contributor

@Igloczek Sure. No rush, just trying to make sure we are on the same page.

@okorshenko okorshenko modified the milestones: April 2017, May 2017 May 9, 2017
@ishakhsuvarov ishakhsuvarov changed the title JS Static tests added to CI (ESLint + JSCS) JS Static tests added to CI ESLint JSCS May 12, 2017
@ishakhsuvarov ishakhsuvarov changed the title JS Static tests added to CI ESLint JSCS JS Static tests added to CI (ESLint + JSCS) May 12, 2017
@magento-team magento-team merged commit 969e324 into magento:develop May 16, 2017
@magento-team
Copy link
Contributor

@Igloczek Thank you for the contribution

@Igloczek Igloczek deleted the fix-eslint-grunt-task branch May 28, 2017 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants