From 96b44ebf8b662b9d197e2dc6b9a2fab442f6f133 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Wed, 18 Dec 2013 13:21:40 -0700 Subject: [PATCH] Merging spenceralger:travis_and_coveralls. Summary of changes: - removed several unneeded devDeps - removed old get_spec.js script - the client's ping method will now send back true as the body when the ping succceeds, and false when it does not. When the ping fails, the error will still be sent back and the connection's status will still be set to "dead". - All of the client's methods now have a spec property, which will provide the JSON spec used to run that method. - The yaml test runner will only camelCase param names that are documented, uses the client's method's new spec property - Trace log events will now have their proper original query string parameters - The "tracer" logger will now write to elasticsearch-tracer.log by default, and will truncate the file if it already exists. - When running the integration tests, the client will now use a tracer logger which writes to stderr. The default level is "warning", but with the VERBOSE environment var it becomes "trace" and the logger will write to it's default file - Added .idea to the .gitignore, it was being published to NPM - Cleanup of the grunt tasks. Consilidated several tiny files into seperate moderately sized ones. --- .gitignore | 3 +- .travis.yml | 4 +- README.md | 4 +- grunt/browser_clients.js | 69 +++++++++++++++++++ grunt/browser_clients_build.js | 8 --- grunt/browser_clients_export.js | 30 -------- grunt/browser_clients_publish.js | 10 --- grunt/browser_clients_release.js | 20 ------ grunt/config/mochacov.js | 32 +++++++++ grunt/config/run.js | 18 ----- grunt/config/watch.js | 2 +- grunt/default.js | 9 --- grunt/generate.js | 5 -- grunt/tasks.js | 29 ++++++++ grunt/test.js | 16 ----- package.json | 9 +-- scripts/get_spec.js | 68 ------------------ src/lib/client.js | 1 + src/lib/client_action.js | 8 ++- src/lib/log.js | 7 +- src/lib/loggers/tracer.js | 13 +++- test/integration/yaml_suite/argv.js | 3 +- test/integration/yaml_suite/client_manager.js | 16 ++++- test/integration/yaml_suite/index.js | 7 +- test/integration/yaml_suite/yaml_doc.js | 37 ++++++---- 25 files changed, 199 insertions(+), 229 deletions(-) create mode 100644 grunt/browser_clients.js delete mode 100644 grunt/browser_clients_build.js delete mode 100644 grunt/browser_clients_export.js delete mode 100644 grunt/browser_clients_publish.js delete mode 100644 grunt/browser_clients_release.js create mode 100644 grunt/config/mochacov.js delete mode 100644 grunt/default.js delete mode 100644 grunt/generate.js create mode 100644 grunt/tasks.js delete mode 100644 grunt/test.js delete mode 100644 scripts/get_spec.js diff --git a/.gitignore b/.gitignore index 2ea7c53ee..b9a94e374 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ node_modules scripts/scratch* test/integration/yaml_suite/log .aws-config.json +.idea ## generated files scripts/last_rest_spec_update.sha @@ -12,5 +13,5 @@ test/integration/browser_yaml_suite/yaml_tests.js test/integration/yaml_suite/yaml_tests.json junit-*.xml test.log -elasticsearch.log +elasticsearch*.log coverage.html \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index cd532c708..e2d1804c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,6 @@ node_js: services: - elasticsearch before_script: - - npm install -g grunt-cli \ No newline at end of file + - npm install -g grunt-cli +script: + - grunt travis \ No newline at end of file diff --git a/README.md b/README.md index 507066877..0cc3543f6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # elasticsearch.js -The official low-level Elasticsearch client for Node.js and the browser. [![Build Status](https://build.elasticsearch.org/job/es-js_nightly/badge/icon)](https://build.elasticsearch.org/job/es-js_nightly/) +The official low-level Elasticsearch client for Node.js and the browser. + +[![Build Status](https://travis-ci.org/elasticsearch/elasticsearch-js.png?branch=master)](https://travis-ci.org/elasticsearch/elasticsearch-js) [![Coverage Status](https://coveralls.io/repos/elasticsearch/elasticsearch-js/badge.png)](https://coveralls.io/r/elasticsearch/elasticsearch-js) [![Build Status](https://build.elasticsearch.org/job/es-js_nightly/badge/icon)](https://build.elasticsearch.org/job/es-js_nightly/) ## Features diff --git a/grunt/browser_clients.js b/grunt/browser_clients.js new file mode 100644 index 000000000..213c2689c --- /dev/null +++ b/grunt/browser_clients.js @@ -0,0 +1,69 @@ +module.exports = function (grunt) { + grunt.registerTask('browser_clients:test', [ + 'build', + 'run:browser_unit_tests', + 'run:browser_integration_tests' + ]); + + grunt.registerTask('browser_clients:build', [ + 'clean:dist', + 'browserify', + 'uglify:dist', + 'concat:dist_banners' + ]); + + grunt.registerTask('browser_clients:publish', [ + 'browser_clients_build', + 'compress:dist_zip', + 'compress:dist_tarball', + 's3:latest' + ]); + + grunt.registerTask('browser_clients:release', [ + 'prompt:confirm_release', + '__check_for_confirmation', + 'browser_clients_build', + 'compress:dist_zip', + 'compress:dist_tarball', + 's3:release' + ]); + + grunt.registerTask('__check_for_confirmation', function () { + if (grunt.config.get('confirm.release')) { + grunt.log.verbose.writeln('release confirmed'); + } else { + throw new Error('Aborting release'); + } + }); + + // grunt.registerTask('browser_clients:export_all', function () { + // grunt.task.run([ + // 'build', + // 'export_client:angular:../bower-elasticsearch-angular', + // 'export_client::../bower-elasticsearch-browser', + // 'export_client:jquery:../bower-elasticsearch-jquery' + // ]); + // }); + + // grunt.registerTask('browser_clients:export_client', function (build, outDir) { + // var path = require('path'); + + // grunt.config.set('copy.export_client', { + // expand: true, + // cwd: './dist/', + // src: 'elasticsearch' + (build ? '.' + build : '') + '{.min,}.js', + // dest: outDir, + // rename: function (dest, src) { + // return path.join(dest, 'elasticsearch' + (~src.indexOf('.min') ? '.min' : '') + '.js'); + // } + // }); + + // this.requires('build'); + + // grunt.task.run([ + // 'copy:export_client' + // ]); + // }); + + +}; \ No newline at end of file diff --git a/grunt/browser_clients_build.js b/grunt/browser_clients_build.js deleted file mode 100644 index 322ac1547..000000000 --- a/grunt/browser_clients_build.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = function (grunt) { - grunt.registerTask('browser_clients_build', [ - 'clean:dist', - 'browserify', - 'uglify:dist', - 'concat:dist_banners' - ]); -}; \ No newline at end of file diff --git a/grunt/browser_clients_export.js b/grunt/browser_clients_export.js deleted file mode 100644 index d78b798cd..000000000 --- a/grunt/browser_clients_export.js +++ /dev/null @@ -1,30 +0,0 @@ -module.exports = function (grunt) { - grunt.registerTask('export_client', function (build, outDir) { - var path = require('path'); - - grunt.config.set('copy.export_client', { - expand: true, - cwd: './dist/', - src: 'elasticsearch' + (build ? '.' + build : '') + '{.min,}.js', - dest: outDir, - rename: function (dest, src) { - return path.join(dest, 'elasticsearch' + (~src.indexOf('.min') ? '.min' : '') + '.js'); - } - }); - - this.requires('build'); - - grunt.task.run([ - 'copy:export_client' - ]); - }); - - grunt.registerTask('export_all_clients', function () { - grunt.task.run([ - 'build', - 'export_client:angular:../bower-elasticsearch-angular', - 'export_client::../bower-elasticsearch-browser', - 'export_client:jquery:../bower-elasticsearch-jquery' - ]); - }); -}; \ No newline at end of file diff --git a/grunt/browser_clients_publish.js b/grunt/browser_clients_publish.js deleted file mode 100644 index a3a1dc8c2..000000000 --- a/grunt/browser_clients_publish.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = function (grunt) { - - grunt.registerTask('browser_clients_publish', [ - 'browser_clients_build', - 'compress:dist_zip', - 'compress:dist_tarball', - 's3:latest' - ]); - -}; \ No newline at end of file diff --git a/grunt/browser_clients_release.js b/grunt/browser_clients_release.js deleted file mode 100644 index b005f65b3..000000000 --- a/grunt/browser_clients_release.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = function (grunt) { - - grunt.registerTask('browser_clients_release', [ - 'prompt:confirm_release', - 'check_for_confirmation', - 'browser_clients_build', - 'compress:dist_zip', - 'compress:dist_tarball', - 's3:release' - ]); - - grunt.registerTask('check_for_confirmation', function () { - if (grunt.config.get('confirm.release')) { - grunt.log.verbose.writeln('release confirmed'); - } else { - throw new Error('Aborting release'); - } - }); - -}; \ No newline at end of file diff --git a/grunt/config/mochacov.js b/grunt/config/mochacov.js new file mode 100644 index 000000000..8997628ec --- /dev/null +++ b/grunt/config/mochacov.js @@ -0,0 +1,32 @@ +var unitTests = ['test/unit/test_*.js']; +var integrationTests = ['test/integration/yaml_suite/index.js']; + +module.exports = { + options: { + require: ['should'] + }, + coverage: { + src: unitTests, + options: { + reporter: 'mocha-lcov-reporter', + coveralls: { + serviceName: 'travis-ci', + repoToken: process.env.ESJS_COVERALS_REPO_TOKEN + } + } + }, + unit: { + src: unitTests + }, + integration: { + src: integrationTests + }, + make_html_unit_cov: { + src: unitTests, + options: { + reporter: 'html-cov', + output: 'coverage.html' + } + }, + +}; \ No newline at end of file diff --git a/grunt/config/run.js b/grunt/config/run.js index e52130ead..e56d7fa98 100644 --- a/grunt/config/run.js +++ b/grunt/config/run.js @@ -2,24 +2,6 @@ module.exports = { generate: { exec: 'node scripts/generate' }, - unit_tests: { - exec: 'node scripts/run_tests --unit --no-browsers', - options: { - passArgs: [ - 'port', - 'host' - ] - } - }, - integration_tests: { - exec: 'node scripts/run_tests --integration --no-browsers', - options: { - passArgs: [ - 'port', - 'host' - ] - } - }, browser_unit_tests: { exec: 'node scripts/run_tests --unit --no-server', options: { diff --git a/grunt/config/watch.js b/grunt/config/watch.js index 6a5fab44c..68362eda1 100644 --- a/grunt/config/watch.js +++ b/grunt/config/watch.js @@ -7,7 +7,7 @@ module.exports = { 'Gruntfile.js' ], tasks: [ - // 'jshint', + 'jshint', 'run:unit_tests' ], options: { diff --git a/grunt/default.js b/grunt/default.js deleted file mode 100644 index fdeb3f65b..000000000 --- a/grunt/default.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = function (grunt) { - - // Default task runs the build process. - grunt.registerTask('default', [ - 'run:generate', - 'test' - ]); - -}; \ No newline at end of file diff --git a/grunt/generate.js b/grunt/generate.js deleted file mode 100644 index 4fe78077b..000000000 --- a/grunt/generate.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = function (grunt) { - grunt.registerTask('generate', [ - 'run:generate' - ]); -}; \ No newline at end of file diff --git a/grunt/tasks.js b/grunt/tasks.js new file mode 100644 index 000000000..97b382766 --- /dev/null +++ b/grunt/tasks.js @@ -0,0 +1,29 @@ +module.exports = function (grunt) { + + // Default task runs the build process. + grunt.registerTask('default', [ + 'generate', + 'test' + ]); + + grunt.registerTask('generate', [ + 'run:generate' + ]); + + grunt.registerTask('test', [ + 'jshint', + 'mochacov:unit', + 'run:generate', + 'mochacov:integration', + ]); + + grunt.registerTask('coverage', [ + 'mochacov:make_html_unit_cov', + 'open:html_unit_cov' + ]); + + grunt.registerTask('travis', [ + 'test', + 'mochacov:coverage' + ]); +}; \ No newline at end of file diff --git a/grunt/test.js b/grunt/test.js deleted file mode 100644 index b0124e418..000000000 --- a/grunt/test.js +++ /dev/null @@ -1,16 +0,0 @@ -module.exports = function (grunt) { - - grunt.registerTask('test', [ - 'jshint', - 'run:unit_tests', - 'run:generate', - 'run:integration_tests' - ]); - - grunt.registerTask('browser_clients_test', [ - 'build', - 'run:browser_unit_tests', - 'run:browser_integration_tests' - ]); - -}; \ No newline at end of file diff --git a/package.json b/package.json index 1062c17c7..a286c4d8c 100644 --- a/package.json +++ b/package.json @@ -14,27 +14,21 @@ "./test/mocks/server.js": "./test/mocks/browser_server.js" }, "devDependencies": { - "tar": "~0.1.18", "mocha": "~1.14.0", "async": "~0.2.9", - "mkdirp": "~0.3.5", "moment": "~2.4.0", "should": "~2.1.0", "js-yaml": "~2.1.3", "optimist": "~0.6.0", - "expect.js": "~0.2.0", - "minimatch": "~0.2.12", "browserify": "~2.35.1", "grunt": "~0.4.1", "grunt-contrib-jshint": "~0.7.1", - "grunt-mocha-test": "~0.7.0", "grunt-browserify": "~1.2.11", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-uglify": "~0.2.7", "grunt-contrib-concat": "~0.3.0", "xmlbuilder": "~0.4.3", "grunt-contrib-watch": "~0.5.3", - "coveralls": "~2.6.0", "mocha-lcov-reporter": "0.0.1", "blanket": "~1.1.5", "sinon": "~1.7.3", @@ -48,9 +42,8 @@ "relative-fs": "0.0.1", "grunt-contrib-compress": "~0.5.3", "grunt-contrib-copy": "~0.4.1", - "grunt-mocha": "~0.4.7", "grunt-prompt": "~0.1.2", - "readable-stream": "~1.1.9" + "grunt-mocha-cov": "~0.1.1" }, "license": "Apache 2.0", "dependencies": { diff --git a/scripts/get_spec.js b/scripts/get_spec.js deleted file mode 100644 index ba758edde..000000000 --- a/scripts/get_spec.js +++ /dev/null @@ -1,68 +0,0 @@ -var EventEmitter = require('events').EventEmitter; -var Minimatch = require('minimatch').Minimatch; -var https = require('https'); -var tar = require('tar'); -var zlib = require('zlib'); -var path = require('path'); -var _ = require('lodash'); -var url = require('url'); -var tarUrl = 'https://github.com/elasticsearch/elasticsearch-rest-api-spec/tarball/master'; -var topDir = null; // remove the lowest directory, which changes with each commit. - -exports.get = function (pattern) { - var stream = new EventEmitter(); - var matcher = new Minimatch(pattern); - - var req = https.get(tarUrl, function receiveTarBall(incoming) { - if (incoming.statusCode !== 200) { - req.abort(); - if (incoming.headers.location) { - req = https.get(_.extend( - url.parse(tarUrl), - url.parse(incoming.headers.location) - ), - receiveTarBall - ); - } else { - console.error('request failed', incoming.statusCode, incoming.headers); - } - } else { - incoming - .pipe(zlib.createGunzip()) - .pipe(tar.Parse()) - .on('entry', function (entry) { - if (!topDir) { - topDir = entry.path.split('/').shift(); - } - entry.path = path.relative(topDir, entry.path); - if (matcher.match(entry.path)) { - collectData(entry); - } else { - entry.resume(); - } - }) - .on('end', function () { - stream.emit('end'); - }); - } - }); - - function collectData(entry) { - entry.data = ''; - - entry.on('data', onData); - entry.on('end', onEnd); - - function onData(chunk) { - entry.data += chunk; - } - - function onEnd() { - entry.removeListener('data', onData); - entry.removeListener('end', onEnd); - stream.emit('entry', entry); - } - } - - return stream; -}; diff --git a/src/lib/client.js b/src/lib/client.js index 47729bf14..b02f2a78c 100755 --- a/src/lib/client.js +++ b/src/lib/client.js @@ -66,6 +66,7 @@ Client.prototype.ping = ca({ url: { fmt: '/' }, + castExists: true, requestTimeout: 100 }); diff --git a/src/lib/client_action.js b/src/lib/client_action.js index 0e30c625e..218ee16ce 100644 --- a/src/lib/client_action.js +++ b/src/lib/client_action.js @@ -16,7 +16,7 @@ function ClientAction(spec) { spec.method = 'GET'; } - return function (params, cb) { + function action(params, cb) { if (typeof params === 'function') { cb = params; params = {}; @@ -34,7 +34,11 @@ function ClientAction(spec) { return when.reject(e); } } - }; + } + + action.spec = spec; + + return action; } var castType = { diff --git a/src/lib/log.js b/src/lib/log.js index c82a65d62..448a453e7 100755 --- a/src/lib/log.js +++ b/src/lib/log.js @@ -271,12 +271,15 @@ Log.prototype.trace = function (method, requestUrl, body, responseBody, response if (this.listenerCount('trace')) { if (typeof requestUrl === 'string') { requestUrl = url.parse(requestUrl, true, true); + } else if (requestUrl.path) { + requestUrl.query = url.parse(requestUrl.path, true, false).query; } + requestUrl = _.defaults({ host: 'localhost:9200', - query: _.defaults({ + query: _.defaults(requestUrl.query || {}, { pretty: true - }, requestUrl.query) + }) }, requestUrl); delete requestUrl.auth; diff --git a/src/lib/loggers/tracer.js b/src/lib/loggers/tracer.js index 9597878c0..e37edd0dc 100755 --- a/src/lib/loggers/tracer.js +++ b/src/lib/loggers/tracer.js @@ -12,13 +12,20 @@ module.exports = Tracer; -var FileLogger = require('./file'); +var StreamLogger = require('./stream'); +var fs = require('fs'); var _ = require('../utils'); function Tracer(log, config) { - FileLogger.call(this, log, config); + if (config.path === false) { + config.stream = process.stderr; + } else { + config.stream = fs.createWriteStream(config.path || 'elasticsearch-tracer.log'); + } + + StreamLogger.call(this, log, config); } -_.inherits(Tracer, FileLogger); +_.inherits(Tracer, StreamLogger); Tracer.prototype.onTrace = _.handler(function (message, curlCall) { this.write('TRACE', message, curlCall); diff --git a/test/integration/yaml_suite/argv.js b/test/integration/yaml_suite/argv.js index 85bfcb2f6..539397026 100644 --- a/test/integration/yaml_suite/argv.js +++ b/test/integration/yaml_suite/argv.js @@ -6,8 +6,7 @@ var defaults = { clusterName: 'yaml-test-runner', dataPath: '/tmp/yaml-test-runner', host: 'localhost', - port: '9200', - match: '**' + port: '9200' }; if (process.browser) { diff --git a/test/integration/yaml_suite/client_manager.js b/test/integration/yaml_suite/client_manager.js index 237c0b555..d60ff7c56 100644 --- a/test/integration/yaml_suite/client_manager.js +++ b/test/integration/yaml_suite/client_manager.js @@ -1,4 +1,7 @@ -if (process.browser) { +var BROWSER = process.env.browser; +var VERBOSE = process.env.VERBOSE; + +if (BROWSER) { /* jshint browser: true */ var es = window.elasticsearch; } else { @@ -69,8 +72,15 @@ module.exports = { } ], log: { - type: process.browser ? 'console' : 'stdio', - level: process.env.VERBOSE ? 'trace' : 'warning' + type: BROWSER + ? 'console' + : VERBOSE + ? 'tracer' + : 'stdio', + level: VERBOSE + ? 'trace' + : 'warning', + path: VERBOSE ? undefined : false } }); diff --git a/test/integration/yaml_suite/index.js b/test/integration/yaml_suite/index.js index 792469a8d..9b73139c4 100644 --- a/test/integration/yaml_suite/index.js +++ b/test/integration/yaml_suite/index.js @@ -1,15 +1,12 @@ var path = require('path'); var async = require('async'); var jsYaml = require('js-yaml'); -var expect = require('expect.js'); var YamlFile = require('./yaml_file'); var _ = require('../../../src/lib/utils'); var es = require('../../../src/elasticsearch'); var clientManager = require('./client_manager'); -var Minimatch = require('minimatch').Minimatch; var argv = require('./argv'); var testDir = path.resolve(__dirname, './tests'); -var doPattern = new Minimatch(argv.match); describe('integration', function () { this.timeout(30000); @@ -30,9 +27,7 @@ describe('integration', function () { }); var files = _.map(require('./yaml_tests.json'), function (docs, filename) { - if (doPattern.match(filename)) { - return new YamlFile(filename, docs); - } + return new YamlFile(filename, docs); }); }); \ No newline at end of file diff --git a/test/integration/yaml_suite/yaml_doc.js b/test/integration/yaml_suite/yaml_doc.js index ad04b4b5e..8667ea324 100644 --- a/test/integration/yaml_suite/yaml_doc.js +++ b/test/integration/yaml_suite/yaml_doc.js @@ -8,8 +8,8 @@ module.exports = YamlDoc; var _ = require('../../../src/lib/utils'); +var should = require('should'); var clientManager = require('./client_manager'); -var expect = require('expect.js'); /** * The version that ES is running, in comparable string form XXX-XXX-XXX, fetched when needed @@ -42,7 +42,7 @@ function getVersionFromES(done) { if (err) { throw new Error('unable to get info about ES'); } - expect(resp.version.number).to.match(versionRE); + should(resp.version.number).match(versionRE); ES_VERSION = versionToComparableString(versionRE.exec(resp.version.number)[1]); done(); }); @@ -77,7 +77,7 @@ function versionToComparableString(version) { */ function rangeMatchesCurrentVersion(rangeString, done) { function doWork() { - expect(rangeString).to.match(versionRangeRE); + should(rangeString).match(versionRangeRE); var range = versionRangeRE.exec(rangeString); range = _.map(_.last(range, 2), versionToComparableString); @@ -114,7 +114,7 @@ function YamlDoc(doc, file) { var method = self['do_' + action.name]; // check that it's a function - expect(method).to.be.a('function'); + should(method).have.type('function'); if (_.isPlainObject(action.args)) { action.name += ' ' + _.keys(action.args).join(', '); @@ -306,11 +306,18 @@ YamlDoc.prototype = { var action = Object.keys(args).pop(); var clientActionName = _.map(action.split('.'), _.camelCase).join('.'); var clientAction = this.get(clientActionName, client); - var params = _.transform(args[action], function (note, val, name) { - note[_.camelCase(name)] = (typeof val === 'string' && val[0] === '$') ? this.get(val) : val; + var params = _.transform(args[action], function (params, val, name) { + var camelName = _.camelCase(name); + // undocumented params should be passed through as-is + var paramName = name; + if (clientAction && clientAction.spec && clientAction.spec.params && clientAction.spec.params[camelName]) { + paramName = camelName; + } + + params[paramName] = (typeof val === 'string' && val[0] === '$') ? this.get(val) : val; }, {}, this); - expect(clientAction || clientActionName).to.be.a('function'); + should(clientAction || clientActionName).have.type('function'); if (typeof clientAction === 'function') { if (_.isNumeric(catcher)) { @@ -325,11 +332,11 @@ YamlDoc.prototype = { if (catcher) { if (catcher instanceof RegExp) { // error message should match the regexp - expect(error.message).to.match(catcher); + should(error.message).match(catcher); error = null; } else if (typeof catcher === 'function') { // error should be an instance of - expect(error).to.be.a(catcher); + should(error).be.an.instanceOf(catcher); error = null; } else { return done(new Error('Invalid catcher ' + catcher)); @@ -373,7 +380,7 @@ YamlDoc.prototype = { * @return {undefined} */ do_is_true: function (path) { - expect(this.get(path)).to.be.ok; + should(Boolean(this.get(path))).equal(true, 'path: ' + path); }, /** @@ -384,7 +391,7 @@ YamlDoc.prototype = { * @return {undefined} */ do_is_false: function (path) { - expect(this.get(path)).to.not.be.ok; + should(Boolean(this.get(path))).equal(false, 'path: ' + path); }, /** @@ -398,7 +405,7 @@ YamlDoc.prototype = { if (val[0] === '$') { val = this.get(val); } - expect(this.get(path)).to.eql(val); + should(this.get(path)).eql(val, 'path: ' + path); }, this); }, @@ -410,7 +417,7 @@ YamlDoc.prototype = { */ do_lt: function (args) { _.forOwn(args, function (num, path) { - expect(this.get(path)).to.be.below(num); + should(this.get(path)).be.below(num, 'path: ' + path); }, this); }, @@ -422,7 +429,7 @@ YamlDoc.prototype = { */ do_gt: function (args) { _.forOwn(args, function (num, path) { - expect(this.get(path)).to.be.above(num); + should(this.get(path)).be.above(num, 'path: ' + path); }, this); }, @@ -435,7 +442,7 @@ YamlDoc.prototype = { */ do_length: function (args) { _.forOwn(args, function (len, path) { - expect(_.size(this.get(path))).to.be(len); + should(_.size(this.get(path))).eql(len, 'path: ' + path); }, this); } };