diff --git a/config/karma.conf.js b/config/karma.conf.js deleted file mode 100644 index a736cdec..00000000 --- a/config/karma.conf.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @author: @AngularClass - */ - -module.exports = function(config) { - var testWebpackConfig = require('./webpack.test.js'); - - config.set({ - - // base path that will be used to resolve all patterns (e.g. files, exclude) - basePath: '', - - /* - * Frameworks to use - * - * available frameworks: https://npmjs.org/browse/keyword/karma-adapter - */ - frameworks: ['jasmine'], - - // list of files to exclude - exclude: [ ], - - /* - * list of files / patterns to load in the browser - * - * we are building the test environment in ./spec-bundle.js - */ - files: [ { pattern: './config/spec-bundle.js', watched: false } ], - - /* - * preprocess matching files before serving them to the browser - * available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - */ - preprocessors: { './config/spec-bundle.js': ['coverage', 'webpack', 'sourcemap'] }, - - // Webpack Config at ./webpack.test.js - webpack: testWebpackConfig, - - coverageReporter: { - dir : 'coverage/', - reporters: [ - { type: 'text-summary' }, - { type: 'json' }, - { type: 'html' } - ] - }, - - // Webpack please don't spam the console when running in karma! - webpackServer: { noInfo: true }, - - /* - * test results reporter to use - * - * possible values: 'dots', 'progress' - * available reporters: https://npmjs.org/browse/keyword/karma-reporter - */ - reporters: [ 'mocha', 'coverage' ], - - // web server port - port: 9876, - - // enable / disable colors in the output (reporters and logs) - colors: true, - - /* - * level of logging - * possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - */ - logLevel: config.LOG_INFO, - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, - - /* - * start these browsers - * available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - */ - browsers: [ - // 'Chrome', - 'PhantomJS' - ], - - /* - * Continuous Integration mode - * if true, Karma captures browsers, runs the tests and exits - */ - singleRun: true - }); - -}; diff --git a/config/protractor.conf.js b/config/protractor.conf.js deleted file mode 100644 index f7fb6392..00000000 --- a/config/protractor.conf.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @author: @AngularClass - */ - -require('ts-node/register'); -var helpers = require('./helpers'); - -exports.config = { - baseUrl: 'http://localhost:3000/', - - // use `npm run e2e` - specs: [ - helpers.root('src/**/**.e2e.ts'), - helpers.root('src/**/*.e2e.ts') - ], - exclude: [], - - framework: 'jasmine2', - - allScriptsTimeout: 110000, - - jasmineNodeOpts: { - showTiming: true, - showColors: true, - isVerbose: false, - includeStackTrace: false, - defaultTimeoutInterval: 400000 - }, - directConnect: true, - - capabilities: { - 'browserName': 'chrome', - 'chromeOptions': { - 'args': ['show-fps-counter=true'] - } - }, - - onPrepare: function() { - browser.ignoreSynchronization = true; - }, - - seleniumServerJar: 'node_modules/protractor/selenium/selenium-server-standalone-2.52.0.jar', - - /** - * Angular 2 configuration - * - * useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching - * `rootEl` - */ - useAllAngular2AppRoots: true -}; diff --git a/config/spec-bundle.js b/config/spec-bundle.js deleted file mode 100644 index 4ebf0ba9..00000000 --- a/config/spec-bundle.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @author: @AngularClass - */ - -/* - * When testing with webpack and ES6, we have to do some extra - * things get testing to work right. Because we are gonna write test - * in ES6 to, we have to compile those as well. That's handled in - * karma.conf.js with the karma-webpack plugin. This is the entry - * file for webpack test. Just like webpack will create a bundle.js - * file for our client, when we run test, it well compile and bundle them - * all here! Crazy huh. So we need to do some setup - */ -Error.stackTraceLimit = Infinity; - -require('core-js'); - -// Typescript emit helpers polyfill -require('ts-helpers'); - -require('zone.js/dist/zone'); -require('zone.js/dist/long-stack-trace-zone'); -require('zone.js/dist/jasmine-patch'); - -// RxJS -require('rxjs/Rx'); - -var testing = require('angular2/testing'); -var browser = require('angular2/platform/testing/browser'); - -testing.setBaseTestProviders( - browser.TEST_BROWSER_PLATFORM_PROVIDERS, - browser.TEST_BROWSER_APPLICATION_PROVIDERS -); - -Object.assign(global, testing); - -/* - * Ok, this is kinda crazy. We can use the the context method on - * require that webpack created in order to tell webpack - * what files we actually want to require or import. - * Below, context will be an function/object with file names as keys. - * using that regex we are saying look in ./src/app and ./test then find - * any file that ends with spec.js and get its path. By passing in true - * we say do this recursively - */ -var testContext = require.context('../src', true, /\.spec\.ts/); - -/* - * get all the files, for each file, call the context function - * that will require the file and load it up here. Context will - * loop and require those spec files here - */ -function requireAll(requireContext) { - return requireContext.keys().map(requireContext); -} - -// requires and returns all modules that match -var modules = requireAll(testContext); diff --git a/config/webpack.test.js b/config/webpack.test.js deleted file mode 100644 index 212cdd07..00000000 --- a/config/webpack.test.js +++ /dev/null @@ -1,233 +0,0 @@ -/** - * @author: @AngularClass - */ - -const helpers = require('./helpers'); - -/** - * Webpack Plugins - */ -const ProvidePlugin = require('webpack/lib/ProvidePlugin'); -const DefinePlugin = require('webpack/lib/DefinePlugin'); - -/** - * Webpack Constants - */ -const ENV = process.env.ENV = process.env.NODE_ENV = 'test'; - -/** - * Webpack configuration - * - * See: http://webpack.github.io/docs/configuration.html#cli - */ -module.exports = { - - /** - * Source map for Karma from the help of karma-sourcemap-loader & karma-webpack - * - * Do not change, leave as is or it wont work. - * See: https://github.com/webpack/karma-webpack#source-maps - */ - devtool: 'inline-source-map', - - /** - * Options affecting the resolving of modules. - * - * See: http://webpack.github.io/docs/configuration.html#resolve - */ - resolve: { - - /** - * An array of extensions that should be used to resolve modules. - * - * See: http://webpack.github.io/docs/configuration.html#resolve-extensions - */ - extensions: ['', '.ts', '.js'], - - /** - * Make sure root is src - */ - root: helpers.root('src'), - - }, - - /** - * Options affecting the normal modules. - * - * See: http://webpack.github.io/docs/configuration.html#module - */ - module: { - - /** - * An array of applied pre and post loaders. - * - * See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders - */ - preLoaders: [ - - /** - * Tslint loader support for *.ts files - * - * See: https://github.com/wbuchwalter/tslint-loader - */ - { - test: /\.ts$/, - loader: 'tslint-loader', - exclude: [helpers.root('node_modules')] - }, - - /** - * Source map loader support for *.js files - * Extracts SourceMaps for source files that as added as sourceMappingURL comment. - * - * See: https://github.com/webpack/source-map-loader - */ - { - test: /\.js$/, - loader: 'source-map-loader', - exclude: [ - // these packages have problems with their sourcemaps - helpers.root('node_modules/rxjs'), - helpers.root('node_modules/@angular2-material') - ]} - - ], - - /** - * An array of automatically applied loaders. - * - * IMPORTANT: The loaders here are resolved relative to the resource which they are applied to. - * This means they are not resolved relative to the configuration file. - * - * See: http://webpack.github.io/docs/configuration.html#module-loaders - */ - loaders: [ - - /** - * Typescript loader support for .ts and Angular 2 async routes via .async.ts - * - * See: https://github.com/s-panferov/awesome-typescript-loader - */ - { - test: /\.ts$/, - loader: 'awesome-typescript-loader', - query: { - compilerOptions: { - - // Remove TypeScript helpers to be injected - // below by DefinePlugin - removeComments: true - - } - }, - exclude: [/\.e2e\.ts$/] - }, - - /** - * Json loader support for *.json files. - * - * See: https://github.com/webpack/json-loader - */ - { test: /\.json$/, loader: 'json-loader', exclude: [helpers.root('src/index.html')] }, - - /** - * Raw loader support for *.css files - * Returns file content as string - * - * See: https://github.com/webpack/raw-loader - */ - { test: /\.css$/, loader: 'raw-loader', exclude: [helpers.root('src/index.html')] }, - - /** - * Raw loader support for *.html - * Returns file content as string - * - * See: https://github.com/webpack/raw-loader - */ - { test: /\.html$/, loader: 'raw-loader', exclude: [helpers.root('src/index.html')] } - - ], - - /** - * An array of applied pre and post loaders. - * - * See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders - */ - postLoaders: [ - - /** - * Instruments JS files with Istanbul for subsequent code coverage reporting. - * Instrument only testing sources. - * - * See: https://github.com/deepsweet/istanbul-instrumenter-loader - */ - { - test: /\.(js|ts)$/, loader: 'istanbul-instrumenter-loader', - include: helpers.root('src'), - exclude: [ - /\.(e2e|spec)\.ts$/, - /node_modules/ - ] - } - - ] - }, - - /** - * Add additional plugins to the compiler. - * - * See: http://webpack.github.io/docs/configuration.html#plugins - */ - plugins: [ - - /** - * Plugin: DefinePlugin - * Description: Define free variables. - * Useful for having development builds with debug logging or adding global constants. - * - * Environment helpers - * - * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin - */ - // NOTE: when adding more properties make sure you include them in custom-typings.d.ts - new DefinePlugin({ - 'ENV': JSON.stringify(ENV), - 'HMR': false, - 'process.env': { - 'ENV': JSON.stringify(ENV), - 'NODE_ENV': JSON.stringify(ENV), - 'HMR': false, - } - }), - - - ], - - /** - * Static analysis linter for TypeScript advanced options configuration - * Description: An extensible linter for the TypeScript language. - * - * See: https://github.com/wbuchwalter/tslint-loader - */ - tslint: { - emitErrors: false, - failOnHint: false, - resourcePath: 'src' - }, - - /** - * Include polyfills or mocks for various node stuff - * Description: Node configuration - * - * See: https://webpack.github.io/docs/configuration.html#node - */ - node: { - global: 'window', - process: false, - crypto: 'empty', - module: false, - clearImmediate: false, - setImmediate: false - } - -}; diff --git a/karma.conf.js b/karma.conf.js deleted file mode 100644 index 27c49adc..00000000 --- a/karma.conf.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * @author: @AngularClass - */ - -// Look in ./config for karma.conf.js -module.exports = require('./config/karma.conf.js'); diff --git a/package.json b/package.json index 693d2921..cb23fef6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "angular2-webpack-starter", "version": "5.0.4", - "description": "An Angular 2 Webpack Starter kit featuring Angular 2 (Router, Http, Forms, Services, Tests, E2E, Coverage), Karma, Protractor, Jasmine, Istanbul, TypeScript, and Webpack by AngularClass", + "description": "Angular 2 admin template.", "author": "Patrick Stapleton ", "homepage": "https://github.com/angularclass/angular2-webpack-starter", "license": "MIT", @@ -13,7 +13,6 @@ "webpack": "webpack", "webpack-dev-server": "webpack-dev-server", "webdriver-manager": "webdriver-manager", - "protractor": "protractor", "clean": "npm cache clean && npm run rimraf -- node_modules doc typings coverage dist", "clean:dist": "npm run rimraf -- dist", @@ -25,7 +24,6 @@ "watch": "npm run watch:dev", "watch:dev": "npm run build:dev -- --watch", "watch:dev:hmr": "npm run watch:dev -- --hot", - "watch:test": "npm run test -- --auto-watch --no-single-run", "watch:prod": "npm run build:prod -- --watch", "build": "npm run build:dev", @@ -44,14 +42,6 @@ "lint": "npm run tslint 'src/**/*.ts'", - "pree2e": "npm run webdriver:update -- --standalone", - "e2e": "npm run protractor", - "e2e:live": "npm run e2e -- --elementExplorer", - - "test": "node --max-old-space-size=4096 node_modules/karma/bin/karma start", - - "ci": "npm run e2e && npm run test", - "docs": "npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./src/", "start": "npm run server:dev", @@ -59,7 +49,7 @@ "postinstall": "npm run typings -- install", - "preversion": "npm test", + "preversion": "npm run build", "version": "npm run build", "postversion": "git push && git push --tags" @@ -100,18 +90,9 @@ "imports-loader": "^0.6.5", "istanbul-instrumenter-loader": "^0.2.0", "json-loader": "^0.5.4", - "karma": "^0.13.22", - "karma-chrome-launcher": "^0.2.3", - "karma-coverage": "^0.5.5", - "karma-jasmine": "^0.3.8", - "karma-mocha-reporter": "^2.0.0", - "karma-phantomjs-launcher": "^1.0.0", - "karma-sourcemap-loader": "^0.3.7", - "karma-webpack": "1.7.0", "parse5": "^2.1.5", "phantomjs-polyfill": "0.0.2", "phantomjs-prebuilt": "^2.1.7", - "protractor": "^3.2.2", "raw-loader": "0.5.1", "remap-istanbul": "^0.5.1", "rimraf": "^2.5.2", diff --git a/protractor.conf.js b/protractor.conf.js deleted file mode 100644 index b3f7738f..00000000 --- a/protractor.conf.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * @author: @AngularClass - */ - -// look in ./config for protractor.conf.js -exports.config = require('./config/protractor.conf.js').config; diff --git a/src/app/about/about.spec.ts b/src/app/about/about.spec.ts deleted file mode 100644 index 8b97cb50..00000000 --- a/src/app/about/about.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { - it, - inject, - injectAsync, - describe, - beforeEachProviders, - TestComponentBuilder -} from 'angular2/testing'; - -import {Component, provide} from 'angular2/core'; - -// Load the implementations that should be tested -import {About} from './about.component'; - -describe('About', () => { - // provide our implementations or mocks to the dependency injector - beforeEachProviders(() => [ - About - ]); - - it('should log ngOnInit', inject([ About ], (about) => { - spyOn(console, 'log'); - expect(console.log).not.toHaveBeenCalled(); - - about.ngOnInit(); - expect(console.log).toHaveBeenCalled(); - })); - -}); diff --git a/src/app/app.e2e.ts b/src/app/app.e2e.ts deleted file mode 100644 index ecc503e1..00000000 --- a/src/app/app.e2e.ts +++ /dev/null @@ -1,32 +0,0 @@ -describe('App', () => { - - beforeEach(() => { - browser.get('/'); - }); - - - it('should have a title', () => { - let subject = browser.getTitle(); - let result = 'Angular2 Webpack Starter by @gdi2290 from @AngularClass'; - expect(subject).toEqual(result); - }); - - it('should have
', () => { - let subject = element(by.css('app header')).isPresent(); - let result = true; - expect(subject).toEqual(result); - }); - - it('should have
', () => { - let subject = element(by.css('app main')).isPresent(); - let result = true; - expect(subject).toEqual(result); - }); - - it('should have