jasmine-node

'no method expect' when using Protractor as a library

左心房为你撑大大i 提交于 2019-12-12 17:06:54
问题 Using Protractor as a library Unable to require a reference to Jasmine. Referencing the expect method returns output Cannot call method 'expect' of null . Code updated to reflect comments: var protractor = require('protractor'); require('protractor/node_modules/minijasminenode'); require('protractor/jasminewd'); // output: jasmine is undefined (this error can only be seen if the above line is commented out) //expect(true).toBe(true); // output: Cannot call method 'expect' of null var driver =

Jasmine junit testing of delegate callback of function args

雨燕双飞 提交于 2019-12-12 02:49:59
问题 I have recently started using jasmine to write junit testcase for one of our application. I am stuck at this point on how to call the callBack function of the spied function. setProfile :function(userProfile,callback){ var user; var subjectInfo; iService.searchForAccess(subjectInfo , queryCalback); function queryCalback(err, userProfile) { if(err){ callback(true,errorMessage) }else{ callback(false,null) } } } Now in my spec i want to mock the call to iService.searchForAccess real world

Testing an angular (authenticated)service using jasmine

▼魔方 西西 提交于 2019-12-11 08:17:59
问题 I am new in jasmine and trying to write test case.. I am stuck need a little push/help. I am using JASEMINE in my MEAN app. Here is code!! Service angular.module('rugCoPro') .service('AuthenticationService', ['$http', 'ObjectUtils', 'Session', function($http, ObjectUtils, session){ var isError = function(data){ return (ObjectUtils.isObject(data) && data.hasOwnProperty("error")); }; /* * * login * */ this.login = function(username, password, errCallBack, successCallBack){ if(ObjectUtils

Nodejs Protractor + Jasmine + JUnitXmlReporter runs the test but without waiting for the browser

跟風遠走 提交于 2019-12-11 08:09:17
问题 Im doing end to end testing of a Angular website using protractor, but wanted to export the results to a file that Jenkins can read (JUnitXmlReporter), so for this to work I need to do a "simple change" to my protractor config file on the "onPrepare": exports.config = { // Do not start a Selenium Standalone sever - only run this using chrome. framework: 'jasmine', // Capabilities to be passed to the webdriver instance. capabilities: { 'browserName': 'chrome' }, specs: [ './test1.js', './test2

SyntaxError: Unexpected token with Jasmine

走远了吗. 提交于 2019-12-11 02:57:03
问题 I'm using the latest node and running jasmine tests on my project only to be met with jasmine-node spec Exception loading: /usr/src/app/spec/playground/playground.spec.js /usr/src/app/src/engine/playground.Soundcloud.js:1 (function (exports, require, module, __filename, __dirname) { import PLAYGROUND from 'playground.js' SyntaxError: Unexpected token import my package.json is { "main": "index.js", "scripts": { "server-server": "nodemon index.js", "dev" : "", "test": "jasmine-node spec", "dev

jasmine library “no specs found” when running same test twice

泄露秘密 提交于 2019-12-10 20:22:11
问题 I want to be able to run the same test twice from a node express server, but noticed the second run of the same test always gives "no specs found". Here is an example : jasmine-test.js : function jasmineExecute(fileName) { var jasmine = new Jasmine({}); jasmine.onComplete(function(x) { if (x) { jasmineExecute("./test.js"); // risk of infinite loop } else { console.log('Test failed : ' + fileName); } }); jasmine.execute([ fileName ]); } jasmineExecute("./test.js"); test.js : describe("We test

Jasmine unable to find Spec files

不问归期 提交于 2019-12-10 15:34:06
问题 In my MEAN project directory, I am trying to run Jasmine unit tests on my express controller. I was initially running node-jasmine however for added functionality I am changing to Jasmine 2.4. However I am running into problems with the location of the jasmine.json, and when I try and workaround, I run into errors in the jasmine source code. My jasmine.json currently reads: { "spec_dir": "spec", "spec_files": "**/*[sS]pec.js" } My file structure is: http://imgur.com/WHg0u8M my jasmine.json is

Protractor, Jasmine, and stopping test on first fail

*爱你&永不变心* 提交于 2019-12-09 06:22:27
问题 While trying to figure out how to make certain jasmine expect statements dependent on a previous expect statement I discovered that previous to Jasmine 2.3.0, there was not a way. (see Stop jasmine test after first expect fails) However, Jasmine 2.3.0 added an option stopSpecOnExpectationFailure that when set to true will stop a test on the first failure. Excited by this prospect, I modified my conf.js to include the option: /* * conf.js */ exports.config = { framework: 'jasmine', specs: [

grunt jasmine-node tests are running twice

↘锁芯ラ 提交于 2019-12-08 16:55:40
问题 I set up grunt to run node.js jasmine tests. For some reason, with this config, the results always show double the tests. Here is my config: I'm using jasmine-node which plugs into grunt. /spec/some-spec.js : var myModule = require('../src/myModule.js'); describe('test', function(){ it('works', function(done){ setTimeout(function(){ expect(1).toBe(1); done(); }, 100); }); }); Gruntfile.js : module.exports = function(grunt) { grunt.initConfig({ jasmine_node: { options: { forceExit: true }, all

Why does running `jasmine` after `jasmine init` and `jasmine examples` do nothing?

别说谁变了你拦得住时间么 提交于 2019-12-08 15:41:01
问题 I have globally installed jasmine by running npm install jasmine -g . Running jasmine -v gives me jasmine v2.5.0 jasmine-core v2.5.0 I have then, as per the docs, run jasmine init jasmine examples This created the expected /spec directory and the spec/support/jasmine.json file. I am under the impression that if I now run jasmine I should see some test output in the console. Instead it simply thinks about it for a second and then does nothing. I'm running node v4.5.0 on a Windows 7 machine in