Commit Graph

26 Commits

Author SHA1 Message Date
Tatiana Ovchinnikova b532943a31 Update devDependencies in package.json
This patch updates outdated JavaScript dev dependencies.

The latest Jasmine version makes nested beforeEach and unhandled
promise rejection fail, this was fixed.

Also, the latest Jasmine version runs tests in random order by default,
random is set to false for now to prevent tests failures.

Finally, the latest Jasmine version supports a new configuration option
failSpecWithNoExpectations. By default, this option is set to false and
Jasmine reports specs that have no expectations as passed. Setting this
option to true tells Jasmine to report specs without as expectations as
failed. For now, it is set to false for openstack-dashboard tests, this
should be changed in future.

Change-Id: I04d5c3ce7f7e0a9a38251e975b68bfa1998e556f
2020-12-17 12:21:31 -06:00
Tatiana Ovchinnikova 807a33e1c8 Update ESLint devDependencies in package.json
This patch updates outdated JavaScript dev dependencies.

The latest ESLint version adds rules changes. Some rules are disabled
to prevent checks failures, some minor issues are fixed.

Change-Id: I01c5ccb5c8f7ceb827a3978157b4d76805d259c1
2020-12-16 12:20:10 -06:00
Ivan Kolodyazhny 6f0200032d Update lower constraints and change browser to Firefox to unblock gate
Pip 20.x requires ensure_str method from six which was introduced
in v.1.12.0 and wrapt v.1.11 is required by astroid v.2.4.0 with
the pylint dependency. So this patch update six and wrapt version
in lower-constraints.txt to fix the gate.

It also updates the browser to Firefox in karma.conf.js and adds
'karma-firefox-launchers' in package.json because nodejs-job
fail with chromium-browser due to not able to access some URL.
It also removes 'karma-chrome-launcher' enteries from all files
as it is no longer used.  So let's switch to Firefox browser to
unblock the gate then we can investigate later how to fix it with
chromium-browser.

Depends-On: https://review.opendev.org/c/zuul/zuul-jobs/+/766744

Co-Authored-By: Vishal Manchanda <manchandavishal143@gmail.com>
Change-Id: I13e68d89f55407b1b3c64219969912700feef500
2020-12-14 13:31:45 +00:00
Rob Cresswell 36d1d1ac68 Refactor tox & update docs
- Updated tox envlist, so just running `tox` from the CLI will now run all
voting gate tests

- Reduce duplicated definitions and commands

- Remove any reliance on run_tests within tox

- Removes all doc references to run_tests.sh, and replaces them
with their tox equivalent. Where necessary, language around the tox
commands has been altered or extended so that it makes sense and is
consistent with other parts of the docs. Also adds a new "Test Environment"
list to the docs, so that newcomers do not have to piece together CLI
commands and their cryptic extensions from tox.ini

- Move the inline shell scripting to its own file. Also fixes a bug when
passing args, since the logic assumed you were attempting a subset test
run (try `tox -e py27 -- --pdb` on master to compare)

- Moved translation tooling from run_tests to manage.py, w/ help text
and arg restrictions. This is much more flexible so that plugins can use
it without having to copy commands, but still defaults to exactly the
same parameters/behaviour from run_tests. Docs updated appropriately.

- Removed npm/karma strange reliance on either .venv or tox/py27. Now
it only uses tox/npm.

Change-Id: I883f885bd424955d39ddcfde5ba396a88cfc041e
Implements: blueprint enhance-tox
Closes-Bug: 1638672
2016-11-30 20:38:59 +00:00
Rob Cresswell abf4ca6968 Update devDependencies in package.json
Change-Id: I76f3d24e9c2d449202376c4a68781747ea67ef9f
2016-08-01 08:24:10 +01:00
Matt Borland bf4f7e8b25 Updating package.json / npm packages
Updates to newer versions.  We should test this and release it early in the
Newton cycle.

Change-Id: Ia1f0c414c75d9a2bf860da7cdf85886b54d401f4
Closes-Bug: 1582912
2016-05-31 10:34:38 +00:00
Jenkins cb0abbd553 Merge "Upgraded eslint-config-openstack to 1.2.4" 2016-05-10 21:42:37 +00:00
Jenkins e949063c67 Merge "Update JS dev dependencies" 2016-04-15 14:41:36 +00:00
Michael Krotscheck a4d58e7101
Upgraded eslint-config-openstack to 1.2.4
This patch upgrades eslint to version 1.2.4, incorporating new rule
changes on no-undefined, brace-style, quote-props, space-in-parens,
no-use-before-define, no-uneeded-ternary, and quote.

For now, rules that have been activated that cause checks to fail
have been switched to warning-only. Additionally, rules that
have been entirely disabled have been removed.

Change-Id: Ifba7a19da669288cb19cfc8055bdfa7b94f00292
2016-04-13 05:13:59 -07:00
Jenkins 4176613bed Merge "bump eslint version to 1.10.3" 2016-04-13 10:56:29 +00:00
Rob Cresswell 8da92fb400 Update JS dev dependencies
A lot of the JavaScript dev dependencies are quite outdated. This patch
updates them.

Closes-Bug: 1569783
Change-Id: I8b47e573a3a3160c824e21f6865b5e9af32c8d64
2016-04-13 10:32:33 +01:00
Rob Cresswell dbd4731048 Use Chrome for JS unit tests
PhantomJS has setup issues and is slowing down the gate with false
failures. We should change to Chrome until Phantom is more
reliable, at which point this patch can be reverted.

Change-Id: I4bf1c1e8e26ac708bd35145aff98562f30b3a050
Closes-Bug: 1568325
2016-04-12 15:19:56 +00:00
Itxaka 9697a9f580 bump eslint version to 1.10.3
bumps the eslint version to 1.10.3 which fixes a lot of
issues, especially rules not working as expected
or being ignored and brings the js code up to date to
comply with those rules.

Change-Id: I1234e7991f98d4ceb0c5333dc036c6a30206ff64
2016-03-31 14:06:45 +00:00
Thai Tran 8123d9ce34 Running eslint in quiet mode with color
We have a ton of warnings. This makes it difficult to locate linting errors.
This patch adds an npm script for developers to run eslint in quiet mode
with color.

Change-Id: Ie1ecc201d025c428d15b310b78e9c343a341aed3
Closes-Bug: #1546736
2016-02-17 12:18:30 -08:00
Rajat Vig 846413c149 Update eslint-plugin-angular to the latest
eslint-plugin-angular in use by the project is
quite old and the new library has changed rules.
This patch updates the library and fixes the code
where rule names have changed.

Change-Id: I2e60a07b899325f17f38b96d40325602b4b58219
Closes-Bug: #1527417
2016-01-11 10:42:06 -08:00
Michael Krotscheck bfa5c71de3 Upgraded eslint-config-openstack to 1.2.3
This updates eslint-config-openstack to 1.2.3, and downgrades the
new rules so we can tackle them one at a time.

Change-Id: I3d7a20a6141a8748a60ceefcd33a1310456302dd
2015-11-16 18:04:12 -08:00
Michael Krotscheck d7ef2b34bf Upgraded eslint rule libraries.
The newer version of eslint comes with somewhat stricter rules
about indentation and whitespace, so some files have been
adjusted to accomodate.

The newer version of eslint-config-openstack includes a relaxed
version requirement for eslint, as well as a switch/case
indentation update.

The newer version of the angular eslint rules includes a
deprecation rule for $cookieStorage, which has been set to
warning.

Change-Id: Id201a42e3ab484222f938a541507df2e96da2dcf
Partially-Implements: blueprint jscs-cleanup
2015-10-16 06:34:25 -07:00
Rajat Vig 40899b8481 ESLint glob pattern not matching files for lint
The file glob pattern in package.json

*/static openstack_dashboard/dashboards/*/static

has been changed to openstack_dashboard/static and
horizon/static as only then does it run lint on the
openstack_dashboard folder.

Fixed issues in files in openstack_dashboard that
have unaddressed warnings.

Change-Id: I1ae1346281f028821afae159d471e3e87b2d8d6d
Closes-Bug: #1490704
2015-09-01 06:04:16 +00:00
Rajat Vig a35ebf799d Run ESLint on Javascript files in dashboards
Recently, some Javascript files changed locations from
"openstack_dashboard/static"

to
"openstack_dashboard/dashboards/identity/static"
and
"openstack_dashboard/dashboards/project/static"

This changes the lint task to add these directories

Change-Id: I6ceeaacd1c4e1774b7279c5cc2610a583db58b5d
Closes-Bug: #1485885
2015-08-28 16:57:32 +00:00
Michael Krotscheck c50acff6d8 Added karma threshold reporting & failure
This patch adds unit test coverage threshold reporting, adding
statement, branch, function, and line coverage to the console
output in infra, and failing the build if the threshold has not
been met.

The threshold values have been set to the current observed
coverage values - future patches should update this up as
coverage improves.

Closes-Bug: 1487109
Change-Id: Ie83ebf5d976b3538e3528787b05de3e83df18af8
2015-08-20 17:07:08 +01:00
Michael Krotscheck 066780fd43 Use eslint-config-openstack
Instead of explicitly copying all the linting rules between projects,
openstack now publishes a set of rules (much like hacking) that can
be included in projects that want to adhere by our standards. This
patch switches horizon to use this set of rules.

Note: The rules in eslint-config-openstack are a verbatim copy
of what's currently in use in Horizon. Future versions will likely start
activating rules flagged as "TODO", however you can avoid build
instability by avoiding the use of fuzzy version matching in
package.json (which this patch does).

Change-Id: Ib93e0def096999ece7f636d028e3b1ecd4a4facc
2015-07-15 13:36:55 -07:00
Michael Krotscheck c6c0352982 Switched from JSCS to ESLint
This patch switches horizon from using JSCS to using ESlint. It
adds the john papa style guides as an eslint plugin, and deactivates
additional linting rules so current cleanup efforts can focus on the
issues remaining from JSCS. Once that cleanup effort is complete,
we can switch our linting job to voting and move forward from there.

YAML for .eslintrc was chosen because the JSON specification does
not allow comments, and having comments (including rule links) will
make it easier to discuss linting changes.

Deactivated eslint rules have each been annotated with a # TODO
statement, so we can address them in the future. Links in the
documentation have been updated to new contributor guidelines, which
will be updated after this patch lands.

Linting may be executed by first installing npm dependencies using
`npm install`, and then executing `npm run lint` at any time in the
future. No python venv is required.

For clarification: We are switching to ESLint because JSCS explicitly
focuses on code-style, not on language use errors. For that purpose,
JSCS explicitly defers to JSHint, which due to the 'do no evil' license is
not usable. Since ESLint provides both the codestyle functionality, and
the language use checks, of both JSCS and JSHint, it was deemed the
only viable tool,

http://lists.openstack.org/pipermail/openstack-dev/2015-June/067030.html

Change-Id: Ib4c3f77f8cc3cdaa3c7558b7bc3a6d1299b6dcbe
Partially-Implements: blueprint jscs-cleanup
2015-06-30 23:00:29 -07:00
Michael Krotscheck 1cc79a0b19 Added `npm run lint` command to execute JSCS
This patch adds jscs as an npm dependency, and executes it within
the npm venv. It can be used to trigger the infra npm-run-lint job
and thus get voting javascript code linting into infra.

Change-Id: I2c92a7596a8faee28de582493bdf72425deac8cc
2015-06-05 19:59:30 -07:00
Michael Krotscheck 76ea1f1837 Trigger tox from package.json, if necessary.
This patch adds several fixes to improve karma test handling.

* A postinstall hook was added to package.json, which tests for
  the existence of .venv. If it is not found, it will invoke
  tox -e py27 --notest.
* Both karma.conf files were taught to automatically detect the
  directories in which the xstatic dependencies might live, and
  pick the appropriate directory.

postinstall was chosen, because setting up a virtual environment
is likely to be useful for more than one type of npm job.

Change-Id: I822cb020bd8b2ca8d4f994b9734af5636e4bd144
2015-06-05 08:16:22 -07:00
Michael Krotscheck 4ffd55c7c9 Added karma-cli to package.json
Turns out that npm runs a little like venv's do, in that it can
install executables in its own path. This adds the karma-cli
executable into the npm path, and removes additional extraneous
content from the package.json file.

Change-Id: Ib25553956a9757ecbb1ee7ce722f3646ededc035
2015-06-05 08:16:22 -07:00
Matt Borland 241c2cf432 Get unit tests working with Karma
Establish features for running Karma tests.  Separate karma configurations
are used due to current overlap of template file structure.

You can run the karma tests via:
  ./run_tests.sh --karma

The Karma framework allows for many features like unit test coverage and
provides a common configuration for different test runners.

Change-Id: I79680ef6369383c148da68e6677945886a48df81
Implements: blueprint karma
2015-06-01 14:14:58 +00:00