Skip to content

Commit

Permalink
add test (basically, a default app built’s tests run even post uglifi…
Browse files Browse the repository at this point in the history
…cation)
  • Loading branch information
stefanpenner committed Feb 20, 2018
1 parent fb1da04 commit 791f419
Show file tree
Hide file tree
Showing 27 changed files with 5,947 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
@@ -0,0 +1,20 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false

[*.{diff,md}]
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions .ember-cli
@@ -0,0 +1,9 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}
10 changes: 8 additions & 2 deletions .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
Expand All @@ -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
21 changes: 21 additions & 0 deletions .npmignore
@@ -0,0 +1,21 @@
/bower_components
/config/ember-try.js
/dist
/tests
/tmp
**/.gitkeep
.bowerrc
.editorconfig
.ember-cli
.eslintrc.js
.gitignore
.watchmanconfig
.travis.yml
bower.json
ember-cli-build.js
testem.js

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
47 changes: 47 additions & 0 deletions .travis.yml
@@ -0,0 +1,47 @@
---
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:
yarn: true

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-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

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

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

script:
- 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
3 changes: 3 additions & 0 deletions .watchmanconfig
@@ -0,0 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
}
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -4,6 +4,7 @@ ember-cli-uglify

[![npm](https://img.shields.io/npm/v/ember-cli-uglify.svg)](https://www.npmjs.com/package/ember-cli-uglify)
[![Build Status](https://travis-ci.org/ember-cli/ember-cli-uglify.svg?branch=master)](https://travis-ci.org/ember-cli/ember-cli-uglify)
[![Build status](https://ci.appveyor.com/api/projects/status/xbx40pk5b4ykawjh/branch/master?svg=true)](https://ci.appveyor.com/project/embercli/ember-cli-uglify/branch/master)

[UglifyJS](https://github.com/mishoo/UglifyJS2) for [Ember.js](http://emberjs.com/).

Expand Down
39 changes: 39 additions & 0 deletions appveyor.yml
@@ -0,0 +1,39 @@
# https://www.appveyor.com/docs/appveyor-yml/

# Test against these versions of Node.js.
environment:
MOCHA_REPORTER: "mocha-appveyor-reporter"
matrix:
- nodejs_version: "4"
- nodejs_version: "6"
- nodejs_version: "8"
- nodejs_version: "9"

branches:
only:
- master
- beta
- release

# Install scripts. (runs after repo cloning)
install:
- ps: Install-Product node $env:nodejs_version
- appveyor-retry npm i -g npm@^4
- appveyor-retry yarn
- appveyor-retry yarn add mocha-appveyor-reporter # must be installed locally.

cache:
- '%LOCALAPPDATA%\Yarn'
- '%APPDATA%\Roaming\bower'

# Post-install test scripts.
test_script:
# Output useful info for debugging.
- git rev-parse HEAD
- cmd: yarn run test:all

# Don't actually build.
build: off

# Set build version format here instead of in the admin panel.
version: "{build}"
75 changes: 75 additions & 0 deletions config/ember-try.js
@@ -0,0 +1,75 @@
module.exports = {
useYarn: true,
scenarios: [
{
name: 'ember-lts-2.12',
npm: {
devDependencies: {
'ember-source': '~2.12.0'
}
}
},
{
name: 'ember-lts-2.16',
npm: {
devDependencies: {
'ember-source': '~2.16.0'
}
}
},
{
name: 'ember-release',
bower: {
dependencies: {
'ember': 'components/ember#release'
},
resolutions: {
'ember': 'release'
}
},
npm: {
devDependencies: {
'ember-source': null
}
}
},
{
name: 'ember-beta',
bower: {
dependencies: {
'ember': 'components/ember#beta'
},
resolutions: {
'ember': 'beta'
}
},
npm: {
devDependencies: {
'ember-source': null
}
}
},
{
name: 'ember-canary',
bower: {
dependencies: {
'ember': 'components/ember#canary'
},
resolutions: {
'ember': 'canary'
}
},
npm: {
devDependencies: {
'ember-source': null
}
}
},
{
name: 'ember-default',
npm: {
devDependencies: {}
}
}
]
};
18 changes: 18 additions & 0 deletions ember-cli-build.js
@@ -0,0 +1,18 @@
'use strict';

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
let app = new EmberAddon(defaults, {
// Add options here
});

/*
This build file specifies the options for the dummy test app of this
addon, located in `/tests/dummy`
This build file does *not* influence how the addon or the app using it
behave. You most likely want to be modifying `./index.js` or app's build file
*/

return app.toTree();
};
15 changes: 14 additions & 1 deletion package.json
Expand Up @@ -18,10 +18,12 @@
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember test"
"test": "ember test -e production",
"test:all": "ember try:each -- ember test -e production"
},
"dependencies": {
"broccoli-uglify-sourcemap": "^2.0.0",
"ember-load-initializers": "^1.0.0",
"lodash.defaultsdeep": "^4.6.0"
},
"engines": {
Expand All @@ -39,5 +41,16 @@
},
"ember-addon": {
"before": "broccoli-asset-rev"
},
"devDependencies": {
"ember-cli": "^3.0.0",
"ember-cli-babel": "^6.11.0",
"ember-cli-htmlbars": "^2.0.3",
"ember-cli-qunit": "^4.3.2",
"ember-cli-uglfiy": "./",
"ember-resolver": "^4.5.0",
"ember-source": "^3.0.0",
"ember-try": "^0.2.23",
"loader.js": "^4.6.0"
}
}
24 changes: 24 additions & 0 deletions testem.js
@@ -0,0 +1,24 @@
module.exports = {
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launch_in_ci: [
'Chrome'
],
launch_in_dev: [
'Chrome'
],
browser_args: {
Chrome: {
mode: 'ci',
args: [
// --no-sandbox is needed when running Chrome inside a container
process.env.TRAVIS ? '--no-sandbox' : null,

'--disable-gpu',
'--headless',
'--remote-debugging-port=0',
'--window-size=1440,900'
].filter(Boolean)
}
}
};
14 changes: 14 additions & 0 deletions tests/dummy/app/app.js
@@ -0,0 +1,14 @@
import Application from '@ember/application';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

const App = Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
});

loadInitializers(App, config.modulePrefix);

export default App;
25 changes: 25 additions & 0 deletions tests/dummy/app/index.html
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Dummy</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for "head"}}

<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/dummy.css">

{{content-for "head-footer"}}
</head>
<body>
{{content-for "body"}}

<script src="{{rootURL}}assets/vendor.js"></script>
<script src="{{rootURL}}assets/dummy.js"></script>

{{content-for "body-footer"}}
</body>
</html>
3 changes: 3 additions & 0 deletions tests/dummy/app/resolver.js
@@ -0,0 +1,3 @@
import Resolver from 'ember-resolver';

export default Resolver;
12 changes: 12 additions & 0 deletions tests/dummy/app/router.js
@@ -0,0 +1,12 @@
import EmberRouter from '@ember/routing/router';
import config from './config/environment';

const Router = EmberRouter.extend({
location: config.locationType,
rootURL: config.rootURL
});

Router.map(function() {
});

export default Router;
Empty file added tests/dummy/app/styles/app.css
Empty file.
3 changes: 3 additions & 0 deletions tests/dummy/app/templates/application.hbs
@@ -0,0 +1,3 @@
<h2 id="title">Welcome to Ember</h2>

{{outlet}}

0 comments on commit 791f419

Please sign in to comment.