Skip to content

Commit

Permalink
Add test apps (#1359)
Browse files Browse the repository at this point in the history
Use a nested sample app for build-time testing
  • Loading branch information
samselikoff committed Jul 29, 2018
1 parent db07376 commit e611e4d
Show file tree
Hide file tree
Showing 51 changed files with 13,193 additions and 238 deletions.
26 changes: 7 additions & 19 deletions .eslintrc.js
@@ -1,9 +1,13 @@
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
},
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember-suave/recommended'
Expand Down Expand Up @@ -36,7 +40,8 @@ module.exports = {
'testem.js',
'ember-cli-build.js',
'config/**/*.js',
'tests/dummy/config/**/*.js'
'tests/dummy/config/**/*.js',
'fastboot-tests/**/*.js'
],
excludedFiles: [
'app/**',
Expand All @@ -45,7 +50,7 @@ module.exports = {
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015
ecmaVersion: 2018
},
env: {
browser: false,
Expand All @@ -65,22 +70,5 @@ module.exports = {
embertest: true
}
},

// node test files
{
files: [
'fastboot-tests/**/*.js',
'node-tests/**/*.js'
],
rules: {
'prefer-template': 0
},
globals: {
require: true,
describe: true,
afterEach: true,
it: true
}
}
]
};
2 changes: 2 additions & 0 deletions .npmignore
Expand Up @@ -23,3 +23,5 @@ package.json.ember-try
/.sass-cache
/jekyll-tmp
*.md

/test-apps
76 changes: 48 additions & 28 deletions .travis.yml
@@ -1,9 +1,7 @@
---
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"
- "8"

sudo: false
dist: trusty
Expand All @@ -18,36 +16,58 @@ env:
global:
# See https://git.io/vdao3 for details.
- JOBS=1
matrix:
# we recommend new addons test the current and previous LTS
# as well as latest stable release (bonus points to beta/canary)
- EMBER_TRY_SCENARIO=ember-1.13
- EMBER_TRY_SCENARIO=ember-lts-2.4
- EMBER_TRY_SCENARIO=ember-lts-2.8
- EMBER_TRY_SCENARIO=ember-lts-2.12
- EMBER_TRY_SCENARIO=ember-lts-2.16
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- EMBER_TRY_SCENARIO=ember-default
- EMBER_TRY_SCENARIO=fastboot-tests
- EMBER_TRY_SCENARIO=node-tests

matrix:
fast_finish: true
allow_failures:
- env: EMBER_TRY_SCENARIO=ember-canary

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
- if [[ $(npm -v | cut -d '.' -f 1) -lt 3 ]]; then npm i -g npm@^3; fi

install:
- yarn install --no-lockfile --non-interactive

script:
- npm run lint:js
- yarn lint:js
# Usually, it's ok to finish the test scenario without reverting
# to the addon's original dependency state, skipping "cleanup".
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup

notifications:
email: false

stages:
- locked dependencies

jobs:
fail_fast: true

include:
- stage: locked dependencies
env: NAME=browser tests
install: yarn install
script: yarn test:browser
- env: NAME=node tests
install: yarn install
script: yarn test:node

- stage: floating dependencies
env: NAME=browser tests
script: yarn test:browser
- env: NAME=node tests
script: yarn test:node

- stage: versioned tests
env: EMBER_TRY_SCENARIO=ember-lts-2.4
script: yarn test:browser
- env: EMBER_TRY_SCENARIO=ember-lts-2.8
script: yarn test:browser
- env: EMBER_TRY_SCENARIO=ember-lts-2.12
script: yarn test:browser
- env: EMBER_TRY_SCENARIO=ember-lts-2.16
script: yarn test:browser
- env: EMBER_TRY_SCENARIO=ember-release
script: yarn test:browser
- env: EMBER_TRY_SCENARIO=ember-beta
script: yarn test:browser
- env: EMBER_TRY_SCENARIO=ember-canary
script: yarn test:browser
- env: EMBER_TRY_SCENARIO=ember-default
script: yarn test:browser

allow_failures:
- env: EMBER_TRY_SCENARIO=ember-beta
- env: EMBER_TRY_SCENARIO=ember-canary
1 change: 0 additions & 1 deletion fastboot-tests/fixtures/fastboot/app/templates/index.hbs

This file was deleted.

24 changes: 0 additions & 24 deletions fastboot-tests/index-test.js

This file was deleted.

68 changes: 0 additions & 68 deletions node-tests/addon-tree-test.js

This file was deleted.

55 changes: 0 additions & 55 deletions node-tests/import-files-test.js

This file was deleted.

21 changes: 15 additions & 6 deletions package.json
Expand Up @@ -27,10 +27,11 @@
"build": "ember build",
"lint:js": "eslint ./*.js addon addon-test-support app config lib server test-support tests",
"start": "ember serve",
"test": "ember test",
"test": "./scripts/test.sh",
"test:all": "ember try:each",
"test:fastboot": "ember fastboot:test",
"test:node": "mocha node-tests/**/*-test.js"
"test:browser": "ember test --test-port=0",
"test:node": "cd test-apps/basic-app && yarn test:fastboot",
"prepare": "./scripts/link.sh"
},
"dependencies": {
"broccoli-funnel": "^1.0.2",
Expand All @@ -45,18 +46,22 @@
"ember-lodash": "^4.17.3",
"fake-xml-http-request": "^1.4.0",
"faker": "^3.0.0",
"jsdom": "^11.12.0",
"pretender": "^1.6.1",
"route-recognizer": "^0.2.3"
},
"devDependencies": {
"active-model-adapter": "^2.0.3",
"babel-eslint": "^8.2.6",
"broccoli-asset-rev": "^2.4.5",
"broccoli-test-helper": "^1.3.0",
"chai": "^4.1.0",
"ember-ajax": "^3.0.0",
"ember-cli": "~2.18.2",
"ember-cli-app-version": "^2.0.0",
"ember-cli-dependency-checker": "^2.0.0",
"ember-cli-eslint": "^4.2.1",
"ember-cli-fastboot": "^1.1.4-beta.1",
"ember-cli-htmlbars": "^2.0.1",
"ember-cli-htmlbars-inline-precompile": "^1.0.0",
"ember-cli-inject-live-reload": "^1.4.1",
Expand All @@ -74,15 +79,19 @@
"ember-source": "~2.18.0",
"eslint-plugin-ember": "^5.0.0",
"eslint-plugin-ember-suave": "^1.0.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-node": "^6.0.1",
"fastboot": "^1.2.0",
"loader.js": "^4.2.3",
"mocha": "^3.4.2",
"qunit-dom": "^0.5.0"
},
"engines": {
"node": "^4.5 || 6.* || >= 7.*"
"node": "6.* || >= 7.*"
},
"ember-addon": {
"configPath": "tests/dummy/config"
"configPath": "tests/dummy/config",
"before": [
"ember-cli-babel"
]
}
}
22 changes: 22 additions & 0 deletions scripts/link.sh
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

# Copied from https://github.com/ef4/ember-auto-import/blob/9e48e9ec9639ce05ca2a2688581ea41fdd627c5c/scripts/link-them.sh

# All packages get a node_modules directory and a .bin link
for package in "basic-app"; do
mkdir -p ./test-apps/$package/node_modules
pushd ./test-apps/$package/node_modules > /dev/null
rm -rf .bin
ln -s ../../../node_modules/.bin .bin
popd > /dev/null
done

# These packages get to depend on ember-cli-mirage
for package in "basic-app"; do
pushd ./test-apps/$package/node_modules > /dev/null
rm -rf ./ember-cli-mirage
ln -s ../../.. ./ember-cli-mirage
popd > /dev/null
done

0 comments on commit e611e4d

Please sign in to comment.