diff --git a/.github/contributing.md b/.github/contributing.md index 3ed5cd7..461db9b 100644 --- a/.github/contributing.md +++ b/.github/contributing.md @@ -32,9 +32,6 @@ We use Gulp for managing the build. Here are some useful Gulp tasks: * `npm test` Runs all tests (webpack, commonjs, etc) checks the coding style, lints the code, calculates complexity, runs all tests, and enforces code coverage. You should make sure you do this before submitting a PR. * `gulp` The default task checks the coding style, lints the code, calculates complexity, runs the tests (not webpack or commonJS tests), and enforces code coverage. - * `gulp scss` Generates the css file from the source scss. - * `gulp css-lint` Lint the css files after generating. - * `gulp templatecache` Generates src/js/datetimepicker.templates.js. You must re-add the IIFE around the generated code after it is generated (PR to fix this would be apprecaited) # Contributing to AngularJS diff --git a/.npmignore b/.npmignore index 7a6b7b1..5b8e638 100644 --- a/.npmignore +++ b/.npmignore @@ -8,7 +8,6 @@ bower_components complexity coverage demo -Gruntfile.js gulpfile.js karma.conf.js paths.js diff --git a/.travis.yml b/.travis.yml index 590b3e4..e8afe38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,18 @@ sudo: false +dist: bionic language: node_js +node_js: + - '12' +services: + - xvfb +addons: + firefox: latest + chrome: latest cache: directories: - node_modules notifications: email: none -node_js: - - '6' -before_install: - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start before_script: - npm prune script: diff --git a/gulpfile.js b/gulpfile.js index 227ab0b..7cc6cbd 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,14 +12,14 @@ var standard = require('gulp-standard') var karmaConfig = path.join(__dirname, 'karma.conf.js') -gulp.task('clean', function () { +gulp.task('clean', function clean () { var del = require('del') return del([ 'build' ]) }) -gulp.task('complexity', function (done) { +gulp.task('complexity', function complexity (done) { var callback = function () { done() } @@ -27,7 +27,7 @@ gulp.task('complexity', function (done) { plato.inspect(paths.lint, 'build/complexity', {title: 'prerender', recurse: true}, callback) }) -gulp.task('lint', function () { +gulp.task('lint', function lint () { return gulp .src(paths.lint) .pipe(standard()) @@ -37,13 +37,13 @@ gulp.task('lint', function () { })) }) -gulp.task('tdd', function (done) { - gulp.watch(paths.all, ['jscs', 'lint']) +gulp.task('tdd', function tdd (done) { + gulp.watch(paths.all, gulp.parallel('lint')) var config = testConfig( { autoWatch: true, - browsers: ['PhantomJS'], + browsers: ['ChromeHeadless'], configFile: karmaConfig, singleRun: false } @@ -53,7 +53,7 @@ gulp.task('tdd', function (done) { server.start() }) -gulp.task('test', ['lint'], function (done) { +gulp.task('test', gulp.series('lint', function test (done) { var config = testConfig( { configFile: karmaConfig, @@ -64,13 +64,13 @@ gulp.task('test', ['lint'], function (done) { var server = new Server(config, done) server.start() -}) +})) -gulp.task('default', ['complexity', 'test']) +gulp.task('default', gulp.parallel('complexity', 'test')) var testConfig = function (options) { var travisDefaultOptions = { - browsers: ['Firefox'], + browsers: ['FirefoxHeadless', 'ChromeHeadless'], reporters: ['dots', 'coverage', 'threshold'] } diff --git a/karma.conf.js b/karma.conf.js index e1ecd92..eb026b8 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -26,7 +26,6 @@ module.exports = function (config) { 'karma-jasmine', 'karma-chrome-launcher', 'karma-firefox-launcher', - 'karma-phantomjs-launcher', 'karma-coverage', 'karma-threshold-reporter' ], @@ -85,7 +84,7 @@ module.exports = function (config) { // - Safari (only Mac) // - PhantomJS // - IE (only Windows) - browsers: ['PhantomJS'], + browsers: ['FirefoxHeadless', 'ChromeHeadless'], // If browser does not capture in given timeout [ms], kill it captureTimeout: 60000, diff --git a/package.json b/package.json index 5d72dd1..8e1385c 100644 --- a/package.json +++ b/package.json @@ -22,32 +22,27 @@ "angular-mocks": "^1.x", "coveralls": "^2.11.14", "cz-conventional-changelog": "^1.2.0", + "del": "^5.1.0", "eslint": "^3.8.1", - "gulp": "^3.9.1", - "gulp-htmlmin": "^3.0.0", - "gulp-jscs": "^4.0.0", - "gulp-jshint": "^2.0.1", - "gulp-standard": "^8.0.2", - "jasmine-core": "^2.5.2", + "gulp": "^4.0.0", + "gulp-standard": "^8.0.4", "jquery": "^3.1.1", "jshint": "^2.9.4", "jshint-stylish": "^2.2.1", - "karma": "^1.3.0", - "karma-chrome-launcher": "^2.0.0", - "karma-coverage": "^1.1.1", - "karma-firefox-launcher": "^1.0.0", - "karma-jasmine": "^1.0.2", - "karma-phantomjs-launcher": "^1.0.2", + "karma": "^5.0.0", + "karma-chrome-launcher": "^3.1.0", + "karma-coverage": "^2.0.2", + "karma-firefox-launcher": "^1.3.0", + "karma-jasmine": "^3.1.1", "karma-threshold-reporter": "^0.1.15", - "karma-webpack": "^1.8.0", + "karma-webpack": "^4.0.2", "lodash": "^4.16.4", - "phantomjs-prebuilt": "^2.1.13", "plato": "^1.7.0", "run-browser": "^2.0.2", "semantic-release": "^6.3.0", "standard": "^8.4.0", "tape": "^4.6.2", - "webpack": "^1.13.2" + "webpack": "^4.43.0" }, "scripts": { "coverage:upload": "cat build/coverage/lcov.info | coveralls", diff --git a/paths.js b/paths.js index b1ac32c..63c7630 100644 --- a/paths.js +++ b/paths.js @@ -7,7 +7,7 @@ var nodeModules = [ 'node_modules/angular-mocks/angular-mocks.js' ] var bumpFiles = ['package.json', 'bower.json', 'README.md', 'src/js/*.js'] -var miscFiles = ['GruntFile.js', 'gulpfile.js', 'karma.conf.js', 'paths.js'] +var miscFiles = ['gulpfile.js', 'karma.conf.js', 'paths.js'] var demoFiles = [] var sourceFiles = ['src/**/*.js'] var testFiles = ['test/**/*.spec.js'] diff --git a/src/dateTimeInput.js b/src/dateTimeInput.js index 8cc18d1..18523b4 100644 --- a/src/dateTimeInput.js +++ b/src/dateTimeInput.js @@ -17,9 +17,8 @@ var ng = typeof angular === 'undefined' ? require('angular') : angular var mt = typeof moment === 'undefined' ? require('moment') : moment factory(ng, mt) - module.exports = 'ui.bootstrap.datetimepicker' - /* istanbul ignore next */ - } else if (typeof define === 'function' && /* istanbul ignore next */ define.amd) { + module.exports = 'ui.dateTimeInput' + } else /* istanbul ignore next */ if (typeof define === 'function' && define.amd) { define(['angular', 'moment'], factory) } else { factory(root.angular, root.moment) diff --git a/test/webpack/app.js b/test/webpack/app.js deleted file mode 100644 index 1ee17e6..0000000 --- a/test/webpack/app.js +++ /dev/null @@ -1,12 +0,0 @@ -/* globals require */ - -/** See the file "LICENSE" for the full license governing this code. - * - * - * @author Dale "Ducky" Lotts - * @since 9/11/16. - */ - -var angular = require('angular'); - -angular.module('app', []); diff --git a/test/webpack/karma.conf.js b/test/webpack/karma.conf.js index 972b6fe..412a0b3 100644 --- a/test/webpack/karma.conf.js +++ b/test/webpack/karma.conf.js @@ -8,8 +8,6 @@ * @since 9/11/16. */ -var webpackConfig = require('./webpack.conf'); - module.exports = function(config) { 'use strict'; config.set({ @@ -30,10 +28,10 @@ module.exports = function(config) { }], // webpack configuration - webpack: webpackConfig, + webpack: {}, // webpack middlewae configuration - webpackMiddleware: { noInfo: true }, + webpackMiddleware: { stats: 'errors-only' }, // list of files to exclude exclude: [], @@ -64,7 +62,7 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['PhantomJS'], + browsers: ['FirefoxHeadless', 'ChromeHeadless'], // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits @@ -72,6 +70,13 @@ module.exports = function(config) { // Concurrency level // how many browser should be started simultaneous - concurrency: Infinity + concurrency: Infinity, + + // Webpack tests need the tests to run in order in order to test the require call + client: { + jasmine: { + random: false + } + }, }); }; diff --git a/test/webpack/webpack.conf.js b/test/webpack/webpack.conf.js deleted file mode 100644 index c9d1d1b..0000000 --- a/test/webpack/webpack.conf.js +++ /dev/null @@ -1,19 +0,0 @@ -/* globals __dirname */ -/* jshint node:true */ - -/** - * See the file "LICENSE" for the full license governing this code. - * - * @author Dale "Ducky" Lotts - * @since 9/11/16. - */ - -var path = require('path') - -module.exports = { - entry: [path.join(__dirname, 'app.js')], - output: { - path: __dirname, - filename: 'bundle.js' - } -}; diff --git a/test/webpack/webpack.test.js b/test/webpack/webpack.test.js index 0ba779c..26c01c0 100644 --- a/test/webpack/webpack.test.js +++ b/test/webpack/webpack.test.js @@ -16,11 +16,12 @@ describe('webpack require', function () { } it('should throw an error if the module is not defined', function () { - expect(loadDateTimeInput).toThrow(); + expect(loadDateTimeInput).toThrowError(/\[\$injector:nomod\] Module 'ui\.dateTimeInput'/); }); it('should be available when required', function () { - require('../../'); + var exported = require('../../'); + expect(exported).toBe('ui.dateTimeInput'); expect(loadDateTimeInput).not.toThrow(); }); });