Skip to content

Commit

Permalink
fix(i18n): rename unclear 'implication failed' to 'missing dependent …
Browse files Browse the repository at this point in the history
…arguments' (#1317)
  • Loading branch information
jandockx authored and bcoe committed May 8, 2019
1 parent a3a5d05 commit bf46813
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion locales/de.json
Expand Up @@ -29,7 +29,7 @@
"Invalid values:": "Unzulässige Werte:",
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeben: %s, Möglichkeiten: %s",
"Argument check failed: %s": "Argumente-Check fehlgeschlagen: %s",
"Implications failed:": "Implikationen fehlgeschlagen:",
"Implications failed:": "Fehlende abhängige Argumente:",
"Not enough arguments following: %s": "Nicht genügend Argumente nach: %s",
"Invalid JSON config file: %s": "Fehlerhafte JSON-Config Datei: %s",
"Path to JSON config file": "Pfad zur JSON-Config Datei",
Expand Down
2 changes: 1 addition & 1 deletion locales/en.json
Expand Up @@ -29,7 +29,7 @@
"Invalid values:": "Invalid values:",
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s",
"Argument check failed: %s": "Argument check failed: %s",
"Implications failed:": "Implications failed:",
"Implications failed:": "Missing dependent arguments:",
"Not enough arguments following: %s": "Not enough arguments following: %s",
"Invalid JSON config file: %s": "Invalid JSON config file: %s",
"Path to JSON config file": "Path to JSON config file",
Expand Down
2 changes: 1 addition & 1 deletion locales/fr.json
Expand Up @@ -28,7 +28,7 @@
"Invalid values:": "Valeurs invalides:",
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Donné: %s, Choix: %s",
"Argument check failed: %s": "Echec de la vérification de l'argument: %s",
"Implications failed:": "Implications échouées:",
"Implications failed:": "Arguments dépendants manquants:",
"Not enough arguments following: %s": "Pas assez d'arguments suivant: %s",
"Invalid JSON config file: %s": "Fichier de configuration JSON invalide: %s",
"Path to JSON config file": "Chemin du fichier de configuration JSON",
Expand Down
2 changes: 1 addition & 1 deletion locales/it.json
Expand Up @@ -29,7 +29,7 @@
"Invalid values:": "Valori non validi:",
"Argument: %s, Given: %s, Choices: %s": "Argomento: %s, Richiesto: %s, Scelte: %s",
"Argument check failed: %s": "Controllo dell'argomento fallito: %s",
"Implications failed:": "Argomenti impliciti non soddisfatti:",
"Implications failed:": "Argomenti dipendenti mancanti:",
"Not enough arguments following: %s": "Argomenti insufficienti dopo: %s",
"Invalid JSON config file: %s": "File di configurazione JSON non valido: %s",
"Path to JSON config file": "Percorso del file di configurazione JSON",
Expand Down
2 changes: 1 addition & 1 deletion locales/nl.json
Expand Up @@ -29,7 +29,7 @@
"Invalid values:": "Ongeldige waarden:",
"Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeven: %s, Keuzes: %s",
"Argument check failed: %s": "Argumentcontrole mislukt: %s",
"Implications failed:": "Mislukte implicaties:",
"Implications failed:": "Ontbrekende afhankelijke argumenten:",
"Not enough arguments following: %s": "Niet genoeg argumenten na: %s",
"Invalid JSON config file: %s": "Ongeldig JSON-config-bestand: %s",
"Path to JSON config file": "Pad naar JSON-config-bestand",
Expand Down
17 changes: 10 additions & 7 deletions test/validation.js
Expand Up @@ -3,6 +3,7 @@

const checkUsage = require('./helpers/utils').checkOutput
const expect = require('chai').expect
const english = require('../locales/en.json')
let yargs = require('../')

require('chai').should()
Expand All @@ -13,13 +14,15 @@ describe('validation tests', () => {
})

describe('implies', () => {
const implicationsFailedPattern = new RegExp(english['Implications failed:'])

it("fails if '_' populated, and implied argument not set", (done) => {
yargs(['cat'])
.implies({
1: 'foo' // 1 arg in _ means --foo is required
})
.fail((msg) => {
msg.should.match(/Implications failed/)
msg.should.match(implicationsFailedPattern)
return done()
})
.parse()
Expand All @@ -32,7 +35,7 @@ describe('validation tests', () => {
'foo': 1 // --foo means 1 arg in _ is required
})
.fail((msg) => {
msg.should.match(/Implications failed/)
msg.should.match(implicationsFailedPattern)
return done()
})
.parse()
Expand Down Expand Up @@ -62,7 +65,7 @@ describe('validation tests', () => {
'--no-bar': 'foo' // when --bar is not given, --foo is required
})
.fail((msg) => {
msg.should.match(/Implications failed/)
msg.should.match(implicationsFailedPattern)
return done()
})
.parse()
Expand All @@ -74,7 +77,7 @@ describe('validation tests', () => {
'bar': '--no-foo' // --bar means --foo cannot be given
})
.fail((msg) => {
msg.should.match(/Implications failed/)
msg.should.match(implicationsFailedPattern)
return done()
})
.parse()
Expand All @@ -89,7 +92,7 @@ describe('validation tests', () => {
})
.fail((msg) => {
failCalled = true
msg.should.match(/Implications failed/)
msg.should.match(implicationsFailedPattern)
})
.parse()
failCalled.should.equal(true)
Expand Down Expand Up @@ -121,7 +124,7 @@ describe('validation tests', () => {
})
.fail((msg) => {
failCalled = true
msg.should.match(/Implications failed/)
msg.should.match(implicationsFailedPattern)
})
.parse()
failCalled.should.equal(true)
Expand Down Expand Up @@ -150,7 +153,7 @@ describe('validation tests', () => {
implies: 'foo'
})
.fail((msg) => {
msg.should.match(/Implications failed/)
msg.should.match(implicationsFailedPattern)
return done()
})
.parse()
Expand Down
6 changes: 4 additions & 2 deletions test/yargs.js
Expand Up @@ -5,12 +5,14 @@ const expect = require('chai').expect
const fs = require('fs')
const path = require('path')
const checkOutput = require('./helpers/utils').checkOutput
const english = require('../locales/en.json')
let yargs
const YError = require('../lib/yerror')

require('chai').should()

const noop = () => {}
const implicationsFailedPattern = new RegExp(english['Implications failed:'])

describe('yargs dsl tests', () => {
beforeEach(() => {
Expand Down Expand Up @@ -56,7 +58,7 @@ describe('yargs dsl tests', () => {
.parse()
)

r.errors[2].should.match(/Implications failed/)
r.errors[2].should.match(implicationsFailedPattern)
})

it('accepts an object for describes', () => {
Expand All @@ -79,7 +81,7 @@ describe('yargs dsl tests', () => {
x: 'y'
})
.fail((msg) => {
msg.should.match(/Implications failed/)
msg.should.match(implicationsFailedPattern)
return done()
})
.parse()
Expand Down

0 comments on commit bf46813

Please sign in to comment.