karma

Unable to run Coverage with Karma

匿名 (未验证) 提交于 2019-12-03 08:33:39
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to run coverage with karma, and I get the warning: WARN [preprocess]: Can not load "coverage", it is not registered! I thought I installed coverage when I ran 'npm install -g karma-coverage --save-dev' Here's my config file: module.exports = function(config) { config.set({ // base path, that will be used to resolve files and exclude basePath: '', frameworks: ['jasmine'], // list of files / patterns to load in the browser files: [ bunch of files.. ], // list of files to exclude exclude: [], // use dots reporter, as travis terminal

Angular Material MatTableDataSource cannot be found

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to create a table using Angular Material Table , in the examples there is always the import: import {MatTableDataSource} from '@angular/material'; I'm trying to do the same but I'm getting an error: "Module ' ../node_modules/@angular/material/material ' has no exported member MatTableDataSource . Is there anything I'm missing? Here's the package.json versions: "dependencies": { "@angular/animations": "^4.4.6", "@angular/cdk": "^2.0.0-beta.12", "@angular/common": "^4.2.4", "@angular/compiler": "^4.2.4", "@angular/core": "^4.2.4", "

Mocha - Chai Karma “suite is not defined”

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm quite new to jscript tdd and got a problem, hope someone can show me what I'm doing worng. Running the Tests in a browser (via HTML File) everything works fine. running them through node and karma i got the following exception I want to use Mocha and Chai within karma in node.js host. I installed via npm install [...] --save-dev mocha and karma-mocha I've a testlibrary like this suite('first suite', function () { test('SuccessTest', function () { expect(1).to.equal(1); }); test('FailTest', function () { expect(1).to.equal(2); }); }); in

【AngularJs学习笔记五】AngularJS从构建项目开始

独自空忆成欢 提交于 2019-12-03 03:49:29
#0 系列目录# AngularJs学习笔记 【AngularJs学习笔记一】Bower解决js的依赖管理 【AngularJs学习笔记二】Yeoman自动构建js项目 【AngularJs学习笔记三】Grunt任务管理器 【AngularJs学习笔记四】Grunt + Bower + Requirejs + Angular 【AngularJs学习笔记五】AngularJS从构建项目开始 #1 AngularJS介绍# AngularJS是一个为动态WEB应用设计的结构框架。 它能让你使用HTML作为模板语言 ,通过扩展HTML的语法,让你能更清楚、简洁地构建你的应用组件。 它的创新点在于,利用 数据绑定 和 依赖注入 ,它使你不用再写大量的代码了。这些全都是通过浏览器端的Javascript实现,这也使得它能够完美地和任何服务器端技术结合。 AngularJS介绍,摘自: http://angularjs.cn/A00n #2 构建AngularJS项目(Yeoman,angular-seed)# ##2.1 基于angular-seed构建项目## 一般把这个项目称为angular的“种子项目” ,构建方法是去github下载项目源代码,基于已有项目结构再做开发。这种项目都融入了前人的经验,会以一种比较合理的结构,帮我们构建出项目的原型。适合于有一定规模项目开发

gulp and karma, file karma.conf.js does not exist

匿名 (未验证) 提交于 2019-12-03 03:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a basic AngularJS app and want to have all my terminal command run with gulp tasks eg $ gulp dev for the development server and $ gulp unitTest for testing etc. I have installed Gulp as per the Docs using $ npm install --save-dev gulp with my gulpfile.js in the root of the project file. I have also done the same for karma's install and config file. It is worth stating now that I want all the npm installs tagged with --save for easily move the project around the office and servers. When it comes to adding the task to Gulp I have to us

PhantomJS not captured when ran via build server

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Karma and PhantomJS with Jasmine to test my AngularJS. When I run my gulp test locally it works fine, launches PhantomJS and runs all my tests, but when the tests get run on the build server it fails with the following errors: Note that I am using VSTS and using their built in cloud build system (hosted agent). Having said that its pretty much a task runner and I only use it to run gulp tasks (build, test etc) on checkin [32m13 07 2016 15:21:32.260:INFO [karma]: [39mKarma v1.1.1 server started at http://localhost:9876/ [32m13 07

Is it possible to run Karma with no browsers at all?

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I started an Angular.js app with Yeoman's yo angular that includes Karma testing. Then, the grunt test reasonably failed because Karma can't find any browsers . (The browsers has not been set in the app's node_modules/karma config file.) I'm doing my development via SSH into a remote machine, which I think (let me know if I'm wrong) is pointless to have Chrome, /usr/bin/chromium-browser , installed. So is it possible to run Karma without any browsers? 回答1: Karma needs a browser to be set. You can make use of PhantomJS instead of Chrome.

ReferenceError: module is not defined - Karma/Jasmine configuration with Angular/Laravel app

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an existing Angular/Laravel app in which Laravel acts as an API to the angular frontend serving only JSON data. The page that loads the angular app, index.php , is currently served by Laravel. From there, Angular takes over. I'm have a very difficult time trying to get started with Karma/Jasmine. When running my tests using karma start or karma start karma.conf.js from the root directory of my project, I get the following error: ReferenceError: module is not defined Full output: INFO [karma]: Karma v0.12.28 server started at http:/

Error: Cannot find module 'jasmine-core'

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I installed the following for testing: "devDependencies": { "jasmine-core": "^2.4.1", "karma": "^0.13.22", "karma-jasmine": "^0.3.7", "karma-phantomjs-launcher": "^1.0.0" } After running karma start I get the following error: Doing a search this is the first question with the same problem: karma start Cannot find module 'jasmine-core' However I've tried both answers, installed jasmine-core globally and I already did npm install jasmine-core --save-dev :( My test/index.html <!DOCTYPE html> <html lang="en"> <head> <title>Jasmine Spec Runner<

Karma, PhantomJS and es6 Promises

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am writing a JavaScript library that uses the new es6 promises. I can test the library in Firefox because promises are defined. However, when I try to test my code with Karma and PhantomJS, I get the error Can't find variable: Promise. . I am guessing this is because the PhantomJS browser doesn't support es6 promises yet. How can I configure Karma to bring in the polyfill for promises? 回答1: You can pull in the Babel polyfill by simply installing Babel Polyfill : npm install --save-dev babel-polyfill and then include the polyfill file