Integration of Jasmine Spec framework with Node.js
Questions tagged [jasmine-node]
327 questions
3
votes
1 answer
Async Tests are not working with protractor
I am trying to call done() for async tests but that is not working, i am getting 'undefined is not a function' error.
describe('Login screen tests', function () {
var ptor = protractor.getInstance();
beforeEach(function(){
console.log('In…

Vikram
- 509
- 1
- 11
- 26
3
votes
1 answer
How to write a jasmine test suite that depends on variables from another suite? (jasmine 1.3)
I am writing protractor test suites, and need to test something that is uses pages generated from another suite. I can only figure out one way to write the test, but it doesn't seem like a good way to write it:
var someStuffToSave =…

Eric Wooley
- 646
- 4
- 17
3
votes
1 answer
The module property is undefined when using vm.runInThisContext
Here is a function from jasmine 2.0.0 standalone project:
function getJasmineRequireObj() {
if (typeof module !== "undefined" && module.exports) {
return exports;
} else {
window.jasmineRequire = window.jasmineRequire || {};
…

Ikaso
- 2,268
- 19
- 26
3
votes
3 answers
Spying on asynchronous functions with jasmine
I'm using jasmine-node to test my server. I want to fake/bypass some validation related code in my user class. So I would set up a spy like this -
var user = {
email: 'email@email.com',
password: 'password'
}
spyOn(User,…

sonicboom
- 4,928
- 10
- 42
- 60
3
votes
1 answer
jasmine-node waitsFor() stops all future runs()
The first runs creates a user, and the second runs gets the user from the server. The WaitsFor is supposed to cause the second runs to wait until the first runs is done. However, when running node-jasmine, the test stops after before:…

az_
- 1,493
- 1
- 16
- 24
3
votes
1 answer
testing remote IP address behaviors on a Node Express server
I'm writing unit tests for a Node.js Express server. The server does some stuff that depends on the remote client's IP address, retrieved using req.ip on the server.
How can I write unit tests that will spoof their own IP addresses to test the…

jab
- 4,053
- 3
- 33
- 40
3
votes
0 answers
How to set window.Handlebars with jasmine using jasmine-node
I'm trying to run my usual jasmine-node tests with ember.js and because ember requires handlebars to be loaded I included that library also.
Yet for some reason when ember hits this code
window.Handlebars
I get undefined.
Here is how i'm loading…

Toran Billups
- 27,111
- 40
- 155
- 268
2
votes
0 answers
How do I get jasmine.json to include my declaration merge files?
In my application, I am using declaration merging to customize the Request type from Express.
declare global {
namespace Express {
export interface Request {
base?: BaseServerInfo;
}
}
}
The problem is that Jasmine is not picking…

CodyBugstein
- 21,984
- 61
- 207
- 363
2
votes
0 answers
Empty karma html report
Here are the facts:
I have a nodejs app
I've written some Jasmine tests
I'm using karma to generate the code coverage report
Here is the karma.conf.js:
module.exports = function (config) {
config.set({
frameworks: ['jasmine',…

sirfoga
- 121
- 4
2
votes
2 answers
Property 'jasmineMatches' is missing in type 'x'
After ng test
Expected output: i get pass/fail on x amount of tests.
Actual ouput:
ERROR in src/app/todo-data.service.spec.ts(19,45): error TS2345: Argument of type 'Todo[]' is not assignable to parameter of type 'Expected>'.
…

Robert
- 504
- 5
- 27
2
votes
0 answers
Jasmine + Karma + Istanbul testing: self and/or window is undefined
I am working with a project that needs to be tested (unit testing). Jasmine is already working fine however, we need a coverage.
Searched about it and Jasmine + Karma + Istanbul can do the work.
I am struggling with the complications between Karma…

Kyl San Antonio
- 21
- 1
- 5
2
votes
1 answer
Cannot find module '_debugger' while using jasmine-debug or jasmine-node-debug
I have few tests that I have written using jasmine. I want to debug those tests and so I am using jasmine-debug module
sh-3.2# jasmine-debug
module.js:540
throw err;
^
Error: Cannot find module '_debugger'
at…

j10
- 2,009
- 3
- 27
- 44
2
votes
2 answers
SyntaxError: Unexpected token with Jasmine
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,…

Kendall
- 5,065
- 10
- 45
- 70
2
votes
1 answer
How to run pre-requisites before all suites in Jasmine
I have NodeJS project with jasmine specs . I want to run pre-requisites before running all specs in the suite for creating pre-requisite test data for the complete suite.
For individual spec , it can be done using beforeAll method, but I want to…

Rocky
- 857
- 2
- 8
- 15
2
votes
1 answer
Using AWS CodeBuild or Lambda to run jasmine tests before deployment
Folks,
Have been trying to figure out the correct way to fire of a CodeBuild project which either produces the artifact after compiling and running jasmine tests, or fails and stops the CodePipeline from proceeding with deployment.
If my…

Cmag
- 14,946
- 25
- 89
- 140