diff --git a/.jscsrc b/.jscsrc index 6eabc1b2fc..01605f110b 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,4 +1,5 @@ { "preset": "ember-suave", - "requireCommentsToIncludeAccess": false + "requireCommentsToIncludeAccess": false, + "disallowConstOutsideModuleScope": false } diff --git a/.npmignore b/.npmignore index 204e58a4c8..a810da8c4a 100644 --- a/.npmignore +++ b/.npmignore @@ -1,16 +1,17 @@ -bower_components/ -tests/ -tmp/ -dist/ - +/bower_components +/config/ember-try.js +/dist +/tests +/tmp +**/.gitkeep .bowerrc .editorconfig .ember-cli +.gitignore +.jshintrc +.watchmanconfig .travis.yml -.npmignore -**/.gitkeep bower.json ember-cli-build.js -Brocfile.js testem.json -node-tests +node-tests/ \ No newline at end of file diff --git a/bower.json b/bower.json index d9187836ad..50aa0c6e13 100644 --- a/bower.json +++ b/bower.json @@ -1,20 +1,13 @@ { "name": "ember-simple-auth", "dependencies": { - "bootstrap": "~3.3.5", - "ember": "~2.3.0", + "bootstrap": "~3.3.6", + "ember": "~2.4.1", "ember-cli-shims": "0.1.0", - "ember-cli-test-loader": "0.2.1", - "ember-load-initializers": "0.1.7", + "ember-cli-test-loader": "0.2.2", "ember-mocha": "~0.8.7", - "ember-resolver": "~0.1.20", - "jquery": "1.11.3", - "loader.js": "ember-cli/loader.js#3.4.0", "sinonjs": "~1.17.1", "base64": "~0.3.0", - "pretender": "^0.10.1" - }, - "resolutions": { - "ember": "~2.2.0" + "pretender": "^0.12.0" } -} \ No newline at end of file +} diff --git a/config/environment.js b/config/environment.js index 0dfaed4728..28a787b62f 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,3 +1,4 @@ +/*jshint node:true*/ 'use strict'; module.exports = function(/* environment, appConfig */) { diff --git a/ember-cli-build.js b/ember-cli-build.js index 7991cd4d72..c5ed2b41a6 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -4,7 +4,7 @@ const yuidoc = require('broccoli-yuidoc'); const version = require('git-repo-version')(); const Handlebars = require('handlebars'); const mergeTrees = require('broccoli-merge-trees'); -const merge = require('lodash/object/merge'); +const merge = require('lodash/merge'); var sourceTrees = []; diff --git a/node-tests/blueprints/authenticator-test.js b/node-tests/blueprints/authenticator-test.js index e61b97ad47..218899ce5e 100644 --- a/node-tests/blueprints/authenticator-test.js +++ b/node-tests/blueprints/authenticator-test.js @@ -9,6 +9,7 @@ describe('Acceptance: ember generate and destroy authenticator', function() { setupTestHooks(this); it('generates a torii authenticator', function() { + debugger; return generateAndDestroy(['authenticator', 'application', '--base-class=torii'], { files: [ { file: 'app/authenticators/application.js', contains: ['\ @@ -20,7 +21,7 @@ export default Torii.extend({' + EOL + '\ });' + EOL + '\ ']} ] - }); + }).then(function() { debugger; }, function() { debugger; }); }); it('generates an OAuth 2.0 authenticator', function() { diff --git a/node-tests/fixtures/addon/package/package.json b/node-tests/fixtures/addon/package/package.json new file mode 100644 index 0000000000..70daf7f955 --- /dev/null +++ b/node-tests/fixtures/addon/package/package.json @@ -0,0 +1,22 @@ +{ + "name": "my-addon", + "version": "0.0.0", + "description": "Addon fixture package for ember-cli-blueprint-test-helpers", + "engines": { + "node": ">= 0.10.0" + }, + "devDependencies": { + "ember-cli": "*", + "ember-simple-auth": "*" + }, + "keywords": [ + "ember-addon" + ], + "dependencies": { + "ember-cli-htmlbars": "*", + "ember-cli-babel": "*" + }, + "ember-addon": { + "configPath": "tests/dummy/config" + } +} diff --git a/node-tests/fixtures/app/package/package.json b/node-tests/fixtures/app/package/package.json new file mode 100644 index 0000000000..13ed202128 --- /dev/null +++ b/node-tests/fixtures/app/package/package.json @@ -0,0 +1,13 @@ +{ + "name": "my-app", + "version": "0.0.0", + "description": "App fixture package for ember-cli-blueprint-test-helpers", + "private": true, + "engines": { + "node": ">= 0.10.0" + }, + "devDependencies": { + "ember-cli": "*", + "ember-simple-auth": "*" + } +} diff --git a/node-tests/nodetest-runner.js b/node-tests/nodetest-runner.js index 968a150f2a..05b1299f38 100644 --- a/node-tests/nodetest-runner.js +++ b/node-tests/nodetest-runner.js @@ -21,7 +21,11 @@ var mocha = new Mocha({ reporter: 'spec' }); var testFiles = glob.sync(root + '/**/*-test.js'); +/*var jshintPosition = testFiles.indexOf('tests/unit/jshint-test.js'); +var jshint = testFiles.splice(jshintPosition, 1); +testFiles = jshint.concat(testFiles); +*/ if (optionOrFile === 'all') { addFiles(mocha, testFiles); addFiles(mocha, 'node-tests/**/*-test.js'); diff --git a/package.json b/package.json index 5be5570bc8..49e2cec23e 100644 --- a/package.json +++ b/package.json @@ -21,42 +21,45 @@ "devDependencies": { "body-parser": "^1.2.0", "broccoli-asset-rev": "^2.2.0", - "broccoli-merge-trees": "^0.2.3", + "broccoli-merge-trees": "^1.1.1", "broccoli-yuidoc": "~2.1.0", - "ember-browserify": "~1.1.4", - "ember-cli": "1.13.13", + "ember-ajax": "0.7.1", + "ember-browserify": "~1.1.7", + "ember-cli": "2.4.0", "ember-cli-app-version": "^1.0.0", "ember-cli-base64": "~0.0.1", - "ember-cli-blueprint-test-helpers": "0.7.0", - "ember-cli-content-security-policy": "0.4.0", - "ember-cli-dependency-checker": "^1.1.0", + "ember-cli-blueprint-test-helpers": "~0.10.0", + "ember-cli-content-security-policy": "~0.5.0", + "ember-cli-dependency-checker": "^1.2.0", "ember-cli-htmlbars": "^1.0.1", "ember-cli-htmlbars-inline-precompile": "^0.3.1", - "ember-cli-ic-ajax": "0.2.4", "ember-cli-inject-live-reload": "^1.3.1", - "ember-cli-internal-test-helpers": "^0.5.0", - "ember-cli-mocha": "~0.9.7", + "ember-cli-internal-test-helpers": "^0.7.0", + "ember-cli-mocha": "~0.10.0", "ember-cli-pretender": "~0.5.0", "ember-cli-release": "0.2.8", - "ember-cli-sri": "^1.2.0", + "ember-cli-sri": "^2.0.0", "ember-cli-uglify": "^1.2.0", - "ember-data": "~2.3.0", - "ember-disable-prototype-extensions": "^1.0.0", + "ember-data": "^2.4.0", + "ember-disable-prototype-extensions": "^1.1.0", "ember-disable-proxy-controllers": "^1.0.1", "ember-export-application-global": "^1.0.4", - "ember-sinon": "~0.3.0", - "ember-suave": "~1.2.2", - "ember-try": "~0.0.8", + "ember-load-initializers": "^0.5.0", + "ember-resolver": "^2.0.3", + "ember-sinon": "~0.5.0", + "ember-suave": "~2.0.1", + "ember-try": "^0.1.2", "express": "^4.12.3", "git-repo-version": "^0.3.0", "glob": "^5.0.13", - "handlebars": "~3.0.3", - "lodash": "^3.10.1", + "handlebars": "~4.0.5", + "loader.js": "^4.0.0", + "lodash": "^4.5.1", "marked": "^0.3.5", "mocha": "^2.4.5", - "mocha-only-detector": "0.0.2", + "mocha-only-detector": "0.1.0", "morgan": "^1.5.2", - "rimraf": "^2.3.2", + "rimraf": "^2.5.2", "sinon-chai": "~2.8.0", "torii": "~0.6.1" }, diff --git a/testem.json b/testem.js similarity index 71% rename from testem.json rename to testem.js index 6280a9793b..26044b2f85 100644 --- a/testem.json +++ b/testem.js @@ -1,5 +1,6 @@ -{ - "framework": "mocha", +/*jshint node:true*/ +module.exports = { + "framework": "qunit", "test_page": "tests/index.html?hidepassed", "disable_watching": true, "launch_in_ci": [ @@ -9,4 +10,4 @@ "PhantomJS", "Chrome" ] -} +}; diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index 8b234d6d57..831ad6106d 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -import Resolver from 'ember/resolver'; -import loadInitializers from 'ember/load-initializers'; +import Resolver from './resolver'; +import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; let App; diff --git a/tests/dummy/app/authenticators/torii.js b/tests/dummy/app/authenticators/torii.js index ab458c55e7..8a00f8be6d 100644 --- a/tests/dummy/app/authenticators/torii.js +++ b/tests/dummy/app/authenticators/torii.js @@ -1,30 +1,28 @@ import Ember from 'ember'; import Torii from 'ember-simple-auth/authenticators/torii'; -import raw from 'ic-ajax'; -const { RSVP } = Ember; -const { service } = Ember.inject; +const { inject: { service } } = Ember; export default Torii.extend({ - torii: service('torii'), + torii: service(), + ajax: service(), authenticate() { - return new RSVP.Promise((resolve, reject) => { - this._super(...arguments).then((data) => { - raw({ - url: '/token', - type: 'POST', - dataType: 'json', - data: { 'grant_type': 'facebook_auth_code', 'auth_code': data.authorizationCode } - }).then((response) => { - resolve({ - // jscs:disable requireCamelCaseOrUpperCaseIdentifiers - access_token: response.access_token, - // jscs:enable requireCamelCaseOrUpperCaseIdentifiers - provider: data.provider - }); - }, reject); - }, reject); + const ajax = this.get('ajax'); + + return this._super(...arguments).then((data) => { + return ajax.request('/token', { + type: 'POST', + dataType: 'json', + data: { 'grant_type': 'facebook_auth_code', 'auth_code': data.authorizationCode } + }).then((response) => { + return { + // jscs:disable requireCamelCaseOrUpperCaseIdentifiers + access_token: response.access_token, + // jscs:enable requireCamelCaseOrUpperCaseIdentifiers + provider: data.provider + }; + }); }); } }); diff --git a/tests/dummy/app/index.html b/tests/dummy/app/index.html index 1c49d36d0e..c9b432708d 100644 --- a/tests/dummy/app/index.html +++ b/tests/dummy/app/index.html @@ -7,19 +7,19 @@ - {{content-for 'head'}} + {{content-for "head"}} - {{content-for 'head-footer'}} + {{content-for "head-footer"}} - {{content-for 'body'}} + {{content-for "body"}} - {{content-for 'body-footer'}} + {{content-for "body-footer"}} diff --git a/tests/dummy/app/resolver.js b/tests/dummy/app/resolver.js new file mode 100644 index 0000000000..2fb563d6c0 --- /dev/null +++ b/tests/dummy/app/resolver.js @@ -0,0 +1,3 @@ +import Resolver from 'ember-resolver'; + +export default Resolver; diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js new file mode 100644 index 0000000000..21e0216e70 --- /dev/null +++ b/tests/helpers/module-for-acceptance.js @@ -0,0 +1,27 @@ +import { module } from 'qunit'; +import startApp from '../helpers/start-app'; +import destroyApp from '../helpers/destroy-app'; + +export default function(name, options = {}) { + module(name, { + beforeEach() { + this.application = startApp(); + + if (options.beforeEach) { + // jscs:disable requireSpread + options.beforeEach.apply(this, arguments); + // jscs:enable requireSpread + } + }, + + afterEach() { + if (options.afterEach) { + // jscs:disable requireSpread + options.afterEach.apply(this, arguments); + // jscs:enable requireSpread + } + + destroyApp(this.application); + } + }); +} diff --git a/tests/helpers/resolver.js b/tests/helpers/resolver.js index ebfb4e4d45..b208d38d09 100644 --- a/tests/helpers/resolver.js +++ b/tests/helpers/resolver.js @@ -1,4 +1,4 @@ -import Resolver from 'ember/resolver'; +import Resolver from '../../resolver'; import config from '../../config/environment'; const resolver = Resolver.create(); diff --git a/tests/index.html b/tests/index.html index 5e88e5e10c..64cb47e31f 100644 --- a/tests/index.html +++ b/tests/index.html @@ -7,28 +7,28 @@ - {{content-for 'head'}} - {{content-for 'test-head'}} + {{content-for "head"}} + {{content-for "test-head"}} - {{content-for 'head-footer'}} - {{content-for 'test-head-footer'}} + {{content-for "head-footer"}} + {{content-for "test-head-footer"}} - {{content-for 'body'}} - {{content-for 'test-body'}} + {{content-for "body"}} + {{content-for "test-body"}} + - - {{content-for 'body-footer'}} - {{content-for 'test-body-footer'}} + {{content-for "body-footer"}} + {{content-for "test-body-footer"}}