diff --git a/CHANGELOG.md b/CHANGELOG.md index d027078c66..c0b6effb7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * [\#1436](https://github.com/cosmos/voyager/issues/1436) governance endpoints and vuex module @fedekunze * [\#1482](https://github.com/cosmos/voyager/issues/1482) Added ESLint errors: no-var. @sgobotta * [\#1449](https://github.com/cosmos/voyager/issues/1449) shortNumber to num scripts for more readable numbers. @jbibla +* [\#1509](https://github.com/cosmos/voyager/issues/1509) fail tests on console.error and console.warn and fix related bugs. Plus added a way to simply opt out of failing tests on console usage. @faboweb * [\#1464](https://github.com/cosmos/voyager/issues/1464) Added governance transactions to tx history page @fedekunze * [\1401](https://github.com/cosmos/voyager/issues/1401) Display governance proposals index. @fedekunze * [\#1472](https://github.com/cosmos/voyager/issues/1472) Added mock functionality for redelegation @fedekunze + @faboweb diff --git a/README.md b/README.md index e79e778250..9bbbac180c 100644 --- a/README.md +++ b/README.md @@ -226,19 +226,20 @@ Import the account with the 12 word seed phrase you wrote down earlier. A list of all environment variables and their purpose: -| Variable | Values | default | Purpose | -| ----------------------- | ---------------------------------------- | -------------------------------- | -------------------------------------------------------------------------------------------- | -| NODE_ENV | 'production', 'development' | | | -| LOGGING | 'true', 'false' | 'true' | Disable logging | -| COSMOS_NETWORK | {path to network configuration folder} | '../networks/gaia-7001' | Network to connect to | -| COSMOS_HOME | {path to config persistence folder} | '$HOME/.cosmos-voyager[-dev]' | | -| LCD_URL | {URL of a Cosmos light client interface} | see 'app/config.toml' | Cosmos Light Client interface to connect to | -| RPC_URL | {URL of a Tendermint rpc interface} | see 'app/config.toml' | Tendermint node to connect to | -| COSMOS_DEVTOOLS | 'true', 'false' | 'false' | Open the debug panel in the electron view | -| ELECTRON_ENABLE_LOGGING | 'true', 'false' | 'false' | Redirect the browser view console output to the console | -| PREVIEW | 'true', 'false' | 'true' if NODE_ENV 'development' | Show/Hide features that are in development | -| COSMOS_E2E_KEEP_OPEN | 'true', 'false' | 'false' | Keep the Window open in local E2E test to see the state in which the application broke. | -| CI | 'true', 'false' | 'false' | Adds better structured output, makes a screenshot and adds logs to files (used on CircleCI). | +| Variable | Values | default | Purpose | +| ----------------------- | ---------------------------------------- | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| NODE_ENV | 'production', 'development' | | | +| LOGGING | 'true', 'false' | 'true' | Disable logging | +| COSMOS_NETWORK | {path to network configuration folder} | '../networks/gaia-7001' | Network to connect to | +| COSMOS_HOME | {path to config persistence folder} | '$HOME/.cosmos-voyager[-dev]' | | +| LCD_URL | {URL of a Cosmos light client interface} | see 'app/config.toml' | Cosmos Light Client interface to connect to | +| RPC_URL | {URL of a Tendermint rpc interface} | see 'app/config.toml' | Tendermint node to connect to | +| COSMOS_DEVTOOLS | 'true', 'false' | 'false' | Open the debug panel in the electron view | +| ELECTRON_ENABLE_LOGGING | 'true', 'false' | 'false' | Redirect the browser view console output to the console | +| PREVIEW | 'true', 'false' | 'true' if NODE_ENV 'development' | Show/Hide features that are in development | +| COSMOS_E2E_KEEP_OPEN | 'true', 'false' | 'false' | Keep the Window open in local E2E test to see the state in which the application broke. | +| CI | 'true', 'false' | 'false' | Adds better structured output, makes a screenshot and adds logs to files (used on CircleCI). | +| ALLOW_CONSOLE | 'true', 'false' | 'false' | Unit tests fail if they use console.error or console.warn. To see the initial use/occurences of those callings, you can escape this behavior using this flag. | ## FAQ diff --git a/app/src/renderer/components/staking/LiValidator.vue b/app/src/renderer/components/staking/LiValidator.vue index 2049306c3a..c10d1248a6 100644 --- a/app/src/renderer/components/staking/LiValidator.vue +++ b/app/src/renderer/components/staking/LiValidator.vue @@ -5,7 +5,7 @@ tr.li-validator img.li-validator__avatar.no-img(v-else src="~assets/images/validator-icon.svg" width="48" height="48") .li-validator__name-container span.validator-profile__status(v-bind:class="statusColor" v-tooltip.top="status") - router-link.li-validator__moniker(:to="{ name: 'validator', params: { validator: validator.id }}", :class='styles') {{ validator.description.moniker }} + router-link.li-validator__moniker(:to="{ name: 'validator', params: { validator: validator.operator_address }}", :class='styles') {{ validator.description.moniker }} short-bech32.li-validator__address(:address="validator.operator_address") td.li-validator__delegated-steak {{ yourVotes.isLessThan(0.01) && yourVotes.isGreaterThan(0) ? '< ' + num.shortNumber(0.01) : num.shortNumber(yourVotes) }} td.li-validator__rewards n/a @@ -142,5 +142,4 @@ export default { .li-validator__address .address font-size sm - diff --git a/app/src/renderer/components/staking/TableValidators.vue b/app/src/renderer/components/staking/TableValidators.vue index 1cbdb3837f..6290d08a8e 100644 --- a/app/src/renderer/components/staking/TableValidators.vue +++ b/app/src/renderer/components/staking/TableValidators.vue @@ -227,5 +227,4 @@ table tr td:nth-child(3):after top 1.5rem right 2rem background var(--bc-dim) - diff --git a/test/unit/helpers/console_error_throw.js b/test/unit/helpers/console_error_throw.js index 385c667e85..e5ea7005d6 100644 --- a/test/unit/helpers/console_error_throw.js +++ b/test/unit/helpers/console_error_throw.js @@ -1,5 +1,7 @@ "use strict" +/* eslint-env jasmine */ + if (!process.env.LISTENING_TO_UNHANDLED_REJECTION) { process.on(`unhandledRejection`, reason => { throw reason @@ -7,3 +9,20 @@ if (!process.env.LISTENING_TO_UNHANDLED_REJECTION) { // Avoid memory leak by adding too many listeners process.env.LISTENING_TO_UNHANDLED_REJECTION = true } + +if (!process.env.ALLOW_CONSOLE) { + const originalError = global.console.error + const originalWarn = global.console.warn + global.console.error = (...args) => { + originalError(...args) + fail( + `console.error in tests are forbidden (run with ALLOW_CONSOLE=true to show the console.error without failing)\n${args}` + ) + } + global.console.warn = (...args) => { + originalWarn(...args) + fail( + `console.warn in tests are forbidden (run with ALLOW_CONSOLE=true to show the console.warn without failing)\n${args}` + ) + } +} diff --git a/test/unit/specs/components/staking/__snapshots__/LiValidator.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/LiValidator.spec.js.snap index df39aea268..36feefcec8 100644 --- a/test/unit/specs/components/staking/__snapshots__/LiValidator.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/LiValidator.spec.js.snap @@ -21,7 +21,7 @@ exports[`LiValidator has the expected html structure 1`] = ` /> herr_schmidt_revoked diff --git a/test/unit/specs/components/staking/__snapshots__/TableValidators.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/TableValidators.spec.js.snap index aa7b47deae..35f829e741 100644 --- a/test/unit/specs/components/staking/__snapshots__/TableValidators.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/TableValidators.spec.js.snap @@ -33,7 +33,7 @@ exports[`TableValidators has the expected html structure 1`] = `