diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 959e169..0000000 --- a/.bowerrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "directory": "bower_components", - "analytics": false -} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..2873e2f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,13 @@ +module.exports = { + root: true, + parserOptions: { + ecmaVersion: 2017, + sourceType: 'module' + }, + extends: 'eslint:recommended', + env: { + browser: true + }, + rules: { + } +}; diff --git a/.gitignore b/.gitignore index 86fceae..8fa39a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. +# See https://help.github.com/ignore-files/ for more about ignoring files. # compiled output /dist @@ -13,5 +13,11 @@ /connect.lock /coverage/* /libpeerconnection.log -npm-debug.log +npm-debug.log* +yarn-error.log testem.log + +# ember-try +.node_modules.ember-try/ +bower.json.ember-try +package.json.ember-try diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index d421faa..0000000 --- a/.jshintrc +++ /dev/null @@ -1,32 +0,0 @@ -{ - "predef": [ - "document", - "window", - "-Promise" - ], - "browser": true, - "boss": true, - "curly": true, - "debug": false, - "devel": true, - "eqeqeq": true, - "evil": true, - "forin": false, - "immed": false, - "laxbreak": false, - "newcap": true, - "noarg": true, - "noempty": false, - "nonew": false, - "nomen": false, - "onevar": false, - "plusplus": false, - "regexp": false, - "undef": true, - "sub": true, - "strict": false, - "white": false, - "eqnull": true, - "esversion": 6, - "unused": true -} diff --git a/.npmignore b/.npmignore index fa8b147..889b2bf 100644 --- a/.npmignore +++ b/.npmignore @@ -8,7 +8,7 @@ .editorconfig .ember-cli .gitignore -.jshintrc +.eslintrc.js .watchmanconfig .travis.yml bower.json diff --git a/.travis.yml b/.travis.yml index 9899643..6673ebb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,19 @@ --- language: node_js node_js: + # we recommend testing addons with the same minimum supported node version as Ember CLI + # so that your addon works for all apps - "4" sudo: false +dist: trusty + +addons: + chrome: stable cache: directories: - - node_modules + - $HOME/.npm env: - EMBER_TRY_SCENARIO=ember-1.10 @@ -20,6 +26,8 @@ env: - EMBER_TRY_SCENARIO=ember-2.3 - EMBER_TRY_SCENARIO=ember-2.4 - EMBER_TRY_SCENARIO=ember-2.8 + - EMBER_TRY_SCENARIO=ember-2.12 + - EMBER_TRY_SCENARIO=ember-2.16 - EMBER_TRY_SCENARIO=ember-release - EMBER_TRY_SCENARIO=ember-beta - EMBER_TRY_SCENARIO=ember-canary @@ -30,15 +38,11 @@ matrix: - env: EMBER_TRY_SCENARIO=ember-canary before_install: - - "npm config set spin false" - - "npm install -g npm@^2" - -install: - - npm install -g bower - - npm install - - bower install + - npm config set spin false + - npm install -g npm@4 + - npm --version script: # Usually, it's ok to finish the test scenario without reverting # to the addon's original dependency state, skipping "cleanup". - - ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup + - node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup diff --git a/LICENSE.md b/LICENSE.md index 02000b5..0d5e3ef 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 +Copyright (c) 2017 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index ecf9e97..5014040 100644 --- a/README.md +++ b/README.md @@ -68,16 +68,15 @@ the list of supported Ember versions at the time of authoring was: * `git clone` this repository * `npm install` -* `bower install` ### Running -* `ember server` -* Visit your app at http://localhost:4200. +* `ember serve` +* Visit your app at [http://localhost:4200](http://localhost:4200). ### Running Tests -* `npm test` (Runs `ember try:testall` to test your addon against multiple Ember versions) +* `npm test` (Runs `ember try:each` to test your addon against multiple Ember versions) * `ember test` * `ember test --server` @@ -85,4 +84,4 @@ the list of supported Ember versions at the time of authoring was: * `ember build` -For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/). +For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/). diff --git a/bower.json b/bower.json deleted file mode 100644 index bdd042b..0000000 --- a/bower.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "ember-getowner-polyfill", - "dependencies": { - "ember": "~2.7.0-beta.1", - "ember-cli-shims": "0.1.1", - "ember-qunit-notifications": "0.1.0" - } -} diff --git a/config/ember-try.js b/config/ember-try.js index 2a870c9..7877215 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -8,6 +8,11 @@ module.exports = { dependencies: { "ember": "~1.10.0" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -16,6 +21,11 @@ module.exports = { dependencies: { "ember": "~1.11.3" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -24,6 +34,11 @@ module.exports = { dependencies: { "ember": "~1.12.1" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -32,6 +47,11 @@ module.exports = { dependencies: { "ember": "~1.13.8" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -40,6 +60,11 @@ module.exports = { dependencies: { "ember": "~2.0.0" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -48,6 +73,11 @@ module.exports = { dependencies: { "ember": "~2.1.0" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -56,6 +86,11 @@ module.exports = { dependencies: { "ember": "~2.2.0" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -64,6 +99,11 @@ module.exports = { dependencies: { "ember": "~2.3.0" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -72,6 +112,11 @@ module.exports = { dependencies: { "ember": "~2.4.0" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -80,13 +125,26 @@ module.exports = { dependencies: { "ember": "~2.8.0" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { name: 'ember-2.12', - bower: { - dependencies: { - "ember": "~2.12.0" + npm: { + devDependencies: { + "ember-source": "~2.12.0" + } + } + }, + { + name: 'ember-2.16', + npm: { + devDependencies: { + "ember-source": "~2.16.0" } } }, @@ -99,6 +157,11 @@ module.exports = { resolutions: { "ember": "release" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -110,6 +173,11 @@ module.exports = { resolutions: { "ember": "beta" } + }, + npm: { + devDependencies: { + "ember-source": null + } } }, { @@ -121,6 +189,11 @@ module.exports = { resolutions: { "ember": "canary" } + }, + npm: { + devDependencies: { + "ember-source": null + } } } ] diff --git a/config/environment.js b/config/environment.js index 28a787b..012a412 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,4 +1,4 @@ -/*jshint node:true*/ +/* eslint-env node */ 'use strict'; module.exports = function(/* environment, appConfig */) { diff --git a/ember-cli-build.js b/ember-cli-build.js index 4ac3913..156e23f 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -1,9 +1,10 @@ -/*jshint node:true*/ -/* global require, module */ -var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); +/* eslint-env node */ +'use strict'; + +const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); module.exports = function(defaults) { - var app = new EmberAddon(defaults, { + let app = new EmberAddon(defaults, { // Add options here }); diff --git a/index.js b/index.js index 62a0365..8debce0 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -/* jshint node: true */ +/* eslint-env node */ 'use strict'; var VersionChecker = require('ember-cli-version-checker'); diff --git a/package.json b/package.json index b721c52..b39655e 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,8 @@ "keywords": [ "ember-addon" ], - "homepage": "https://github.com/rwjblue/ember-getowner-polyfill#readme", - "bugs": { - "url": "https://github.com/rwjblue/ember-getowner-polyfill/issues" - }, "license": "MIT", "author": "Robert Jackson ", - "main": "index.js", "directories": { "test": "tests" }, @@ -29,32 +24,36 @@ "ember-factory-for-polyfill": "^1.3.1" }, "devDependencies": { - "broccoli-asset-rev": "^2.4.2", - "ember-ajax": "^2.0.1", - "ember-cli": "^2.7.0", - "ember-cli-app-version": "^1.0.0", + "broccoli-asset-rev": "^2.4.5", + "ember-ajax": "^3.0.0", + "ember-cli": "~2.16.2", "ember-cli-babel": "^6.6.0", "ember-cli-content-security-policy": "0.5.0", - "ember-cli-dependency-checker": "^1.2.0", + "ember-cli-dependency-checker": "^2.0.0", + "ember-cli-eslint": "^4.0.0", "ember-cli-htmlbars": "^2.0.1", "ember-cli-htmlbars-inline-precompile": "^1.0.2", - "ember-cli-inject-live-reload": "^1.4.0", - "ember-cli-jshint": "^1.0.0", - "ember-cli-qunit": "^3.1.0", - "ember-cli-release": "^0.2.9", + "ember-cli-inject-live-reload": "^1.4.1", + "ember-cli-qunit": "^4.0.0", + "ember-cli-shims": "^1.1.0", "ember-cli-sri": "^2.1.0", - "ember-cli-test-loader": "^1.1.0", - "ember-cli-uglify": "^1.2.0", + "ember-cli-uglify": "^2.0.0", "ember-debug-handlers-polyfill": "^1.0.3", - "ember-disable-prototype-extensions": "^1.1.0", - "ember-export-application-global": "^1.0.5", - "ember-load-initializers": "^0.5.1", - "ember-resolver": "^2.0.3", - "loader.js": "^4.0.1" + "ember-disable-prototype-extensions": "^1.1.2", + "ember-export-application-global": "^2.0.0", + "ember-load-initializers": "^1.0.0", + "ember-resolver": "^4.0.0", + "ember-source": "~2.16.0", + "loader.js": "^4.2.3" }, "engines": { - "node": ">= 4" + "node": "^4.5 || 6.* || >= 7.*" }, + "homepage": "https://github.com/rwjblue/ember-getowner-polyfill#readme", + "bugs": { + "url": "https://github.com/rwjblue/ember-getowner-polyfill/issues" + }, + "main": "index.js", "ember-addon": { "configPath": "tests/dummy/config", "before": "ember-cli-shims", diff --git a/testem.js b/testem.js index 26044b2..e79c22e 100644 --- a/testem.js +++ b/testem.js @@ -1,13 +1,22 @@ -/*jshint node:true*/ +/* eslint-env node */ module.exports = { - "framework": "qunit", - "test_page": "tests/index.html?hidepassed", - "disable_watching": true, - "launch_in_ci": [ - "PhantomJS" + test_page: 'tests/index.html?hidepassed', + disable_watching: true, + launch_in_ci: [ + 'Chrome' ], - "launch_in_dev": [ - "PhantomJS", - "Chrome" - ] + launch_in_dev: [ + 'Chrome' + ], + browser_args: { + Chrome: { + mode: 'ci', + args: [ + '--disable-gpu', + '--headless', + '--remote-debugging-port=9222', + '--window-size=1440,900' + ] + }, + } }; diff --git a/tests/.eslintrc.js b/tests/.eslintrc.js new file mode 100644 index 0000000..fbf2555 --- /dev/null +++ b/tests/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + env: { + embertest: true + } +}; diff --git a/tests/.jshintrc b/tests/.jshintrc deleted file mode 100644 index d2bd113..0000000 --- a/tests/.jshintrc +++ /dev/null @@ -1,52 +0,0 @@ -{ - "predef": [ - "document", - "window", - "location", - "setTimeout", - "$", - "-Promise", - "define", - "console", - "visit", - "exists", - "fillIn", - "click", - "keyEvent", - "triggerEvent", - "find", - "findWithAssert", - "wait", - "DS", - "andThen", - "currentURL", - "currentPath", - "currentRouteName" - ], - "node": false, - "browser": false, - "boss": true, - "curly": true, - "debug": false, - "devel": false, - "eqeqeq": true, - "evil": true, - "forin": false, - "immed": false, - "laxbreak": false, - "newcap": true, - "noarg": true, - "noempty": false, - "nonew": false, - "nomen": false, - "onevar": false, - "plusplus": false, - "regexp": false, - "undef": true, - "sub": true, - "strict": false, - "white": false, - "eqnull": true, - "esversion": 6, - "unused": true -} diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index 831ad61..b3b2bd6 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -1,13 +1,9 @@ -import Ember from 'ember'; +import Application from '@ember/application'; import Resolver from './resolver'; import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; -let App; - -Ember.MODEL_FACTORY_INJECTIONS = true; - -App = Ember.Application.extend({ +const App = Application.extend({ modulePrefix: config.modulePrefix, podModulePrefix: config.podModulePrefix, Resolver diff --git a/tests/dummy/app/index.html b/tests/dummy/app/index.html index 5120bd7..61400b2 100644 --- a/tests/dummy/app/index.html +++ b/tests/dummy/app/index.html @@ -9,8 +9,8 @@ {{content-for "head"}} - - + + {{content-for "head-footer"}} diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index cdc2578..d0bb009 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -1,7 +1,7 @@ -import Ember from 'ember'; +import EmberRouter from '@ember/routing/router'; import config from './config/environment'; -const Router = Ember.Router.extend({ +const Router = EmberRouter.extend({ location: config.locationType, rootURL: config.rootURL }); diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index 2529939..1d54915 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,15 +1,20 @@ -/* jshint node: true */ +/* eslint-env node */ +'use strict'; module.exports = function(environment) { - var ENV = { + let ENV = { modulePrefix: 'dummy', - environment: environment, + environment, rootURL: '/', locationType: 'auto', EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. 'with-controller': true + }, + EXTEND_PROTOTYPES: { + // Prevent Ember Data from overriding Date.parse. + Date: false } }, @@ -39,7 +44,7 @@ module.exports = function(environment) { } if (environment === 'production') { - + // here you can enable a production-specific feature } return ENV; diff --git a/tests/dummy/config/targets.js b/tests/dummy/config/targets.js new file mode 100644 index 0000000..df7664c --- /dev/null +++ b/tests/dummy/config/targets.js @@ -0,0 +1,9 @@ +/* eslint-env node */ +module.exports = { + browsers: [ + 'ie 9', + 'last 1 Chrome versions', + 'last 1 Firefox versions', + 'last 1 Safari versions' + ] +}; diff --git a/tests/helpers/destroy-app.js b/tests/helpers/destroy-app.js index c3d4d1a..e7f983b 100644 --- a/tests/helpers/destroy-app.js +++ b/tests/helpers/destroy-app.js @@ -1,5 +1,5 @@ -import Ember from 'ember'; +import { run } from '@ember/runloop'; export default function destroyApp(application) { - Ember.run(application, 'destroy'); + run(application, 'destroy'); } diff --git a/tests/helpers/module-for-acceptance.js b/tests/helpers/module-for-acceptance.js index 76996fd..90a93ba 100644 --- a/tests/helpers/module-for-acceptance.js +++ b/tests/helpers/module-for-acceptance.js @@ -1,10 +1,8 @@ import { module } from 'qunit'; -import Ember from 'ember'; +import { resolve } from 'rsvp'; import startApp from '../helpers/start-app'; import destroyApp from '../helpers/destroy-app'; -const { RSVP: { Promise } } = Ember; - export default function(name, options = {}) { module(name, { beforeEach() { @@ -17,7 +15,7 @@ export default function(name, options = {}) { afterEach() { let afterEach = options.afterEach && options.afterEach.apply(this, arguments); - return Promise.resolve(afterEach).then(() => destroyApp(this.application)); + return resolve(afterEach).then(() => destroyApp(this.application)); } }); } diff --git a/tests/helpers/start-app.js b/tests/helpers/start-app.js index e098f1d..681aa01 100644 --- a/tests/helpers/start-app.js +++ b/tests/helpers/start-app.js @@ -1,18 +1,16 @@ -import Ember from 'ember'; import Application from '../../app'; import config from '../../config/environment'; +import { merge } from '@ember/polyfills'; +import { run } from '@ember/runloop'; export default function startApp(attrs) { - let application; + let attributes = merge({}, config.APP); + attributes = merge(attributes, attrs); // use defaults, but you can override; - let attributes = Ember.merge({}, config.APP); - attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; - - Ember.run(() => { - application = Application.create(attributes); + return run(() => { + let application = Application.create(attributes); application.setupForTesting(); application.injectTestHelpers(); + return application; }); - - return application; } diff --git a/tests/index.html b/tests/index.html index f7ff652..5209b85 100644 --- a/tests/index.html +++ b/tests/index.html @@ -21,7 +21,7 @@ {{content-for "body"}} {{content-for "test-body"}} - + diff --git a/tests/test-helper.js b/tests/test-helper.js index 6762edf..4d09bd7 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -4,8 +4,7 @@ import resolver from './helpers/resolver'; import { setResolver } from 'ember-qunit'; - -setResolver(resolver); +import { start } from 'ember-cli-qunit'; let deprecations; Ember.Debug.registerDeprecationHandler((message, options, next) => { @@ -30,3 +29,6 @@ QUnit.assert.deprecations = function(callback, expectedDeprecations) { deprecations = originalDeprecations; }; + +setResolver(resolver); +start();