diff --git a/.circleci/config.yml b/.circleci/config.yml index 88e401bbb2..464710e090 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,6 +65,15 @@ jobs: - <<: *restore_dependency_cache - run: npm run test:examples + # Test locale files + test_locales: + <<: *defaults + steps: + - checkout + - <<: *restore_dependency_cache + - run: npm run build + - run: npm run test:locales + # Release a "next" version next_release: <<: *defaults @@ -117,12 +126,16 @@ workflows: - test_examples: requires: - test + - test_locales: + requires: + - test # Hold for approval - hold: type: approval requires: - test - test_examples + - test_locales filters: branches: only: @@ -133,6 +146,7 @@ workflows: - dependencies - test - test_examples + - test_locales filters: branches: only: develop @@ -142,6 +156,7 @@ workflows: - dependencies - test - test_examples + - test_locales - hold filters: branches: diff --git a/package.json b/package.json index d9e0653855..0f7e8a5d02 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "eslint": "eslint --color --format stylish '{lib,test,build,doc}/**/*.js' 'Gruntfile.js'", "test": "npm run retire && tsc && grunt test", "test:examples": "node ./doc/examples/test-examples", + "test:locales": "mocha test/test-locales.js", "version": "echo \"use 'npm run release' to bump axe-core version\" && exit 1", "prepublishOnly": "grunt build && grunt file-exists", "retire": "retire --jspath lib --nodepath ./ --ignorefile .retireignore.json --severity medium", diff --git a/test/test-locales.js b/test/test-locales.js new file mode 100644 index 0000000000..01867c31ff --- /dev/null +++ b/test/test-locales.js @@ -0,0 +1,22 @@ +var fs = require('fs'); +var path = require('path'); +var assert = require('assert'); +var glob = require('glob'); +var axe = require(path.join(__dirname, '../axe')); + +var localeFiles = glob.sync(path.join(__dirname, '../locales/*.json')); + +describe('locales', function() { + localeFiles.forEach(function(localeFile) { + var localeName = path.basename(localeFile); + it(localeName + ' should be valid', function() { + var localeData = fs.readFileSync(localeFile, 'utf-8'); + var locale = JSON.parse(localeData); + function fn() { + axe.configure({ locale: locale }); + } + + assert.doesNotThrow(fn); + }); + }); +});