From d07c93ccb30bf6a6bd6baf51f1340630241c8b05 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Thu, 5 May 2022 16:40:21 -0400 Subject: [PATCH] Upgrade to latest ember-cli@4.3.0 blueprint --- .editorconfig | 1 - .ember-cli | 8 +- .eslintignore | 25 ++++++ .eslintrc.js | 60 ++++++++------- .github/workflows/ci.yml | 76 +++++++++++++++++++ .gitignore | 3 + .npmignore | 57 +++++++++----- .prettierignore | 25 ++++++ .prettierrc.js | 5 ++ .template-lintrc.js | 5 ++ .travis.yml | 60 --------------- CONTRIBUTING.md | 25 ++++++ config/ember-try.js | 70 +++++++++-------- config/environment.js | 7 +- ember-cli-build.js | 11 ++- index.js | 10 +-- package.json | 57 +++++++++----- testem.js | 20 +++-- tests/dummy/app/app.js | 18 ++--- tests/dummy/app/index.html | 1 - tests/dummy/app/resolver.js | 3 - tests/dummy/app/router.js | 16 ++-- tests/dummy/app/templates/components/.gitkeep | 0 tests/dummy/config/ember-cli-update.json | 2 +- tests/dummy/config/environment.js | 10 +-- tests/dummy/config/optional-features.json | 6 ++ tests/dummy/config/targets.js | 16 ++-- tests/helpers/index.js | 42 ++++++++++ tests/index.html | 10 ++- tests/test-helper.js | 9 ++- 30 files changed, 438 insertions(+), 220 deletions(-) create mode 100644 .eslintignore create mode 100644 .github/workflows/ci.yml create mode 100644 .prettierignore create mode 100644 .prettierrc.js create mode 100644 .template-lintrc.js delete mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md delete mode 100644 tests/dummy/app/resolver.js delete mode 100644 tests/dummy/app/templates/components/.gitkeep create mode 100644 tests/dummy/config/optional-features.json create mode 100644 tests/helpers/index.js diff --git a/.editorconfig b/.editorconfig index 219985c..c35a002 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,6 @@ root = true - [*] end_of_line = lf charset = utf-8 diff --git a/.ember-cli b/.ember-cli index ee64cfe..4ccb4bf 100644 --- a/.ember-cli +++ b/.ember-cli @@ -5,5 +5,11 @@ Setting `disableAnalytics` to true will prevent any data from being sent. */ - "disableAnalytics": false + "disableAnalytics": false, + + /** + Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript + rather than JavaScript by default, when a TypeScript version of a given blueprint is available. + */ + "isTypeScriptProject": false } diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..d474a40 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,25 @@ +# unconventional js +/blueprints/*/files/ +/vendor/ + +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ +/node_modules/ + +# misc +/coverage/ +!.* +.*/ +.eslintcache + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/npm-shrinkwrap.json.ember-try +/package.json.ember-try +/package-lock.json.ember-try +/yarn.lock.ember-try diff --git a/.eslintrc.js b/.eslintrc.js index 702f6be..d025472 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,45 +1,53 @@ +'use strict'; + module.exports = { root: true, + parser: 'babel-eslint', parserOptions: { ecmaVersion: 2018, - sourceType: 'module' + sourceType: 'module', + ecmaFeatures: { + legacyDecorators: true, + }, }, - extends: 'eslint:recommended', + plugins: ['ember'], + extends: [ + 'eslint:recommended', + 'plugin:ember/recommended', + 'plugin:prettier/recommended', + ], env: { - browser: true - }, - rules: { + browser: true, }, + rules: {}, overrides: [ // node files { files: [ - '.eslintrc.js', - '.template-lintrc.js', - 'ember-cli-build.js', - 'index.js', - 'testem.js', - 'blueprints/*/index.js', - 'config/**/*.js', - 'tests/dummy/config/**/*.js' - ], - excludedFiles: [ - 'addon/**', - 'addon-test-support/**', - 'app/**', - 'tests/dummy/app/**' + './.eslintrc.js', + './.prettierrc.js', + './.template-lintrc.js', + './ember-cli-build.js', + './index.js', + './testem.js', + './blueprints/*/index.js', + './config/**/*.js', + './tests/dummy/config/**/*.js', ], parserOptions: { - sourceType: 'script' + sourceType: 'script', }, env: { browser: false, - node: true + node: true, }, plugins: ['node'], - rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { - // add your custom rules and overrides for node files here - }) - } - ] + extends: ['plugin:node/recommended'], + }, + { + // test files + files: ['tests/**/*-test.{js,ts}'], + extends: ['plugin:qunit/recommended'], + }, + ], }; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ac4eb72 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,76 @@ +name: CI + +on: + push: + branches: + - main + - master + pull_request: {} + +concurrency: + group: ci-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + test: + name: "Tests" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Install Node + uses: actions/setup-node@v2 + with: + node-version: 12.x + cache: yarn + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Lint + run: yarn lint + - name: Run Tests + run: yarn test:ember + + floating: + name: "Floating Dependencies" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 12.x + cache: yarn + - name: Install Dependencies + run: yarn install --no-lockfile + - name: Run Tests + run: yarn test:ember + + try-scenarios: + name: ${{ matrix.try-scenario }} + runs-on: ubuntu-latest + needs: "test" + + strategy: + fail-fast: false + matrix: + try-scenario: + - ember-lts-3.24 + - ember-lts-3.28 + - ember-release + - ember-beta + - ember-canary + - ember-classic + - embroider-safe + - embroider-optimized + + steps: + - uses: actions/checkout@v2 + - name: Install Node + uses: actions/setup-node@v2 + with: + node-version: 12.x + cache: yarn + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Run Tests + run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }} diff --git a/.gitignore b/.gitignore index 8fa39a6..f90151c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ testem.log .node_modules.ember-try/ bower.json.ember-try package.json.ember-try + +# broccoli-debug +/DEBUG/ diff --git a/.npmignore b/.npmignore index dd6fb8b..2160a9d 100644 --- a/.npmignore +++ b/.npmignore @@ -1,18 +1,41 @@ -/bower_components -/config -/dist -/.git -/tests -/node-tests -/tmp +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ + +# misc +/.bowerrc +/.editorconfig +/.ember-cli +/.env* +/.eslintcache +/.eslintignore +/.eslintrc.js +/.git/ +/.github/ +/.gitignore +/.prettierignore +/.prettierrc.js +/.template-lintrc.js +/.travis.yml +/.watchmanconfig +/bower.json +/config/ember-try.js +/CONTRIBUTING.md +/ember-cli-build.js +/testem.js +/tests/ +/node-tests/ +/yarn-error.log +/yarn.lock **/.gitkeep -.bowerrc -.editorconfig -.ember-cli -.gitignore -.eslintrc.js -.watchmanconfig -.travis.yml -bower.json -ember-cli-build.js -testem.js + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/npm-shrinkwrap.json.ember-try +/package.json.ember-try +/package-lock.json.ember-try +/yarn.lock.ember-try diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..4178fd5 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,25 @@ +# unconventional js +/blueprints/*/files/ +/vendor/ + +# compiled output +/dist/ +/tmp/ + +# dependencies +/bower_components/ +/node_modules/ + +# misc +/coverage/ +!.* +.eslintcache +.lint-todo/ + +# ember-try +/.node_modules.ember-try/ +/bower.json.ember-try +/npm-shrinkwrap.json.ember-try +/package.json.ember-try +/package-lock.json.ember-try +/yarn.lock.ember-try diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..534e6d3 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + singleQuote: true, +}; diff --git a/.template-lintrc.js b/.template-lintrc.js new file mode 100644 index 0000000..f35f61c --- /dev/null +++ b/.template-lintrc.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = { + extends: 'recommended', +}; diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 068c4b4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -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 - - "8" - -sudo: false -dist: trusty - -addons: - chrome: stable - -cache: - yarn: true - -branches: - only: - - master - -before_install: - - true && `base64 --decode <<< ZXhwb3J0IFNBVUNFX1VTRVJOQU1FPXRyZW50bXdpbGxpcwo=` - - true && `base64 --decode <<< ZXhwb3J0IFNBVUNFX0FDQ0VTU19LRVk9MjExZDUxOTAtNWQxYS00YzYzLWFhOGYtMjA1YmIzYzRlMGZmCg==` - - curl -o- -L https://yarnpkg.com/install.sh | bash -s - -install: - - yarn install --frozen-lockfile --non-interactive - -stages: - - test - - additional tests - -jobs: - fail_fast: true - - include: - # runs tests in chrome with current locked deps and linting - - - env: NAME=test # used only to make Travis UI show description - script: - - yarn test:node - - yarn test - - # If that passes: - # - run tests in other browsers - # - run tests without pinned dependencies to catch issues with new versions - - - stage: additional tests - name: test sauce - env: SAUCE_VERSION='4.5.4' - script: - - ember sauce:connect - - yarn test:sauce - - ember sauce:disconnect - - - env: NAME=floating dependencies - install: yarn install --no-lockfile --non-interactive --ignore-engines - script: - - yarn test:node - - yarn test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..fb894bf --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,25 @@ +# How To Contribute + +## Installation + +* `git clone ` +* `cd ember-asset-loader` +* `yarn install` + +## Linting + +* `yarn lint` +* `yarn lint:fix` + +## Running tests + +* `ember test` – Runs the test suite on the current Ember version +* `ember test --server` – Runs the test suite in "watch mode" +* `ember try:each` – Runs the test suite against multiple Ember versions + +## Running the dummy application + +* `ember serve` +* Visit the dummy application at [http://localhost:4200](http://localhost:4200). + +For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/). diff --git a/config/ember-try.js b/config/ember-try.js index c1d83d6..1852784 100644 --- a/config/ember-try.js +++ b/config/ember-try.js @@ -1,74 +1,72 @@ 'use strict'; const getChannelURL = require('ember-source-channel-url'); +const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup'); -module.exports = async function() { +module.exports = async function () { return { useYarn: true, scenarios: [ { - name: 'ember-lts-3.4', + name: 'ember-lts-3.24', npm: { devDependencies: { - 'ember-source': '~3.4.0' - } - } + 'ember-source': '~3.24.3', + }, + }, }, { - name: 'ember-lts-3.8', + name: 'ember-lts-3.28', npm: { devDependencies: { - 'ember-source': '~3.8.0' - } - } + 'ember-source': '~3.28.0', + }, + }, }, { name: 'ember-release', npm: { devDependencies: { - 'ember-source': await getChannelURL('release') - } - } + 'ember-source': await getChannelURL('release'), + }, + }, }, { name: 'ember-beta', npm: { devDependencies: { - 'ember-source': await getChannelURL('beta') - } - } + 'ember-source': await getChannelURL('beta'), + }, + }, }, { name: 'ember-canary', npm: { devDependencies: { - 'ember-source': await getChannelURL('canary') - } - } - }, - // The default `.travis.yml` runs this scenario via `yarn test`, - // not via `ember try`. It's still included here so that running - // `ember try:each` manually or from a customized CI config will run it - // along with all the other scenarios. - { - name: 'ember-default', - npm: { - devDependencies: {} - } + 'ember-source': await getChannelURL('canary'), + }, + }, }, { - name: 'ember-default-with-jquery', + name: 'ember-classic', env: { EMBER_OPTIONAL_FEATURES: JSON.stringify({ - 'jquery-integration': true - }) + 'application-template-wrapper': true, + 'default-async-observers': false, + 'template-only-glimmer-components': false, + }), }, npm: { devDependencies: { - '@ember/jquery': '^0.5.1' - } - } - } - ] + 'ember-source': '~3.28.0', + }, + ember: { + edition: 'classic', + }, + }, + }, + embroiderSafe(), + embroiderOptimized(), + ], }; }; diff --git a/config/environment.js b/config/environment.js index 826bb01..331ab30 100644 --- a/config/environment.js +++ b/config/environment.js @@ -1,6 +1,5 @@ -/* eslint-env node */ 'use strict'; -module.exports = function(/* environment, appConfig */) { - return { }; -} +module.exports = function (/* environment, appConfig */) { + return {}; +}; diff --git a/ember-cli-build.js b/ember-cli-build.js index 1aed934..229de22 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -3,7 +3,7 @@ const EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); -module.exports = function(defaults) { +module.exports = function (defaults) { let app = new EmberAddon(defaults, { 'ember-cli-babel': { // Needed because ember-maybe-import-regenerator uses Promise @@ -18,5 +18,12 @@ module.exports = function(defaults) { behave. You most likely want to be modifying `./index.js` or app's build file */ - return app.toTree(); + const { maybeEmbroider } = require('@embroider/test-setup'); + return maybeEmbroider(app, { + skipBabel: [ + { + package: 'qunit', + }, + ], + }); }; diff --git a/index.js b/index.js index e3b1bbc..599c0d4 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,11 @@ /* eslint-env node */ 'use strict'; -var Funnel = require('broccoli-funnel'); -var findHost = require('./lib/utils/find-host'); +const Funnel = require('broccoli-funnel'); +const findHost = require('./lib/utils/find-host'); module.exports = { - name: 'ember-asset-loader', + name: require('./package').name, /** * If the app has specified `noManifest` to be generated, then we don't @@ -14,8 +14,8 @@ module.exports = { * @override */ treeForApp: function() { - var tree = this._super.treeForApp.apply(this, arguments); - var app = findHost(this); + const tree = this._super.treeForApp.apply(this, arguments); + const app = findHost(this); if (app && app.options && app.options.assetLoader && app.options.assetLoader.noManifest) { tree = new Funnel(tree, { diff --git a/package.json b/package.json index d21a0e2..be43c9f 100644 --- a/package.json +++ b/package.json @@ -13,48 +13,71 @@ }, "repository": "https://github.com/ember-engines/ember-asset-loader", "scripts": { - "build": "ember build", + "build": "ember build --environment=production", + "lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"", + "lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix", + "lint:hbs:fix": "ember-template-lint . --fix", + "lint:js:fix": "eslint . --fix", "start": "ember server", - "test": "ember test", + "test": "npm-run-all lint test:*", + "test:ember": "ember test", + "test:ember-compatibility": "ember try:each", "test:sauce": "ember test --config-file testem.sauce.js --test-port 7000", "test:node": "mocha node-tests", "prepublish": "./bin/install-test-addons.sh" }, "devDependencies": { + "@ember/test-helpers": "^2.6.0", + "@embroider/test-setup": "^1.5.0", + "@glimmer/component": "^1.0.4", + "@glimmer/tracking": "^1.0.4", + "babel-eslint": "^10.1.0", "broccoli-asset-rev": "^3.0.0", "broccoli-test-helper": "^2.0.0", "co": "^4.6.0", - "ember-cli": "~3.12.0", - "ember-cli-dependency-checker": "^3.1.0", - "ember-cli-eslint": "^5.1.0", - "ember-cli-htmlbars": "^3.0.1", - "ember-cli-htmlbars-inline-precompile": "^2.1.0", - "ember-cli-inject-live-reload": "^2.0.1", + "ember-auto-import": "^2.4.1", + "ember-cli": "~4.3.0", + "ember-cli-dependency-checker": "^3.2.0", + "ember-cli-inject-live-reload": "^2.1.0", "ember-cli-qunit": "^4.4.0", "ember-cli-sauce": "^2.2.0", "ember-cli-shims": "^1.1.0", + "ember-cli-terser": "^4.0.2", "ember-disable-prototype-extensions": "^1.1.0", - "ember-export-application-global": "^2.0.0", - "ember-load-initializers": "^2.0.0", - "ember-maybe-import-regenerator": "^0.1.6", - "ember-resolver": "^5.1.3", - "ember-source": "~3.12.0", - "eslint-plugin-node": "^11.0.0", + "ember-export-application-global": "^2.0.1", + "ember-load-initializers": "^2.1.2", + "ember-page-title": "^7.0.0", + "ember-resolver": "^8.0.3", + "ember-source": "~4.3.0", + "ember-template-lint": "^4.3.0", + "eslint": "^7.32.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-qunit": "^7.2.0", "loader.js": "^4.7.0", "mocha": "^6.0.2", - "test-generator-plugin": "link:./tests/dummy/lib/test-generator-plugin" + "npm-run-all": "^4.1.5", + "prettier": "^2.6.1", + "qunit": "^2.18.0", + "test-generator-plugin": "link:./tests/dummy/lib/test-generator-plugin", + "webpack": "^5.70.0" }, "dependencies": { "broccoli-caching-writer": "^3.0.3", "broccoli-funnel": "^2.0.2", "broccoli-merge-trees": "^3.0.2", - "ember-cli-babel": "^7.7.3", + "ember-cli-babel": "^7.26.11", + "ember-cli-htmlbars": "^6.0.1", "fs-extra": "^7.0.1", "object-assign": "^4.1.0", "walk-sync": "^1.1.3" }, "engines": { - "node": "8.* || >= 10.*" + "node": "12.* || 14.* || >= 16" + }, + "ember": { + "edition": "octane" }, "ember-addon": { "configPath": "tests/dummy/config" diff --git a/testem.js b/testem.js index 5e68fc1..1f6c614 100644 --- a/testem.js +++ b/testem.js @@ -1,13 +1,11 @@ -/* eslint-env node */ +'use strict'; + module.exports = { test_page: 'tests/index.html?hidepassed', disable_watching: true, - launch_in_ci: [ - 'Chrome' - ], - launch_in_dev: [ - 'Chrome' - ], + launch_in_ci: ['Chrome'], + launch_in_dev: ['Chrome'], + browser_start_timeout: 120, browser_args: { Chrome: { mode: 'ci', @@ -19,8 +17,8 @@ module.exports = { '--disable-software-rasterizer', '--mute-audio', '--remote-debugging-port=0', - '--window-size=1440,900' - ].filter(Boolean) - } - } + '--window-size=1440,900', + ].filter(Boolean), + }, + }, }; diff --git a/tests/dummy/app/app.js b/tests/dummy/app/app.js index c15f935..523bad6 100644 --- a/tests/dummy/app/app.js +++ b/tests/dummy/app/app.js @@ -1,14 +1,12 @@ -import Ember from 'ember'; -import Resolver from './resolver'; +import Application from '@ember/application'; +import Resolver from 'ember-resolver'; import loadInitializers from 'ember-load-initializers'; -import config from './config/environment'; +import config from 'dummy/config/environment'; -const App = Ember.Application.extend({ - modulePrefix: config.modulePrefix, - podModulePrefix: config.podModulePrefix, - Resolver -}); +export default class App extends Application { + modulePrefix = config.modulePrefix; + podModulePrefix = config.podModulePrefix; + Resolver = Resolver; +} loadInitializers(App, config.modulePrefix); - -export default App; diff --git a/tests/dummy/app/index.html b/tests/dummy/app/index.html index 5120bd7..b34ca1b 100644 --- a/tests/dummy/app/index.html +++ b/tests/dummy/app/index.html @@ -2,7 +2,6 @@ - Dummy diff --git a/tests/dummy/app/resolver.js b/tests/dummy/app/resolver.js deleted file mode 100644 index 2fb563d..0000000 --- a/tests/dummy/app/resolver.js +++ /dev/null @@ -1,3 +0,0 @@ -import Resolver from 'ember-resolver'; - -export default Resolver; diff --git a/tests/dummy/app/router.js b/tests/dummy/app/router.js index 080af9f..b3621ce 100644 --- a/tests/dummy/app/router.js +++ b/tests/dummy/app/router.js @@ -1,13 +1,11 @@ -import Ember from 'ember'; -import config from './config/environment'; +import EmberRouter from '@ember/routing/router'; +import config from 'dummy/config/environment'; -const Router = Ember.Router.extend({ - location: config.locationType, - rootURL: config.rootURL -}); +export default class Router extends EmberRouter { + location = config.locationType; + rootURL = config.rootURL; +} -Router.map(function() { +Router.map(function () { this.route('asset-error'); }); - -export default Router; diff --git a/tests/dummy/app/templates/components/.gitkeep b/tests/dummy/app/templates/components/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/tests/dummy/config/ember-cli-update.json b/tests/dummy/config/ember-cli-update.json index d0f90ce..209db4d 100644 --- a/tests/dummy/config/ember-cli-update.json +++ b/tests/dummy/config/ember-cli-update.json @@ -3,7 +3,7 @@ "packages": [ { "name": "ember-cli", - "version": "3.12.0", + "version": "4.3.0", "blueprints": [ { "name": "addon", diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index d511851..256fe26 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -1,12 +1,12 @@ /* eslint-env node */ 'use strict'; -module.exports = function(environment) { +module.exports = function (environment) { let ENV = { modulePrefix: 'dummy', environment, rootURL: '/', - locationType: 'auto', + locationType: 'history', EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build @@ -14,14 +14,14 @@ module.exports = function(environment) { }, EXTEND_PROTOTYPES: { // Prevent Ember Data from overriding Date.parse. - Date: false - } + Date: false, + }, }, APP: { // Here you can pass flags/options to your application instance // when it is created - } + }, }; if (environment === 'development') { diff --git a/tests/dummy/config/optional-features.json b/tests/dummy/config/optional-features.json new file mode 100644 index 0000000..b26286e --- /dev/null +++ b/tests/dummy/config/optional-features.json @@ -0,0 +1,6 @@ +{ + "application-template-wrapper": false, + "default-async-observers": true, + "jquery-integration": false, + "template-only-glimmer-components": true +} diff --git a/tests/dummy/config/targets.js b/tests/dummy/config/targets.js index df7664c..1e48e05 100644 --- a/tests/dummy/config/targets.js +++ b/tests/dummy/config/targets.js @@ -1,9 +1,11 @@ -/* eslint-env node */ +'use strict'; + +const browsers = [ + 'last 1 Chrome versions', + 'last 1 Firefox versions', + 'last 1 Safari versions', +]; + module.exports = { - browsers: [ - 'ie 9', - 'last 1 Chrome versions', - 'last 1 Firefox versions', - 'last 1 Safari versions' - ] + browsers, }; diff --git a/tests/helpers/index.js b/tests/helpers/index.js new file mode 100644 index 0000000..7f70de8 --- /dev/null +++ b/tests/helpers/index.js @@ -0,0 +1,42 @@ +import { + setupApplicationTest as upstreamSetupApplicationTest, + setupRenderingTest as upstreamSetupRenderingTest, + setupTest as upstreamSetupTest, +} from 'ember-qunit'; + +// This file exists to provide wrappers around ember-qunit's / ember-mocha's +// test setup functions. This way, you can easily extend the setup that is +// needed per test type. + +function setupApplicationTest(hooks, options) { + upstreamSetupApplicationTest(hooks, options); + + // Additional setup for application tests can be done here. + // + // For example, if you need an authenticated session for each + // application test, you could do: + // + // hooks.beforeEach(async function () { + // await authenticateSession(); // ember-simple-auth + // }); + // + // This is also a good place to call test setup functions coming + // from other addons: + // + // setupIntl(hooks); // ember-intl + // setupMirage(hooks); // ember-cli-mirage +} + +function setupRenderingTest(hooks, options) { + upstreamSetupRenderingTest(hooks, options); + + // Additional setup for rendering tests can be done here. +} + +function setupTest(hooks, options) { + upstreamSetupTest(hooks, options); + + // Additional setup for unit tests can be done here. +} + +export { setupApplicationTest, setupRenderingTest, setupTest }; diff --git a/tests/index.html b/tests/index.html index c411e79..8441663 100644 --- a/tests/index.html +++ b/tests/index.html @@ -2,7 +2,6 @@ - Dummy Tests @@ -21,7 +20,14 @@ {{content-for "body"}} {{content-for "test-body"}} - +
+
+
+
+
+
+ + diff --git a/tests/test-helper.js b/tests/test-helper.js index 7827a6a..4efd6e5 100644 --- a/tests/test-helper.js +++ b/tests/test-helper.js @@ -1,7 +1,12 @@ -import Application from '../app'; -import config from '../config/environment'; +import Application from 'dummy/app'; +import config from 'dummy/config/environment'; +import * as QUnit from 'qunit'; import { setApplication } from '@ember/test-helpers'; +import { setup } from 'qunit-dom'; import { start } from 'ember-qunit'; setApplication(Application.create(config.APP)); + +setup(QUnit.assert); + start();