From 7f89a4a26f2079fe771ecc28587187f93c0f078d Mon Sep 17 00:00:00 2001 From: KatsuyaHoshii Date: Fri, 25 May 2018 11:48:33 +0900 Subject: [PATCH 1/2] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 328a85ef7..05edbdbb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ matrix: include: - node_js: "10" script: - - istanbul cover ./node_modules/.bin/grunt --report lcovonly && istanbul report text && ( cat coverage/lcov.info | $(npm get prefix)/bin/coveralls || true ) && rm -rf coverage + - ./node_modules/.bin/grunt coverage && istanbul report text && ( cat coverage/lcov.info | $(npm get prefix)/bin/coveralls || true ) && rm -rf coverage before_script: - npm install -g istanbul coveralls - node_js: "8" From bca020bc4dbf357614c2f59e1c6752b1cd435982 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 25 May 2018 11:36:17 +0100 Subject: [PATCH 2/2] Tidy up default grunt task and fixup test break due to reorder Fixes #1738 --- .travis.yml | 2 +- Gruntfile.js | 4 ++-- red/api/auth/users.js | 4 ++++ test/red/api/auth/users_spec.js | 8 +++++--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 05edbdbb3..054edefba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ matrix: include: - node_js: "10" script: - - ./node_modules/.bin/grunt coverage && istanbul report text && ( cat coverage/lcov.info | $(npm get prefix)/bin/coveralls || true ) && rm -rf coverage + - ./node_modules/.bin/grunt && istanbul report text && ( cat coverage/lcov.info | $(npm get prefix)/bin/coveralls || true ) && rm -rf coverage before_script: - npm install -g istanbul coveralls - node_js: "8" diff --git a/Gruntfile.js b/Gruntfile.js index 2be2d23c0..3738e60b4 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -55,7 +55,7 @@ module.exports = function(grunt) { reportFormats: ['lcov','html'], print: 'both' }, - all: { src: ['test/**/*_spec.js'] }, + all: { src: ["test/_spec.js","test/red/**/*_spec.js","test/nodes/**/*_spec.js"] }, core: { src: ["test/_spec.js","test/red/**/*_spec.js"]}, nodes: { src: ["test/nodes/**/*_spec.js"]} }, @@ -474,7 +474,7 @@ module.exports = function(grunt) { grunt.registerTask('default', 'Builds editor content then runs code style checks and unit tests on all components', - ['build','test-core','test-editor','test-nodes']); + ['build','jshint:editor','mocha_istanbul:all']); grunt.registerTask('test-core', 'Runs code style check and unit tests on core runtime code', diff --git a/red/api/auth/users.js b/red/api/auth/users.js index 92c4c9ce9..24a762958 100644 --- a/red/api/auth/users.js +++ b/red/api/auth/users.js @@ -86,6 +86,10 @@ function init(config) { } else { api.authenticate = authenticate; } + } else { + api.get = get; + api.authenticate = authenticate; + api.default = api.default; } if (config.default) { if (typeof config.default === "function") { diff --git a/test/red/api/auth/users_spec.js b/test/red/api/auth/users_spec.js index 23c34001d..e7b70f7b1 100644 --- a/test/red/api/auth/users_spec.js +++ b/test/red/api/auth/users_spec.js @@ -194,8 +194,7 @@ describe("api/auth/users", function() { it('should fail to return user fred',function(done) { Users.get("fred").then(function(userf) { try { - userf.should.not.have.a.property("username","fred"); - userf.should.not.have.a.property("permissions","*"); + should.not.exist(userf); done(); } catch(err) { done(err); @@ -212,9 +211,12 @@ describe("api/auth/users", function() { default: function() { return("Done"); } }); }); + after(function() { + Users.init({}); + }); describe('#default',function() { it('handles api.default being a function',function(done) { - Users.should.have.property('default').which.is.a.Function; + Users.should.have.property('default').which.is.a.Function(); (Users.default()).should.equal("Done"); done(); });