From 8dc9cf21d7f5028d7103524d31bfcb2b16c2aa92 Mon Sep 17 00:00:00 2001 From: alecmerdler Date: Thu, 19 Jan 2017 20:02:57 -0800 Subject: [PATCH] fixed karma-webpack, also added jasmine-ts to run tests in pure NodeJS --- karma.conf.js | 7 ++++--- package.json | 3 ++- static/js/route-builder/route-builder.service.impl.ts | 2 +- static/js/route-builder/route-builder.service.spec.ts | 4 ---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index d8bf7bcfa..c728af7e0 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -4,7 +4,7 @@ var webpackConfig = require('./webpack.config'); module.exports = function(config) { config.set({ basePath: '', - frameworks: ['jasmine', 'karma-typescript'], + frameworks: ['jasmine'], files: [ // CDN resources 'node_modules/jquery/dist/jquery.js', @@ -28,7 +28,7 @@ module.exports = function(config) { 'static/lib/**/*.js', // Application resources - 'static/js/**/*.ts*', + 'static/js/**/*.spec.ts*', // Tests utils 'static/test/**/*.js', @@ -39,7 +39,8 @@ module.exports = function(config) { preprocessors: { 'static/lib/ngReact/react.ngReact.min.js': ['webpack'], 'static/lib/angular-moment.min.js': ['webpack'], - 'static/js/**/*.ts*': ['karma-typescript'], + // 'static/js/**/*.ts*': ['karma-typescript'], + 'static/js/**/*.ts*': ['webpack'], }, webpack: { resolve: webpackConfig.resolve, diff --git a/package.json b/package.json index ee8e3841c..2e92b8daa 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "version": "1.0.0", "scripts": { "test": "./node_modules/.bin/karma start --single-run --browsers PhantomJS", + "test:node": "./node_modules/.bin/jasmine-ts './static/js/**/*.spec.ts'", "build": "./node_modules/.bin/webpack --progress -p -v", "watch": "./node_modules/.bin/webpack --watch" }, @@ -41,13 +42,13 @@ "angular-mocks": "^1.5.3", "css-loader": "0.25.0", "jasmine-core": "^2.5.2", + "jasmine-ts": "0.0.3", "karma": "^0.13.22", "karma-chrome-launcher": "^2.0.0", "karma-coverage": "^0.5.5", "karma-es6-shim": "^1.0.0", "karma-jasmine": "^0.3.8", "karma-phantomjs-launcher": "^1.0.0", - "karma-typescript": "^2.1.6", "karma-webpack": "^1.8.1", "node-sass": "3.10.1", "phantomjs-prebuilt": "^2.1.7", diff --git a/static/js/route-builder/route-builder.service.impl.ts b/static/js/route-builder/route-builder.service.impl.ts index f39769965..8f6382abb 100644 --- a/static/js/route-builder/route-builder.service.impl.ts +++ b/static/js/route-builder/route-builder.service.impl.ts @@ -35,7 +35,7 @@ export class RouteBuilderImpl implements RouteBuilder { var page = pair[1]; var templateUrl = foundProfile.templatePath + page.templateName; - var options = jQuery.extend({}, page.flags || {}); + var options = page.flags || {}; options['templateUrl'] = templateUrl; options['reloadOnSearch'] = false; options['controller'] = page.controller; diff --git a/static/js/route-builder/route-builder.service.spec.ts b/static/js/route-builder/route-builder.service.spec.ts index 22bd51179..ef29b5ba4 100644 --- a/static/js/route-builder/route-builder.service.spec.ts +++ b/static/js/route-builder/route-builder.service.spec.ts @@ -7,10 +7,6 @@ describe("Service: RouteBuilderImpl", () => { var profiles; var currentProfile; - it("sanity", () => { - expect(true).toBe(true); - }); - beforeEach((() => { profiles = [ {id: 'old-layout', templatePath: '/static/partials/'},