karma-runner / karma-jasmine Goto Github PK
View Code? Open in Web Editor NEWA Karma plugin - adapter for Jasmine testing framework.
License: MIT License
A Karma plugin - adapter for Jasmine testing framework.
License: MIT License
There should be a way to force running a test not by simply checking whether it's defined with iit
(as it is now) but also by scoring each ocurrentce of iit
and only running those with the highest score:
ddescribe('Module: foo (to run tests only for this very module)', function () {
ddescribe('Service: foo to run tests only for this service', function () {
iit('should run because it is forced');
});
describe('Service: bar', function () {
iit('Now runs because it is forced. I suggest it should not run because it has less ddescribes on the "way" to this iit then the first one in this snippet.');
});
})
The same expressed using the suite factory:
ddescribe('Module: foo (to run tests only for this very module)', function () {
function mySuiteFactory(data) {
return function () {
iit('should run because it is forced And now it runs 2 times - for both describes', function () {
// use the `data` given to the factory.
});
// I suggest running the test above only when it's top scored.
}
}
ddescribe('Service: foo to run tests only for this service', mySuiteFactory(data1));
describe('Service: bar (where the test should not run despite the fact it is forced)', mySuiteFactory(data2));
})
Real life example:
I have a simple service that is responsible for converting different forms of an expression with the same meaning. I have 5 ways to express the same thing: 4 of them are strings and the 5th is a collection of object. Each way (or as I call it: a variant) is used in different circumstances but all of them are capable of expressing the same logic.
I built a factory that returns the suite of cases that cover all the conversions. A fixture with the same thing expressed in 5 variants is the argument of the factory. Result of calling this factory may be passed as the 2nd argument of describe
:
function getCrossTestsFor(data) {
return function () {
let converter;
beforeEach(inject(function (converterService) {
converter = converterService;
}));
it('should get converted from `variant1` to `variant2`', function () {
expect(converter.variant1.toVariant2(data.variant1)).toBe(data.variant2);
});
// And 19 more "its": 5 variants = 5*(5-1) "its"
}
}
The same may be expressed without returning wrapped in an anonymous function but this way it can be passed as the 2nd argument of describe right away.
Then I define a suite like this:
describe('value `undefined`', getCrossTestsFor({
variant1: undefined,
variant2: undefined,
variant3: undefined,
variant4: undefined,
variant5: undefined,
}));
describe('value "empty string"', getCrossTestsFor({
variant1: '',
variant2: '',
variant3: '',
variant4: '',
variant5: [],
}));
And I have many such sub-suites (all in all: n*20 tests).
When something breaks I get many errors due to the nature of how the the suite is defined: When something breaks it affects more than one it
either because of the error in decoding a variant or in encoding the decoded data back to some other.
I have meaningful error messages like this:
FAIL: value "empty string" should get converted from `variant1` to `variant2`
But I cannot run only this single test.
I tend to fix tests one by one by forcing only one to run. I don't know if it's a good practice generally but it's a good one in my case ;) I do this by forcing certain suites or certain tests. But it's not possible in this case, when suite factory pattern is used.
I also tried to define it
s in loops but though it seems to be a cleaner way to test large portions of data It came out that this pattern is far more difficult to debug: Not only I have to force the it
in loop (or loopsas it was in my case) but I also have to make sure the loop (or each of the loops) is run only once to run a single test. Effectively I have to comment out large portions of my data fixture apart from of just using the jasmine-karma feature of forcing a test or a suite (iit
, ddescribe
).
Back to the topic: Putting ddescribe
before any suite results in running "only" 20 of my tests. Some of them are broken, some are not.
Putting iit
before one of the tests that fail results in running n
tests (not one!). This is because in fact this iit
ed test is present in n
describes (see the abstract example at the beginning).
I found the way to extract only one of my (n*20) tests and focus on fixing this one: I force (ddescribe
) the suite that fails but instead of iit
ing the failing test one I exclude (xit
) all the others.
Only this combination results in running the particular test that I want to focus on. But the procedure is laborious.
I wonder if it might be simplified.
During these two minor releases, the possibility to mock Date() has been reinserted to Jasmine.
I believe this is just a documentation issue. See the README for what I'm talking about.
npm ERR! peerinvalid The package karma-jasmine does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants karma-jasmine@~0.1.0
Perhaps related to karma-runner/karma#940. Looks like package.json
should update karma
in devDependencies
to ~0.12
?
It seems to have been removed by commit 207018b
I just got following error when installing karma-jasmine
npm http GET http://registry.npmjs.org/karma-jasmine
npm http GET http://registry.npmjs.org/karma-jasmine
npm http GET http://registry.npmjs.org/karma-jasmine
npm ERR! notarget No compatible version found: karma-jasmine@'>=0.2.0-0 <0.3.0-0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.1.5","0.1.4","0.1.3","0.1.2","0.1.1","0.1.0","0.0.3","0.0.2","0.0.1"]
It only causes problems anyway.
karma-jasmine
version on https://www.npmjs.org/package/karma-jasmine is shown as 0.1.5
. The latest version on GitHub is 0.2.2
. Is npmjs.org page not being maintained? Should I always use GitHub for latest and greatest?
Thank you.
The drivers (and this may be a driver issue) working with Jasmine 1.X would result in concise assertion failure reports along the lines of:
PhantomJS 1.9.8 (Mac OS X) ngFromHtml() should work for simple dynamic html FAILED
Expected '' to be '2'.
PhantomJS 1.9.8 (Mac OS X): Executed 4 of 4 (1 FAILED) (0.005 secs / 0.022 secs)
However, under Jasmine 2.x, we get duplicated errors messages:
PhantomJS 1.9.8 (Mac OS X) ngFromHtml() should work for simple dynamic html FAILED
Expected '' to be '2'.
Error: Expected '' to be '2'.
at /Users/werdna/wiz-dev-env/test/environment.js:33
at /Users/werdna/wiz-dev-env/node_modules/karma-jasmine/lib/boot.js:126
at /Users/werdna/wiz-dev-env/node_modules/karma-jasmine/lib/adapter.js:171
at http://localhost:9876/karma.js:189
at http://localhost:9876/context.html:49
The latter yields overlong messages and lots of undesireable cruft.
Whaddya think? I'm happy to research this, but perhaps there is a simple and obvious solution my colleagues may provide?
I am using karma-jasmine: 0.3.5. I have tests that run perfectly from a HTML runner that loads jasmine 2.2 but when I run them through karma using karma-jasmine they fail. I have investigated the problem and it seems that the tests start executing before the DOM is ready (which is not the case when run from a HTML runner). After updating the createStartFn function in the adapter.js file to the code below which waits for the DOM ready the tests started passsing.
function createStartFn(karma, jasmineEnv) {
// This function will be assigned to `window.__karma__.start`:
return function () {
$(function () {
jasmineEnv = jasmineEnv || window.jasmine.getEnv();
jasmineEnv.addReporter(new KarmaReporter(karma, jasmineEnv));
jasmineEnv.execute();
});
};
}
Hi
I'm having issues using Jasmines clock mock with Karma.
I have reported the issue to Jasmine here but since the issue is only present with Karma I report it here instead.
The following test does not work with Karma in IE 8.
describe('Clock', function() {
beforeEach(function() {
jasmine.clock().install();
});
afterEach(function() {
jasmine.clock().uninstall();
});
it('works in IE 8', function() {
var test = jasmine.createSpy('timeout');
setTimeout(test, 1000);
jasmine.clock().tick(1000);
expect(test).toHaveBeenCalled();
});
});
It works with Jasmines SpecRunner.html.
I have done some experimenting and I can break Jasmines clock mock in IE 8 by calling setTimeout()
before the first use of the mock.
The https://www.npmjs.org/package/karma-jasmine reports the latest version as 0.1.5
, though according to the GitHub the latest version is 0.2.2
. Should npm info be updated?
How do I set the value of CATCH_EXCEPTIONS = false in the karma.config? Jasmine is hiding all the necessary info to debug a unit test. Useless without it.
ReferenceError: browser is not defined in http://localhost:51328
here is my code:
describe('SDJS Navigation Scenarios', function() {
beforeEach(function() {
browser().navigateTo('../../index.html');
});
// Navigation Tests - BEGIN
it('main navigation options', function() {
expect(element('[ng-controller] ul li a').text()).toMatch(Home);
expect(element('[ng-controller] ul li a').text()).toMatch(Design);
expect(element('[ng-controller] ul li a').text()).toMatch(Insert);
expect(element('[ng-controller] ul li a').text()).toMatch(Page);
expect(element('[ng-controller] ul li a').text()).toMatch(Review);
expect(element('[ng-controller] ul li a').text()).toMatch(Help);
});
});
--any suggestions...thank you
Hi all,
When i run my Karma i am receiving an issue "TypeError: Cannot read property 'description' of undefined" and i think is due the JSON files are not loading properly when i run Karma.
Here you are same screemshots:
1 - I have an spec file that is loading JSON files:
Do you know how to kix that issue?
Regards
Javi
It would great to have it updated, many thanks.
http://jasmine.github.io/2.1/introduction.html
https://github.com/pivotal/jasmine
I've updated karma-jasmine
from 0.3.4 to 0.3.5 and I can no longer use the debug mode (I tested in Chrome and Firefox). The execution fails with the following errors:
Uncaught TypeError: Cannot read property 'args' of undefined - adapter.js:292
Uncaught TypeError: undefined is not a function - debug.html:35
The first error comes from this line:
return getGrepOption(config.args); // config is undefined
And the second one comes from here:
loaded: function() {
this.start(); // this doesn't have a start method
}
I tracked down the first line to commit 4213b18, but I couldn't find the second one. I think it doesn't belong to karma-jasmine
and it's a side effect of the first error.
FWIW, While I was reading the adapter.js
file I noticed that there's a duplicate block of code:
/**
* Extract grep option from karma config
* @param {[Array|string]} clientArguments The karma client arguments
* @return {string} The value of grep option by default empty string
*/
var getGrepOption = function(clientArguments) {
var clientArgString = clientArguments || '';
if (Object.prototype.toString.call(clientArguments) === '[object Array]') {
clientArgString = clientArguments.join('=');
}
var match = /--grep=(.*)/.exec(clientArgString);
return match ? match[1] : '';
};
The same code appears again starting at line 255.
Is there any reason why Jasmine is bundled with karma-jasmine instead of listed as a dependency? This caused me some trouble when debugging…
Please update Jasmine Core to version 2.0.1 or higher. This will provide us the functionality of using
jasmine.clock.mockDate()
I am updated to these versions:
karma: 0.12.28
karma-jasmine: 0.3.2
jasmine-core: 2.1.3
and a few reporters/preporcessors. Haven't had issues until upgrading from:
karma: 0.12.22
karma-jasmine: 0.2.2
It seems to get stuck on xdescribe
s no matter how long the timeout period is.
Let me know if you need more information!
Let's consider this simple test:
describe('suite', function () {
iit('spec', function () {
expect(1).toBe(1);
});
});
The problem is that onSpecComplete(browser, result)
is called with empty result.suite
.
As a result Jump To Source
action (from right-click menu on a test tree node) in WebStorm Karma integration doesn't work.
Also ddescribe
cuts upper suites:
describe('suite', function () {
ddescribe('sub-suite', function () {
it('spec', function () {
expect(1).toBe(1);
});
});
});
Here onSpecComplete(browser, result)
is called with result
equals to
{
description: 'spec',
suites: ['sub-suite'],
...
}
Hi
I'm using karma-jasmine v0.2.2.
When my test files become bigger and bigger I get the following error:
PhantomJS 1.9.7 (Mac OS X) ERROR
TypeError: 'null' is not an object (evaluating 'currentSpec.expect')
at /Users/kentarowakayama/CODE/ANGULAR/fischer/node_modules/karma-jasmine/lib/jasmine.js:698
In version 0.3 we have error message like this:
Jasmine__TopLevel__Suite Todo Controller having some saved Todos should count Todos correctly FAILED
String Jasmine__TopLevel_suite
break Jump to source in WebStorm.
karma-jasmine 0.3.3 and 0.3.4 doesn't support ddescribe
and iit
. karma-jasmine 0.3.2 does. Looking at the commit queue, the lib/boot.js
file has been completele reorganized between 0.3.2 & 0.3.3, changing API in the process (207018b). Such things shouldn't happen in a patch release, it's a breaking change.
0.3.3 should really be 0.4.0. Could you release 0.3.5 that is a re-release of 0.3.2 and bump 0.3.4 master to 0.4.0? Otherwise people that include "karma-jasmine": "~0.3.2"
may now have their builds broken.
I have some tests that uses socket.io. The debug view fails in this scenario
Uncaught TypeError: Cannot read property 'transport' of undefined from line https://github.com/karma-runner/karma-jasmine/blob/master/src/adapter.js#L42
This is related to #5.
I reported same issues under jasmine-jquery project, but no one assigned yet. I have no idea about this issus.
I just post here to ask for help then :)
PS: I am using jasmine-jquery 2.0.0 and karma-jasmine 0.1.5
I was using the 0.2.1 package but today I can't seem to install it again:
npm http GET https://registry.npmjs.org/karma-jasmine
npm http GET https://registry.npmjs.org/karma-jasmine
npm http GET https://registry.npmjs.org/karma-jasmine
npm ERR! Error: No compatible version found: karma-jasmine@'>=0.2.0- <0.3.0-'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.2","0.0.3","0.1.0","0.1.1","0.1.2","0.1.3","0.1.4","0.1.5"]
npm ERR! at installTargetsError (/usr/local/Cellar/node/0.10.12/lib/node_modules/npm/lib/ca
che.js:719:10)
npm ERR! at next (/usr/local/Cellar/node/0.10.12/lib/node_modules/npm/lib/cache.js:698:17)
npm ERR! at /usr/local/Cellar/node/0.10.12/lib/node_modules/npm/lib/cache.js:678:5
npm ERR! at saved (/usr/local/Cellar/node/0.10.12/lib/node_modules/npm/node_modules/npm-reg
istry-client/lib/get.js:138:7)
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <[email protected]>
Note none of the 0.2.x among the install targets. Was the package yanked for some reason?
I have the same test code running on version 0.1.5, but breaks on 0.2.1
Hi,
I've forked karma-jasmine, and have some problems installing it directly from github. I've included my fork like this in my package.json
of a test project:
"karma-jasmine": "git://github.com/23tux/karma-jasmine.git#prettyPrint"
The problem is, that the adapter.js
isn't created. I've seen, that this file is generated with a grunt build
call inside karma-jasmine. I've played around with
"scripts": {
"test": "grunt test",
"postinstall": "./grunt build"
},
inside the package.json
from karma-jasmine, but with no luck.
So, can someone tell me what the guidelines for contribution are? Do you compile the adapter.js
manually and add it to the npm package? Or is there any way around, to install it directly from a github source?
Firstly thankyou for creating this usefull karma plugin, I've found it a great help with my work.
For a project I was working on I wanted to to use the imagediff framework for Jasmine to test some images.
I created an adapter that allowed me to do this with the karma-requirejs framework as my project used require.js, that adapter can be found here: karma-jasmine-imagediff.
When imagediff
detects an error it outputs HTML showing the given, expected and diff images that you are testing as show here. This HTML output breaks karma-jasmine, specifically in function formatFailedStep
in adapter.js:7 where stack.indexOf('\n')
fails.
A quick fix for myself was to detect this and append step.message
to the document.body
if there was HTML output.
I think that there must be a better solution but I am not experienced enough with either jasmine or karma to issue a pull request.
Thanks a lot 👍
Hello, hopefully this is the right place to post. I was wondering when Jasmine 2.0 will be available with karma (karma-jasmine). I like how jasmine tests async functions in 2.0, but currently there is no way for me to use Jasmine 2.0 (or is there?).
Thank you!
Using karma start karma.conf.js in console.
Launches Chrome
Click Debug
Opens http://localhost:8082/debug.html
Open Dev Tools Console
Uncaught TypeError: Cannot read property 'transport' of undefined adapter.js:44
I get the same error debugging my test from IntelliJ IDEA, which includes the following stack trace:
Uncaught TypeError: Cannot read property 'transport' of undefined adapter.js:44:76
getCurrentTransport adapter.js:44:76
reportRunnerStarting adapter.js:84:21
(anonymous function) jasmine.js:1869:39
jasmine.Runner.execute jasmine.js:2222:23
jasmine.Env.execute jasmine.js:864:23
(anonymous function) adapter.js:158:16
window.__karma__.loaded debug.html:17:14
(anonymous function) debug.html:2:22
beforeAll() and afterAll() are supported with Jasmine 2.1, but after installing the latest karma-jasmine (0.3.2) I got messages of them being undefined.
Adding the following to boot.js helped:
beforeAll: function(beforeAllFunction) {
return env.beforeAll(beforeAllFunction);
},
afterAll: function(afterAllFunction) {
return env.afterAll(afterAllFunction);
},
Running the latest karma-jasmine
, I'm noticing this error. Looking at the code there is no adapter.js
file within the lib
directory. I tried manually setting it to read the src/adapter.js
file, but it only got rid of the warning and I still encountered the __karma__.start method!
error.
INFO [karma]: Karma v0.12.28 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
WARN [watcher]: Pattern "/Users/chesleybrown/Sites/bln-web/node_modules/karma-jasmine/lib/adapter.js" does not match any file.
INFO [PhantomJS 1.9.8 (Mac OS X)]: Connected on socket Ye-LnkBcsCrVxrp6yzO- with id 91682340
PhantomJS 1.9.8 (Mac OS X) ERROR
You need to include some adapter that implements __karma__.start method!
this.addMatchers({
toEqualData: function(expected) {
return angular.equals(this.actual, expected);
}
});
The code above no longer works
TypeError: Object #<Object> has no method 'addMatchers' at Object.<anonymous> (/home/deyine/workspace/my-project/test/spec/modules/contact/controllers.js:7:10)
I get the following when I check for outdated packages:
$npm outdated --depth=0
Package Current Wanted Latest Location
karma-jasmine 0.2.2 0.2.2 0.1.5 karma-jasmine
Latest should point to 0.2.2 instead of 0.1.5. And a dist-tag '1_0' could point to the old version instead.
Am I reading https://github.com/karma-runner/karma-jasmine/blob/master/package.json#L24 wrong or is karma-jasmine listed as a devDependency of itself?
npm ERR! peerinvalid Peer [email protected] wants karma@~0.9, but current version is v0.8.7 (2013-07-18)
Running the common command
sudo npm -g install grunt-cli karma bower
produces the following errors:
Debug Log: https://docs.google.com/file/d/0BwV7xb-E6LSNU2MwN0ZnakxwMmc/edit?usp=sharing
> [email protected] install /usr/local/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/bufferutil.node
SOLINK_MODULE(target) Release/bufferutil.node: Finished
CXX(target) Release/obj.target/validation/src/validation.o
SOLINK_MODULE(target) Release/validation.node
SOLINK_MODULE(target) Release/validation.node: Finished
/usr/local/bin/karma -> /usr/local/lib/node_modules/karma/bin/karma
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/couch-login requires request@'~2.9.202' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/request,
npm WARN unmet dependency which is version 2.21.0
npm ERR! peerinvalid The package karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants karma@~0.9
npm ERR! System Darwin 11.4.2
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "-g" "install" "grunt-cli" "karma" "bower"
npm ERR! cwd /Users/per/Workspace/ng-boilerplate
npm ERR! node -v v0.10.13
npm ERR! npm -v 1.3.2
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/per/Workspace/ng-boilerplate/npm-debug.log
npm ERR! not ok code 0
When using Jasmine outside of Karma, there's a built in web ui which gives a progress report of tests as well as lets users select features and individual tests to run.
Is this an option in karma-jasmine?
I am using WebStorm combined with karma to run Jasmine javaScript unit tests. If I have nested describe statements then karma is crashing, or maybe it's WebStorm crashing, I'm not sure.
The karma error output says:
ERROR [karma]: [TypeError: Cannot read property 'should return a Foo' of undefined]
Any idea where the problem might be?
Code is found in my question here:
When connecting to Karma get these errors:
Firefox 23.0.0 (Mac OS X 10.7) ERROR
TypeError: window.parent.io.sockets[((location.protocol + "//") + location.host)] is undefined
at /tmp/node_modules/karma-jasmine/lib/adapter.js:44
Chrome 29.0.1547 (Mac OS X 10.7.5) ERROR
Uncaught TypeError: Cannot read property 'transport' of undefined
at /tmp/node_modules/karma-jasmine/lib/adapter.js:44
Karma version:
0.10.2
Karma-jasmine version:
0.1.3
Node.js version:
v0.10.14
Os info:
Linux version 2.6.32-358.11.1.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) )
The test case throws the following error:
Chrome 29.0.1547 (Linux) Test test 1 FAILED
ReferenceError: browser is not defined
at null.<anonymous> (http://localhost:9876/base/test/test_index.html.js?1381331939000:6:9)
Chrome 29.0.1547 (Linux): Executed 1 of 1 (1 FAILED) ERROR (0.254 secs / 0.07 secs)
My karma config file is:
// Karma configuration
// Generated on Wed Oct 09 2013 17:04:44 GMT+0200 (CEST)
module.exports = function (config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath:'',
// frameworks to use
frameworks:['jasmine'],
// list of files / patterns to load in the browser
files:[
'test/*.js'
],
// list of files to exclude
exclude:[
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters:['progress'],
// web server port
port:9876,
// enable / disable colors in the output (reporters and logs)
colors:true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel:config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch:true,
urlRoot:'/__karma/',
proxies:{
'/':'http://localhost:3000/'
},
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers:['Chrome'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout:60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun:false
});
};
My test case is:
describe('Test', function(){
beforeEach(function(){
browser().navigateTo('/index.html')
})
it('test 1', function(){
console.log('doc',document)
expect(true).toBe(true)
})
})
Even if i move browser().navigateTo('/index.html') outside of beforeEach, nothing changes
This seems to occur if:
karma-jasmine
0.2.1, which upgraded to Jasmine 2it('unfortunately throws a TypeError', function () {
inject(function (aService) {
// code...
});
});
TypeError: Cannot read property 'running' of undefined
at isSpecRunning (angular-mocks.js:1923:65)
at window.inject.angular.mock.inject (angular-mocks.js:2087:12)
...
You can work around it by passing the result of inject
directly to the it
call.
it('works as expected', inject(function (aService) {
// code...
}));
On a fresh install of brew, node, npm, karma and Chrome under OSX 10.9.1, I'm repeatedly seeing this error:
Chrome 31.0.1650 (Mac OS X 10.9.1) ERROR
Uncaught TypeError: Cannot read property 'host' of undefined
at /usr/local/lib/node_modules/karma-jasmine/lib/adapter.js:40
Chrome 31.0.1650 (Mac OS X 10.9.1): Executed 0 of 0 ERROR (0.854 secs / 0 secs)
Bizarrely I could reproduce this issue when using PhantomJS and Firefox as the clients as well. I'm thoroughly confused. When inspecting in Chrome it looks like line 40 of adapter.js is:
var parentWindow = window.opener || window.parent;
Chrome claims parentWindow is just a plain Object, not a Window object and returns:
> parentWindow
Object {}
> parentWindow.location
undefined
which is clearly the source of the error, but I have no idea why. Attempting to reproduce this error on another computer has proven futile.
Try this:
expect('Hello\nWorld').toBe(0);
The displayed error message is:
FAILED TESTS:
myTest
myOtherTest
✖ should work
PhantomJS 1.9.8 (Mac OS X)
World' to be 0.
Error: Expected 'Hello
at /var/folders/(...)/blablabla-test.js:126:0
The problem is that in the function getRelevantStackFrom(stack)
the stack is splitted by \n
and when the stack also contains the error message the output is formatted wrong in the function formatFailedStep(step)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.