Skip to content

Commit df6ab75

Browse files
committed
add test (basically, a default app built’s tests run even post uglification)
1 parent 16d749e commit df6ab75

27 files changed

+5945
-3
lines changed

.editorconfig

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
8+
[*]
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
indent_style = space
14+
indent_size = 2
15+
16+
[*.hbs]
17+
insert_final_newline = false
18+
19+
[*.{diff,md}]
20+
trim_trailing_whitespace = false

.ember-cli

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
/**
3+
Ember CLI sends analytics information by default. The data is completely
4+
anonymous, but there are times when you might want to disable this behavior.
5+
6+
Setting `disableAnalytics` to true will prevent any data from being sent.
7+
*/
8+
"disableAnalytics": false
9+
}

.gitignore

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# See http://help.github.com/ignore-files/ for more about ignoring files.
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
22

33
# compiled output
44
/dist
@@ -13,5 +13,11 @@
1313
/connect.lock
1414
/coverage/*
1515
/libpeerconnection.log
16-
npm-debug.log
16+
npm-debug.log*
17+
yarn-error.log
1718
testem.log
19+
20+
# ember-try
21+
.node_modules.ember-try/
22+
bower.json.ember-try
23+
package.json.ember-try

.npmignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/bower_components
2+
/config/ember-try.js
3+
/dist
4+
/tests
5+
/tmp
6+
**/.gitkeep
7+
.bowerrc
8+
.editorconfig
9+
.ember-cli
10+
.eslintrc.js
11+
.gitignore
12+
.watchmanconfig
13+
.travis.yml
14+
bower.json
15+
ember-cli-build.js
16+
testem.js
17+
18+
# ember-try
19+
.node_modules.ember-try/
20+
bower.json.ember-try
21+
package.json.ember-try

.travis.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
language: node_js
3+
node_js:
4+
# we recommend testing addons with the same minimum supported node version as Ember CLI
5+
# so that your addon works for all apps
6+
- "4"
7+
8+
sudo: false
9+
dist: trusty
10+
11+
addons:
12+
chrome: stable
13+
14+
cache:
15+
yarn: true
16+
17+
env:
18+
global:
19+
# See https://git.io/vdao3 for details.
20+
- JOBS=1
21+
matrix:
22+
# we recommend new addons test the current and previous LTS
23+
# as well as latest stable release (bonus points to beta/canary)
24+
- EMBER_TRY_SCENARIO=ember-lts-2.12
25+
- EMBER_TRY_SCENARIO=ember-lts-2.16
26+
- EMBER_TRY_SCENARIO=ember-release
27+
- EMBER_TRY_SCENARIO=ember-beta
28+
- EMBER_TRY_SCENARIO=ember-canary
29+
- EMBER_TRY_SCENARIO=ember-default
30+
31+
matrix:
32+
fast_finish: true
33+
allow_failures:
34+
- env: EMBER_TRY_SCENARIO=ember-canary
35+
36+
before_install:
37+
- curl -o- -L https://yarnpkg.com/install.sh | bash
38+
- export PATH=$HOME/.yarn/bin:$PATH
39+
40+
install:
41+
- yarn install --no-lockfile --non-interactive
42+
43+
script:
44+
# Usually, it's ok to finish the test scenario without reverting
45+
# to the addon's original dependency state, skipping "cleanup".
46+
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup

.watchmanconfig

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignore_dirs": ["tmp", "dist"]
3+
}

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ember-cli-uglify
44

55
[![npm](https://img.shields.io/npm/v/ember-cli-uglify.svg)](https://www.npmjs.com/package/ember-cli-uglify)
66
[![Build Status](https://travis-ci.org/ember-cli/ember-cli-uglify.svg?branch=master)](https://travis-ci.org/ember-cli/ember-cli-uglify)
7+
[![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)
78

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

appveyor.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# https://www.appveyor.com/docs/appveyor-yml/
2+
3+
# Test against these versions of Node.js.
4+
environment:
5+
MOCHA_REPORTER: "mocha-appveyor-reporter"
6+
matrix:
7+
- nodejs_version: "4"
8+
- nodejs_version: "6"
9+
- nodejs_version: "8"
10+
- nodejs_version: "9"
11+
12+
branches:
13+
only:
14+
- master
15+
- beta
16+
- release
17+
18+
# Install scripts. (runs after repo cloning)
19+
install:
20+
- ps: Install-Product node $env:nodejs_version
21+
- appveyor-retry npm i -g npm@^4
22+
- appveyor-retry yarn
23+
- appveyor-retry yarn add mocha-appveyor-reporter # must be installed locally.
24+
25+
cache:
26+
- '%LOCALAPPDATA%\Yarn'
27+
- '%APPDATA%\Roaming\bower'
28+
29+
# Post-install test scripts.
30+
test_script:
31+
# Output useful info for debugging.
32+
- git rev-parse HEAD
33+
- cmd: yarn run test:all
34+
35+
# Don't actually build.
36+
build: off
37+
38+
# Set build version format here instead of in the admin panel.
39+
version: "{build}"

config/ember-try.js

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
module.exports = {
2+
useYarn: true,
3+
scenarios: [
4+
{
5+
name: 'ember-lts-2.12',
6+
npm: {
7+
devDependencies: {
8+
'ember-source': '~2.12.0'
9+
}
10+
}
11+
},
12+
{
13+
name: 'ember-lts-2.16',
14+
npm: {
15+
devDependencies: {
16+
'ember-source': '~2.16.0'
17+
}
18+
}
19+
},
20+
{
21+
name: 'ember-release',
22+
bower: {
23+
dependencies: {
24+
'ember': 'components/ember#release'
25+
},
26+
resolutions: {
27+
'ember': 'release'
28+
}
29+
},
30+
npm: {
31+
devDependencies: {
32+
'ember-source': null
33+
}
34+
}
35+
},
36+
{
37+
name: 'ember-beta',
38+
bower: {
39+
dependencies: {
40+
'ember': 'components/ember#beta'
41+
},
42+
resolutions: {
43+
'ember': 'beta'
44+
}
45+
},
46+
npm: {
47+
devDependencies: {
48+
'ember-source': null
49+
}
50+
}
51+
},
52+
{
53+
name: 'ember-canary',
54+
bower: {
55+
dependencies: {
56+
'ember': 'components/ember#canary'
57+
},
58+
resolutions: {
59+
'ember': 'canary'
60+
}
61+
},
62+
npm: {
63+
devDependencies: {
64+
'ember-source': null
65+
}
66+
}
67+
},
68+
{
69+
name: 'ember-default',
70+
npm: {
71+
devDependencies: {}
72+
}
73+
}
74+
]
75+
};

ember-cli-build.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
4+
5+
module.exports = function(defaults) {
6+
let app = new EmberAddon(defaults, {
7+
// Add options here
8+
});
9+
10+
/*
11+
This build file specifies the options for the dummy test app of this
12+
addon, located in `/tests/dummy`
13+
This build file does *not* influence how the addon or the app using it
14+
behave. You most likely want to be modifying `./index.js` or app's build file
15+
*/
16+
17+
return app.toTree();
18+
};

package.json

+14-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"scripts": {
1919
"build": "ember build",
2020
"start": "ember server",
21-
"test": "ember test"
21+
"test": "ember test -e production",
22+
"test:all": "ember try:each -- ember test -e production"
2223
},
2324
"dependencies": {
2425
"broccoli-uglify-sourcemap": "^2.0.1",
@@ -39,5 +40,17 @@
3940
},
4041
"ember-addon": {
4142
"before": "broccoli-asset-rev"
43+
},
44+
"devDependencies": {
45+
"ember-cli": "^3.0.0",
46+
"ember-cli-babel": "^6.11.0",
47+
"ember-cli-htmlbars": "^2.0.3",
48+
"ember-cli-qunit": "^4.3.2",
49+
"ember-cli-uglfiy": "./",
50+
"ember-load-initializers": "^1.0.0",
51+
"ember-resolver": "^4.5.0",
52+
"ember-source": "^3.0.0",
53+
"ember-try": "^0.2.23",
54+
"loader.js": "^4.6.0"
4255
}
4356
}

testem.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
test_page: 'tests/index.html?hidepassed',
3+
disable_watching: true,
4+
launch_in_ci: [
5+
'Chrome'
6+
],
7+
launch_in_dev: [
8+
'Chrome'
9+
],
10+
browser_args: {
11+
Chrome: {
12+
mode: 'ci',
13+
args: [
14+
// --no-sandbox is needed when running Chrome inside a container
15+
process.env.TRAVIS ? '--no-sandbox' : null,
16+
17+
'--disable-gpu',
18+
'--headless',
19+
'--remote-debugging-port=0',
20+
'--window-size=1440,900'
21+
].filter(Boolean)
22+
}
23+
}
24+
};

tests/dummy/app/app.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Application from '@ember/application';
2+
import Resolver from './resolver';
3+
import loadInitializers from 'ember-load-initializers';
4+
import config from './config/environment';
5+
6+
const App = Application.extend({
7+
modulePrefix: config.modulePrefix,
8+
podModulePrefix: config.podModulePrefix,
9+
Resolver
10+
});
11+
12+
loadInitializers(App, config.modulePrefix);
13+
14+
export default App;

tests/dummy/app/index.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<title>Dummy</title>
7+
<meta name="description" content="">
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
10+
{{content-for "head"}}
11+
12+
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
13+
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/dummy.css">
14+
15+
{{content-for "head-footer"}}
16+
</head>
17+
<body>
18+
{{content-for "body"}}
19+
20+
<script src="{{rootURL}}assets/vendor.js"></script>
21+
<script src="{{rootURL}}assets/dummy.js"></script>
22+
23+
{{content-for "body-footer"}}
24+
</body>
25+
</html>

tests/dummy/app/resolver.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Resolver from 'ember-resolver';
2+
3+
export default Resolver;

tests/dummy/app/router.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import EmberRouter from '@ember/routing/router';
2+
import config from './config/environment';
3+
4+
const Router = EmberRouter.extend({
5+
location: config.locationType,
6+
rootURL: config.rootURL
7+
});
8+
9+
Router.map(function() {
10+
});
11+
12+
export default Router;

tests/dummy/app/styles/app.css

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h2 id="title">Welcome to Ember</h2>
2+
3+
{{outlet}}

0 commit comments

Comments
 (0)