Skip to content

Commit 8edf286

Browse files
author
Isaac Mann
committed
Starter
1 parent e18346c commit 8edf286

File tree

88 files changed

+2626
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2626
-11
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# @AngularClass
2+
# http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_style = space
9+
indent_size = 2
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
insert_final_newline = false
16+
trim_trailing_whitespace = false

.gitignore

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
# @AngularClass
2+
13
# Logs
24
logs
35
*.log
4-
npm-debug.log*
56

67
# Runtime data
78
pids
@@ -17,17 +18,44 @@ coverage
1718
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
1819
.grunt
1920

20-
# node-waf configuration
21-
.lock-wscript
22-
2321
# Compiled binary addons (http://nodejs.org/api/addons.html)
2422
build/Release
2523

26-
# Dependency directory
27-
node_modules
28-
29-
# Optional npm cache directory
30-
.npm
24+
# Users Environment Variables
25+
.lock-wscript
3126

32-
# Optional REPL history
33-
.node_repl_history
27+
# OS generated files #
28+
.DS_Store
29+
ehthumbs.db
30+
Icon?
31+
Thumbs.db
32+
33+
# Node Files #
34+
/node_modules
35+
/bower_components
36+
npm-debug.log
37+
38+
# Coverage #
39+
/coverage/
40+
41+
# Typing #
42+
/src/typings/tsd/
43+
/typings/
44+
/tsd_typings/
45+
46+
# Dist #
47+
/dist
48+
/public/__build__/
49+
/src/*/__build__/
50+
/__build__/**
51+
/public/dist/
52+
/src/*/dist/
53+
/dist/**
54+
.webpack.json
55+
56+
# Doc #
57+
/doc/
58+
59+
# IDE #
60+
.idea/
61+
*.swp

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: node_js
2+
node_js:
3+
- "4"
4+
- "5"
5+
- "node"
6+
7+
sudo: false

config/helpers.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @author: @AngularClass
3+
*/
4+
5+
var path = require('path');
6+
7+
// Helper functions
8+
var ROOT = path.resolve(__dirname, '..');
9+
10+
console.log('root directory:', root() + '\n');
11+
12+
function hasProcessFlag(flag) {
13+
return process.argv.join('').indexOf(flag) > -1;
14+
}
15+
16+
function root(args) {
17+
args = Array.prototype.slice.call(arguments, 0);
18+
return path.join.apply(path, [ROOT].concat(args));
19+
}
20+
21+
22+
exports.hasProcessFlag = hasProcessFlag;
23+
exports.root = root;

config/karma.conf.js

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/**
2+
* @author: @AngularClass
3+
*/
4+
5+
module.exports = function(config) {
6+
var testWebpackConfig = require('./webpack.test.js');
7+
8+
config.set({
9+
10+
// base path that will be used to resolve all patterns (e.g. files, exclude)
11+
basePath: '',
12+
13+
/*
14+
* Frameworks to use
15+
*
16+
* available frameworks: https://npmjs.org/browse/keyword/karma-adapter
17+
*/
18+
frameworks: ['jasmine'],
19+
20+
// list of files to exclude
21+
exclude: [ ],
22+
23+
/*
24+
* list of files / patterns to load in the browser
25+
*
26+
* we are building the test environment in ./spec-bundle.js
27+
*/
28+
files: [ { pattern: './config/spec-bundle.js', watched: false } ],
29+
30+
/*
31+
* preprocess matching files before serving them to the browser
32+
* available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
33+
*/
34+
preprocessors: { './config/spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] },
35+
36+
// Webpack Config at ./webpack.test.js
37+
webpack: testWebpackConfig,
38+
39+
coverageReporter: {
40+
dir : 'coverage/',
41+
reporters: [
42+
{ type: 'text-summary' },
43+
{ type: 'json' },
44+
{ type: 'html' }
45+
]
46+
},
47+
48+
// Webpack please don't spam the console when running in karma!
49+
webpackServer: { noInfo: true },
50+
51+
/*
52+
* test results reporter to use
53+
*
54+
* possible values: 'dots', 'progress'
55+
* available reporters: https://npmjs.org/browse/keyword/karma-reporter
56+
*/
57+
reporters: [ 'mocha', 'coverage' ],
58+
59+
// web server port
60+
port: 9876,
61+
62+
// enable / disable colors in the output (reporters and logs)
63+
colors: true,
64+
65+
/*
66+
* level of logging
67+
* possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
68+
*/
69+
logLevel: config.LOG_INFO,
70+
71+
// enable / disable watching file and executing tests whenever any file changes
72+
autoWatch: false,
73+
74+
/*
75+
* start these browsers
76+
* available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
77+
*/
78+
browsers: [
79+
// 'Chrome',
80+
'PhantomJS'
81+
],
82+
83+
/*
84+
* Continuous Integration mode
85+
* if true, Karma captures browsers, runs the tests and exits
86+
*/
87+
singleRun: true
88+
});
89+
90+
};

config/protractor.conf.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* @author: @AngularClass
3+
*/
4+
5+
require('ts-node/register');
6+
var helpers = require('./helpers');
7+
8+
exports.config = {
9+
baseUrl: 'http://localhost:3000/',
10+
11+
// use `npm run e2e`
12+
specs: [
13+
helpers.root('src/**/**.e2e.ts'),
14+
helpers.root('src/**/*.e2e.ts')
15+
],
16+
exclude: [],
17+
18+
framework: 'jasmine2',
19+
20+
allScriptsTimeout: 110000,
21+
22+
jasmineNodeOpts: {
23+
showTiming: true,
24+
showColors: true,
25+
isVerbose: false,
26+
includeStackTrace: false,
27+
defaultTimeoutInterval: 400000
28+
},
29+
directConnect: true,
30+
31+
capabilities: {
32+
'browserName': 'chrome',
33+
'chromeOptions': {
34+
'args': ['show-fps-counter=true']
35+
}
36+
},
37+
38+
onPrepare: function() {
39+
browser.ignoreSynchronization = true;
40+
},
41+
42+
/**
43+
* Angular 2 configuration
44+
*
45+
* useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
46+
* `rootEl`
47+
*/
48+
useAllAngular2AppRoots: true
49+
};

config/spec-bundle.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* @author: @AngularClass
3+
*/
4+
5+
/*
6+
* When testing with webpack and ES6, we have to do some extra
7+
* things to get testing to work right. Because we are gonna write tests
8+
* in ES6 too, we have to compile those as well. That's handled in
9+
* karma.conf.js with the karma-webpack plugin. This is the entry
10+
* file for webpack test. Just like webpack will create a bundle.js
11+
* file for our client, when we run test, it will compile and bundle them
12+
* all here! Crazy huh. So we need to do some setup
13+
*/
14+
Error.stackTraceLimit = Infinity;
15+
16+
require('core-js');
17+
18+
// Typescript emit helpers polyfill
19+
require('ts-helpers');
20+
21+
require('zone.js/dist/zone');
22+
require('zone.js/dist/long-stack-trace-zone');
23+
require('zone.js/dist/jasmine-patch');
24+
require('zone.js/dist/async-test');
25+
require('zone.js/dist/fake-async-test');
26+
require('zone.js/dist/sync-test');
27+
28+
// RxJS
29+
require('rxjs/Rx');
30+
31+
var testing = require('@angular/core/testing');
32+
var browser = require('@angular/platform-browser-dynamic/testing');
33+
34+
testing.setBaseTestProviders(
35+
browser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
36+
browser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
37+
);
38+
39+
Object.assign(global, testing);
40+
41+
/*
42+
* Ok, this is kinda crazy. We can use the the context method on
43+
* require that webpack created in order to tell webpack
44+
* what files we actually want to require or import.
45+
* Below, context will be an function/object with file names as keys.
46+
* using that regex we are saying look in ./src/app and ./test then find
47+
* any file that ends with spec.js and get its path. By passing in true
48+
* we say do this recursively
49+
*/
50+
var testContext = require.context('../src', true, /\.spec\.ts/);
51+
52+
/*
53+
* get all the files, for each file, call the context function
54+
* that will require the file and load it up here. Context will
55+
* loop and require those spec files here
56+
*/
57+
function requireAll(requireContext) {
58+
return requireContext.keys().map(requireContext);
59+
}
60+
61+
// requires and returns all modules that match
62+
var modules = requireAll(testContext);

0 commit comments

Comments
 (0)