jasmine

Jasmine errors after upgrading to Angular 8

北慕城南 提交于 2019-12-13 03:23:44
问题 After upgrading my angular CLI and libraries, I am really struggling to make my project work. When I run ng test --source-map false I get the following error. What can I do to fix it? ERROR in node_modules/@types/jasmine/index.d.ts:20:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: ImplementationCallback, Exp ectedRecursive, Expected, SpyObjMethodNames, CustomEqualityTester, CustomMatcherFactory, ExpectationFailed, SpecFunction, SpyObj, jasmine

How do I write simple test to check the behaviour of MatDialog in Angular 2?

邮差的信 提交于 2019-12-13 03:21:52
问题 I have the following component: @Component({ selector: 'my-form', templateUrl: './my-form.component.html', }) export class MyFormComponent implements OnInit { @Input('company') company: CompanyInfo; private config: ConfigInterface | null; constructor(private companyService: CompanyService, private something: Something, private dialog: MatDialog) { } ngOnInit() { .... } theMtehodWhichIWantToTest(company: string) { if (someTest.indexOf(domain)) { this.dialog.open(MyAllertComponent, { data: {

“No spec found” is displayed after I use one jasmine reporter

社会主义新天地 提交于 2019-12-13 03:13:57
问题 I am using jasmine-node framework for my API automation. I am able to run REST services and able to get the result using node-fetch or http. Without reporter when I run with the below command I was able to get the results in console jasmine spec/xxx.spec.js After that I added a reporter(pretty html reporter) for reporting. Now when I run those commands, I get the below error. No specs found Below are my code for reporter.js var Jasmine = require('jasmine'); var HtmlReporter = require('jasmine

currentSpec in Jasmine 2 is undefined

纵饮孤独 提交于 2019-12-13 02:34:56
问题 I want to upgrade my test suite to the latest Jasmine version 2.3.4. I have some custom helper methods for testing AngularJS stuff inside my spy_helper.js like this: (function() { this.stubPromise = function(service, functionName) { var $q = jasmine.getEnv().currentSpec.$injector.get("$q") var $rootScope = jasmine.getEnv().currentSpec.$injector.get("$rootScope") var deferred = $q.defer(); var spy = spyOn(service, functionName).andReturn(deferred.promise); spy.andResolveWith = function(value)

How to use Jasmine to test if an instance is created?

筅森魡賤 提交于 2019-12-13 02:12:38
问题 Hi Am new to using Jasmine. The issue is as follows: I have a number of modules, managed through RequireJS. Now a module A creates an instance of another module B in it. Is it possible to use Jasmine to test whether an instance of B is being created in A? To convey a clearer idea of the code, we have: //In module A define(['B',],function(B){ function test(){ var newTest = new B(); }; return {test: test}; }); Now, how do i use Jasmine to test that module A indeed, creates an instance of module

NPM start throwing errors

与世无争的帅哥 提交于 2019-12-13 01:34:20
问题 Hi I am trying to install and run angular-phonecat project. install git ( windows ) from github Opened git shell.cloned the probject. I have node already installed so I opened node console and typed node --version.I got v0.10.9 back to git shell. did npm install in the angular-phonecat directory ( to install all dependencies as angular js suggests here:https://docs.angularjs.org/tutorial I got following error then: npm ERR! Error: No compatible version found: karma-chrome-launcher@'^0.1.4'

TriggerEventHandler in unit testing angular 4

守給你的承諾、 提交于 2019-12-13 01:24:26
问题 I had an element <button class="next-btn" (mouseup)="someMethod()">Next</button> I want to simulate mouseup event in testing and i do this const nextBtnElem = fixture.debugElement.nativeElement; const elem = nextBtnElem.getElementsByTagName('button')[1] elem.triggerEventHandler('mouseup', null); it doesn't work, but if i change it like this const nextBtnElem = fixture.debugElement.query(By.css('.next-btn'); nextBtnElem.triggerEventHandler('mouseup', null); Now its working. I can't understand

grunt-karma not running the spec file when using shared config

≡放荡痞女 提交于 2019-12-13 01:11:58
问题 I created a basic project to try and get Gruntjs, Karma and Jasmine to play together. When I setup the karma.conf.js file with all of the neccesary files, everything works and the tests pass. When I try to split them up in Grunt though, I get problems. Gruntfile.js grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), karma: { options: { configFile: 'karma.conf.js' }, basicController: { files: ['/basicController/scBasicControllerCtrl.js', '/basicController/test/ControllersSpec.js'] },

Protractor, Done and Expect, why do we need wait?

家住魔仙堡 提交于 2019-12-13 00:29:30
问题 I thought Done would make things run synchronously, meaning after I click a link, the click call back would happen after the click, apparently not as this doesn't work. browser.ignoreSynchronization = true; var firstURL = "https://www.google.com/?gws_rd=ssl"; describe("test", function () { browser.get("http://www.google.com"); it("Should be on google url", function () { expect(browser.getCurrentUrl()).toBe(firstURL); }); it("Should be able to type in text and click", function (done) { var ele

Jasmine testing .load() to get called URL

淺唱寂寞╮ 提交于 2019-12-12 23:02:35
问题 I have a function which loads a template and I want to check the correct URL is being called. As I can't find any information other than for spying on ajax calls, I'm presuming it's the same for .load() calls. I'm using Jasmine 2.4.1 Function function templateLoader() { var templateURL = '/path/to/template.html'; $('#myElement').load(templateURL, function(response, status, xhr) { if (status === "error") { common.templateError(templateURL, xhr); } else { ns.successFunction(); } }); } Jasmine