452 2014-05-14 17:21:51 chenglou boom 453 2014-05-14 17:21:59 jeffmo who is this chenglou guy? 454 2014-05-14 17:22:29 chenglou ¯\\_(?)_/¯ 455 2014-05-14 17:22:32 balpert o/ 456 2014-05-14 17:23:15 chenglou jeffmo: what's the reason behind using toBeCalled rather than jasmine's toHaveBeenCalled? 457 2014-05-14 17:23:20 chenglou and also, xit 458 2014-05-14 17:23:23 chenglou xdescribe 459 2014-05-14 17:24:12 jeffmo chenglou: good question on toBeCalled/toHaveBeenCalled — I’ve wondered that myself (it’s just layover from jst really). I suspect it was to leave support for using regular jasmine spies if you wanted to 460 2014-05-14 17:24:36 jeffmo chenglou: not sure what you mean by xit/xdescribe — they’re available too 461 2014-05-14 17:25:04 balpert jest should have a mode where it prints out a line for each test it's running 462 2014-05-14 17:25:06 balpert more fun that way 463 2014-05-14 17:25:27 chenglou ah, not in API docs 464 2014-05-14 17:25:34 chenglou I'll open up issues 465 2014-05-14 17:25:37 jeffmo balpert: yea +1 on that — wanna make an issue? 466 2014-05-14 17:25:46 jeffmo chenglou: oops, nice catch — I’ll add it 467 2014-05-14 17:27:22 balpert chenglou: noo you broke my issue streak 468 2014-05-14 17:27:35 chenglou lol 469 2014-05-14 17:29:37 chenglou it's not clear that jest _could_ be test library-agnostic from the docs right now. Beside the brief mentions of jasmine that people might miss, I think it gives the impression that it's reinventing the wheel rather than actually leveraging jasmine 470 2014-05-14 17:30:30 jeffmo chenglou: yea but only because its not *right now*. It would’ve been harder to describe something like “jest uses jasmine today — but at some point we want to make it work with alltheframeworks too" 471 2014-05-14 17:30:56 jeffmo so that can come as a “new feature" later I figure 472 2014-05-14 17:31:58 balpert jeffmo: bump version and publish on npm? https://www.npmjs.org/package/jest-cli 473 2014-05-14 17:32:10 jeffmo balpert: ah right 474 2014-05-14 17:32:16 chenglou right, but I'm more thinking in like of, say, mocha. The first time I saw mocha my impression was "it also uses describe/it/optional expect format", so did they just reinvent jasmine 475 2014-05-14 17:32:29 chenglou but yeah, alright 476 2014-05-14 17:32:54 chenglou also just overly excited lol 477 2014-05-14 17:33:59 chenglou man this is great 478 2014-05-14 17:37:16 chenglou jeffmo: does angular's karma run tests in parallel? 479 2014-05-14 17:37:20 chenglou or any other js testing lib 480 2014-05-14 17:37:32 chenglou I wanna comment on that on HN but don't wanna look ignoratn 481 2014-05-14 17:38:32 jeffmo chenglou: I don’t know about karma specifically — but I don’t know of any other libs 482 2014-05-14 17:38:52 jeffmo “dont want to look ignorant” — on hacker news?? :p 483 2014-05-14 17:39:14 chenglou lol 484 2014-05-14 17:43:40 balpert jeffmo: want to comment and say you want to make it more general? https://news.ycombinator.com/item?id=7745004 485 2014-05-14 17:44:40 chenglou should jest-cli be installed globally like grunt-cli? I guess no point? 486 2014-05-14 17:45:24 balpert chenglou: after https://github.com/facebook/jest/issues/3, probably 487 2014-05-14 17:45:27 balpert right now, probably not 488 2014-05-14 17:47:30 vjeux balpert: the og image is really awesome 489 2014-05-14 17:47:48 chenglou oh god I'm running jest locally, non my personal laptop 490 2014-05-14 17:47:50 chenglou this feels so great 491 2014-05-14 17:48:01 chenglou dat familiar green `PASS` 492 2014-05-14 17:48:34 balpert vjeux: thanks 493 2014-05-14 17:50:08 jeffmo balpert: commented 494 2014-05-14 17:57:34 chenglou ok I'll stop creating issues 495 2014-05-14 17:57:49 jeffmo chenglou: these are all really good — don’t stop if you have more things 496 2014-05-14 18:06:51 Ajay_ Hi 497 2014-05-14 18:07:12 vjeux Ajay_: hey 498 2014-05-14 18:07:43 Ajay_ i am wondering how i do i test some routes in jest 499 2014-05-14 18:08:03 Ajay_ something like module.exports = { '/wishform/user': { 500 2014-05-14 18:09:06 vjeux jest.dontMock('../routes.js'); .... var routes = require('../routes.js'); expect(routes['/wishform/user']).toEqual({...}); 501 2014-05-14 18:09:09 vjeux something like this? 502 2014-05-14 18:09:36 jeffmo Ajay_: Can you be a bit more specific? What do you want to test about the routes? 503 2014-05-14 18:11:02 chenglou "Jest is one of Facebook's first open source projects that is both under very active development and is also being used to ship code to everybody on facebook.com." 504 2014-05-14 18:11:04 chenglou one of first? lol 505 2014-05-14 18:11:23 jeffmo “one of the first that is both under active dev and also being used to ship code” 506 2014-05-14 18:11:24 vjeux chenglou: i copy and pasted that from react website :p 507 2014-05-14 18:11:31 jeffmo I noticed that too when I first read it :) 508 2014-05-14 18:11:31 balpert haha 509 2014-05-14 18:11:40 vjeux feel free to reworf 510 2014-05-14 18:11:41 vjeux reword 511 2014-05-14 18:12:19 Ajay_ @jeffmo: https://gist.github.com/ajayk/b87de836557e00e48ad6 512 2014-05-14 18:13:22 Ajay_ @jeffmo : i would like to send a req and test various control flows 513 2014-05-14 18:13:22 jeffmo Ajay_: ah cool — so maybe you want to write a test for each aspect of each page. 514 2014-05-14 18:13:38 jeffmo so you can start with the code vjeux sent above 515 2014-05-14 18:15:06 Ajay_ Thanks !! 516 2014-05-14 18:16:24 vjeux Ajay_: you should pass in a mock function 517 2014-05-14 18:16:39 vjeux http://facebook.github.io/jest/docs/mock-functions.html#content 518 2014-05-14 18:16:46 vjeux and see that it's being called with the right arguments 519 2014-05-14 18:17:23 jeffmo Ajay_: I’m writing up an example test in a gist for you too — maybe that will help get you going 520 2014-05-14 18:17:32 Ajay_ @vjeux: i need to mocl few Aws calls 521 2014-05-14 18:17:52 Ajay_ That reminds me to refactor the code further on :-) 522 2014-05-14 18:17:59 vjeux Ajay_: yup, look at the tutorial, it explains how to mock async calls 523 2014-05-14 18:18:43 Ajay_ i will play around jest today , seems promising :-) 524 2014-05-14 18:19:20 vjeux feel free to ask if you are stuck somewhere, we haven't yet had the chance to get a lot of feedback from people outside of fb :) 525 2014-05-14 18:22:04 Ajay_ sure .. Thanks a lot , i will wait for few more examples to get some more understanding 526 2014-05-14 18:24:04 jeffmo Ajay_: I’ll need a couple of mins before I can finish with that example — I’m starving and need to get some food :) be back in a few 527 2014-05-14 18:24:40 Ajay_ @jeffmo: Bon apetit 528 2014-05-14 18:26:03 jeffmo Ajay_: be sure to check out the tutorials on the site though. You might figure it out on your own before I even get back! 529 2014-05-14 18:26:30 Ajay_ yeah ... i will try 530 2014-05-14 18:32:03 vjeux jeffmo: https://github.com/facebook/jest/issues/10 531 2014-05-14 18:32:05 vjeux that's a good question 532 2014-05-14 18:32:15 vjeux should probably be a config? 533 2014-05-14 18:52:01 vjeux http://fredkschott.com/post/2014/05/nodejs-testing-essentials/ 534 2014-05-14 18:52:14 vjeux looks like jest is all of this combined 535 2014-05-14 19:38:30 jeffmo love this thread https://twitter.com/domenic/status/466628824302907393 — may the discussion begin! 536 2014-05-14 19:40:00 vjeux nice 537 2014-05-14 19:57:06 chenglou jeffmo: es6 modules is highjackable too right 538 2014-05-14 19:59:16 jeffmo chenglou: huh? 539 2014-05-14 20:00:19 chenglou will jest work in the future with `import`? 540 2014-05-14 20:00:23 chenglou theoretically 541 2014-05-14 20:39:32 jeffmo chenglou: oh sorry — I missed your last msg 542 2014-05-14 20:39:39 jeffmo chenglou: absolutely 543 2014-05-14 20:39:46 jeffmo at least, I intend to make it work for that 544 2014-05-14 20:42:10 chenglou kk 545 2014-05-14 20:44:15 stoyanstefanov feedback: hm, I expected `npm install jest-cli` to do everyting for me, but instead I had to poke around and eventually settle for "test": "~/node_modules/jest-cli/bin/jest.js" in my app's package.json. Dunno if it's a good idea. How about "Installation" section in the docs? :) 546 2014-05-14 20:44:47 balpert I think you can just write "test": "jest" 547 2014-05-14 20:45:07 balpert the steps at the end of http://facebook.github.io/jest/ and on http://facebook.github.io/jest/docs/getting-started.html#content tell you this 548 2014-05-14 20:45:10 balpert but maybe it's not obvious 549 2014-05-14 20:45:18 stoyanstefanov balpert: yes, if you install locally with `npm install jest-cli -save-dev` 550 2014-05-14 20:45:27 balpert jeffmo is probably going to make global 'jest' work though https://github.com/facebook/jest/issues/3 551 2014-05-14 20:46:13 stoyanstefanov balpert: oh cool, thanks! 552 2014-05-14 20:46:18 balpert np 553 2014-05-14 20:47:16 jeffmo stoyanstefanov: if you do npm install (even without —save-dev), does “test”: “jest” not work? 554 2014-05-14 20:47:25 jeffmo seems like it should 555 2014-05-14 20:47:42 stoyanstefanov nopes, can't find `jest` 556 2014-05-14 20:47:43 jeffmo (but yes — hoping to get install -g working soon) 557 2014-05-14 20:47:55 spicyj I thought --save-dev just updated package.json 558 2014-05-14 20:48:00 jeffmo yea that’s all it does 559 2014-05-14 20:48:53 stoyanstefanov $ npm test 560 2014-05-14 20:48:54 stoyanstefanov > @ test /Users/stoyanstefanov/stoyan/jester 561 2014-05-14 20:48:56 stoyanstefanov > jest 562 2014-05-14 20:48:57 stoyanstefanov sh: jest: command not found 563 2014-05-14 20:48:58 stoyanstefanov npm ERR! Test failed. See above for more details. 564 2014-05-14 20:48:59 stoyanstefanov npm ERR! not ok code 0 565 2014-05-14 20:49:22 spicyj but ls node_modules shows jest-cli? 566 2014-05-14 20:49:45 stoyanstefanov when I tried --save-dev it installs in a local node_modules/ 567 2014-05-14 20:50:02 stoyanstefanov without it - in the global ~/node_nodules 568 2014-05-14 20:50:09 jeffmo stoyanstefanov: hmmm, what version of npm? It should always isntall locally 569 2014-05-14 20:50:36 stoyanstefanov 1.4.9 570 2014-05-14 20:50:50 chenglou stoyanstefanov: --save-dev doesn't affect that 571 2014-05-14 20:50:51 chenglou -g does 572 2014-05-14 20:50:53 jeffmo very weird… 573 2014-05-14 20:50:55 chenglou so yes it's local 574 2014-05-14 20:51:07 chenglou only difference between --save-dev and --save is where it ends up in package.json 575 2014-05-14 20:51:10 jeffmo sure you’re not aliasing something to add a -g in there somehow? 576 2014-05-14 20:52:39 stoyanstefanov I think the presence of a package.json in the directpory when I run npm is the source of confusion 577 2014-05-14 20:53:35 spicyj I didn't think that affects it either? 578 2014-05-14 20:54:15 jeffmo I just tested myself, and my local ver of npm (1.4.7) installs into the local directory I’m in (with/without a package.json) 579 2014-05-14 20:55:40 stoyanstefanov jeffmo: gotcha, must be my setup then, sorry for the randomization 580 2014-05-14 20:56:12 jeffmo heh np — curious if you figure out what’s up though. Hopefully a global runner will help anyway 581 2014-05-14 20:58:33 vjeux jeffmo: before i say some stupid thing, traceur is ast->string and not ast->ast right? 582 2014-05-14 20:58:41 jeffmo vjeux: I’m responding :p 583 2014-05-14 20:58:50 vjeux ok, i let you answer this one :p 584 2014-05-14 21:05:16 vjeux jeffmo: you should say that jsx (react) is built on-top of jstransform 585 2014-05-14 21:05:31 stoyanstefanov jeffmo: yeah install -g fixed everything. Somehow I wasn't able to sudo and other weird stuff happened, so I'm not a representative setup :) 586 2014-05-14 21:06:04 vjeux and that we started jstransform a long time ago 587 2014-05-14 21:06:21 jeffmo vjeux: done 588 2014-05-14 21:06:27 vjeux otherwise it looks like we are just being jerks and reimplement it ourself instead of using traceur 589 2014-05-14 21:06:28 jeffmo *shrug* not interested in measuring dicks :) 590 2014-05-14 21:06:52 jeffmo We can say that if someone calls us on it 591 2014-05-14 21:42:14 spicyj zpao: \\o 592 2014-05-14 21:50:00 zpao suuuuup 593 2014-05-14 21:53:13 chenglou hey! 594 2014-05-14 22:03:02 spicyj man, travis is so opaque https://travis-ci.org/facebook/jest/jobs/25194594 595 2014-05-14 22:03:04 spicyj is it doing something? 596 2014-05-14 22:03:41 jeffmo yea, I assumed I just didn’t know how to use it properly….but I can’t figure out how to tell what its doing 597 2014-05-14 22:03:58 jeffmo is it really just that slow? 598 2014-05-14 22:04:36 spicyj it might just be slow 599 2014-05-14 22:04:41 spicyj it says "created" 600 2014-05-14 22:06:23 vjeux Nice. When will there be a grunt plugin for it? I'm using the qunit plugin right now and I notice that it's 10x slower to run than viewing it in the browser. This 10 second feedback loop is driving me crazy. 601 2014-05-14 22:06:33 vjeux spicyj: do you know how hard it is to integrate with grunt? 602 2014-05-14 22:06:48 spicyj no idea 603 2014-05-14 22:06:55 vjeux zpao: ? 604 2014-05-14 22:06:55 zpao vjeux: in what way? 605 2014-05-14 22:06:57 spicyj grunt makes no sense to me 606 2014-05-14 22:07:03 spicyj I bet it's easy though 607 2014-05-14 22:07:08 vjeux i have no idea, he is asking for a grunt plugin for jest 608 2014-05-14 22:07:20 spicyj is there an API for running jest except via shelling out? 609 2014-05-14 22:07:36 zpao i don't know who he is, but maybe he can write one 610 2014-05-14 22:07:51 zpao spicyj: i don't think so 611 2014-05-14 22:08:05 zpao though presumably jeffmo knows :P 612 2014-05-14 22:08:27 jeffmo I just dropped for a second, whats up? 613 2014-05-14 22:09:33 vjeux is it possible/easy/even makes sense to make a grunt plugin for jest 614 2014-05-14 22:10:11 spicyj also I asked, is there an API for running jest except via shelling out? 615 2014-05-14 22:10:41 jeffmo I built this a good 3 months ago — but it just shells out to run the jest bin: https://github.com/jeffmo/react/tree/use_jest 616 2014-05-14 22:11:02 jeffmo spicyj: yep — if you read the bin/jest.js file, you’ll see that it’s mostly just wrangling the TestRunner.js 617 2014-05-14 22:11:08 spicyj yeah 618 2014-05-14 22:11:19 jeffmo we have our own CLI internally that handles more facebook-specific stuff 619 2014-05-14 22:11:31 jeffmo I’d probably encourage that for CLI needs that aren’t easily generalizable 620 2014-05-14 22:11:50 jeffmo TestRunner.js is the main API you should need to roll your own CLI 621 2014-05-14 22:14:42 jeffmo Should probably document TestRunner at some point 622 2014-05-14 22:14:42 vjeux https://gist.github.com/erikringsmuth/6543597228740c630577 623 2014-05-14 22:17:38 jeffmo man, travis still hasn’t budged 624 2014-05-14 22:17:45 jeffmo zpao: is travis always this slow? 625 2014-05-14 22:18:14 spicyj not always I don't think 626 2014-05-14 22:18:16 jeffmo https://travis-ci.org/facebook/jest/builds — been sitting like that for a good 20mins 627 2014-05-14 22:18:24 jeffmo ever? 628 2014-05-14 22:20:02 zpao is it doing anything? 629 2014-05-14 22:20:41 jeffmo zpao: I have no idea, it doesn’t seem to give any indication 630 2014-05-14 22:21:35 zpao looks like nothing started 631 2014-05-14 22:21:45 zpao other repos have live durations 632 2014-05-14 22:21:48 jeffmo zpao: it says “created” — is that different from “started"? 633 2014-05-14 22:21:52 zpao https://travis-ci.org/rande/python-simple-ioc 634 2014-05-14 22:21:55 jeffmo or is it just taking forever to “start"? 635 2014-05-14 22:22:26 spicyj https://travis-ci.org/facebook/jest also says "There are no builds for this repository." which seems suspicious 636 2014-05-14 22:22:53 zpao yea, something seems wrong 637 2014-05-14 22:24:28 zpao maybe make a commit that modifies .travis.yml, i vaguely recall something about it only picking up the repo on first change to that file 638 2014-05-14 22:25:17 jeffmo ah 639 2014-05-14 22:25:27 jeffmo I’m using single-quotes in it too — does yaml care about that? 640 2014-05-14 22:25:45 zpao no, i just ran travis-lint on it and it said it was fine 641 2014-05-14 22:26:04 zpao but you could make that your change 642 2014-05-14 22:26:11 jeffmo k, switched it to double-quotes and pushed (if for nothing else than to just touch the file) 643 2014-05-14 22:26:36 spicyj it's a mystery https://travis-ci.org/facebook/jest/jobs/25197023 644 2014-05-14 22:27:11 jeffmo ohhh 645 2014-05-14 22:27:34 spicyj ACTION ... 646 2014-05-14 22:27:35 jeffmo well 647 2014-05-14 22:27:36 jeffmo nvm 648 2014-05-14 22:27:48 jeffmo I was thinking: maybe travis doesn’t respect dev-dependencies 649 2014-05-14 22:27:55 jeffmo which is how jshint + jest are installed via npm install 650 2014-05-14 22:28:03 jeffmo but I don’t see how it *could* even not respect them 651 2014-05-14 22:28:09 spicyj yeah, it totally does 652 2014-05-14 22:28:13 spicyj also wouldn't it give an error 653 2014-05-14 22:28:14 spicyj I dunno 654 2014-05-14 22:28:29 spicyj lol this channel is all FB people again 655 2014-05-14 22:28:29 zpao it shows no output which is the weird thing. first hting it should do is run npm install 656 2014-05-14 22:28:50 zpao jeffmo: i assume https://travis-ci.org/facebook/jest/settings shows what you want 657 2014-05-14 22:30:06 jeffmo zpao: yea, that shows the same as react’s settings page even 658 2014-05-14 22:47:41 jeffmo this is so confusing — even the log pages are blank 659 2014-05-14 22:47:50 jeffmo ugh 660 2014-05-14 22:48:51 spicyj I just tweeted at them https://twitter.com/soprano/status/466710608608763904 661 2014-05-14 22:51:20 zpao spicyj: s/finishing/starting/ :P 662 2014-05-14 22:51:24 spicyj lol 663 2014-05-14 23:00:57 jeffmo spicyj: heyy, looks like you got a build to say ‘started' 664 2014-05-14 23:01:35 jeffmo ah, /usr/bin/env 665 2014-05-14 23:01:50 jeffmo spicyj: ^ 666 2014-05-14 23:01:51 spicyj I did nothing 667 2014-05-14 23:02:04 jeffmo I don’t know what you did/didn’t do, but I finally got an error message out of travis 668 2014-05-14 23:02:38 jeffmo https://travis-ci.org/facebook/jest/builds/25198712 669 2014-05-14 23:02:40 spicyj nice 670 2014-05-14 23:04:35 jeffmo ugh, travis doesn’t like shebang args 671 2014-05-14 23:07:47 spicyj we'll see if this passes https://github.com/facebook/jest/pull/12 672 2014-05-14 23:08:16 spicyj oh, do you not actually need --harmony? 673 2014-05-14 23:08:57 jeffmo not by default — but you do if you run node bin/jest —runInBand (to run all tests in-band instead of booting a worker pool) 674 2014-05-14 23:09:30 spicyj ah, I see 675 2014-05-14 23:11:25 spicyj well https://travis-ci.org/facebook/jest/jobs/25199914 totally passed 676 2014-05-14 23:12:22 zpao somebody's PR passed while somebody else's didnt 677 2014-05-14 23:13:21 jdjkelly danmcclain: tyukyi 678 2014-05-14 23:13:23 jdjkelly tuiuio' 679 2014-05-14 23:13:26 jdjkelly :"( 680 2014-05-14 23:13:36 jeffmo spicyj: seems fixed now https://travis-ci.org/facebook/jest/jobs/25200425 681 2014-05-14 23:13:49 jeffmo after https://github.com/facebook/jest/commit/06c64b711b0834f9efc1a386a53851b823698f26 682 2014-05-14 23:14:01 spicyj mmkay 683 2014-05-14 23:14:48 zpao jeffmo: wait.... you have your own package in devDependencies 684 2014-05-14 23:14:59 jeffmo zpao: I know — meta, right? 685 2014-05-14 23:15:03 zpao why 686 2014-05-14 23:15:25 jeffmo so I can put ‘jest’ in the “scripts”: {“test”: “jest”} portion 687 2014-05-14 23:15:30 vjeux awesome :p 688 2014-05-14 23:15:37 jeffmo rather than “scripts”: {“test”: “node bin/jest.js”} 689 2014-05-14 23:15:45 zpao ./bin/jest.js? 690 2014-05-14 23:15:57 jeffmo I could do that too 691 2014-05-14 23:16:00 zpao i think you shouold 692 2014-05-14 23:16:05 jeffmo any reason? 693 2014-05-14 23:16:15 zpao you don't need to bump a dependency like you just had to 694 2014-05-14 23:16:26 jeffmo ah yea that’s true 695 2014-05-14 23:16:50 spicyj yeah, easier for testing that way 696 2014-05-14 23:17:21 spicyj like for this example https://github.com/facebook/react-art/tree/master/examples/vector-widget I want to write require('react-art') but have that point to the parent repo 697 2014-05-14 23:17:27 spicyj which I don't know how to do except with npm ln 698 2014-05-14 23:17:30 spicyj which is a pain to tell people to do 699 2014-05-14 23:17:34 spicyj I want it to just work 700 2014-05-14 23:23:28 jeffmo zpao: was there anything fancy you had to do to get irc notices working? 701 2014-05-14 23:24:02 jeffmo Ah, I see an IRC webhook 702 2014-05-14 23:24:29 zpao yea, that 703 2014-05-14 23:24:51 zpao for github or travis 704 2014-05-14 23:26:51 zpao well, the way you have travis set up with skip_join, you need to change the mode to -n 705 2014-05-14 23:27:53 jeffmo zpao: I just copied react’s setup — what’s skip_join? 706 2014-05-14 23:28:13 zpao means the message is sent from a bot not in the channel 707 2014-05-14 23:28:24 zpao avoids the join, message, leave 708 2014-05-14 23:29:00 zpao that annoyed me in react 709 2014-05-14 23:33:26 jeffmo yay 710 2014-05-14 23:33:51 vjeux !! 711 2014-05-14 23:34:41 spicyj nice 712 2014-05-14 23:38:49 jeffmo spicyj: are you officially changing your irc name to spicyj now? 713 2014-05-14 23:38:57 spicyj I think so 714 2014-05-14 23:39:02 spicyj seems more consistent with my other presences 715 2014-05-14 23:39:11 spicyj I don't have twitter.com/spicyj though 716 2014-05-14 23:39:23 spicyj whee I'm an op 717 2014-05-14 23:39:29 spicyj that means I know lots of things about jest right? 718 2014-05-14 23:39:31 zpao ah, i somehow didn't notice 719 2014-05-14 23:40:00 spicyj I "grouped" this nick with my other one, whatever that means 720 2014-05-14 23:40:19 jeffmo yea, just means its another nick under the same overall account 721 2014-05-14 23:40:48 jeffmo you can always switch between balper and spicyj too and your auto-op statuses in channels should keep working 722 2014-05-14 23:41:10 spicyj I'll see next time I get disconnected 723 2014-05-14 23:43:25 spicyj that works too 724 2014-05-15 00:12:59 jeffmo whoa, we have a github-bot for the CLA now: https://github.com/facebook/jest/pull/13 725 2014-05-15 00:13:02 jeffmo so cool 726 2014-05-15 00:18:35 zpao life is better :) 727 2014-05-15 00:19:09 zpao i do wish it would use tags thouogh so its even easier at a glance (so you can distinguish the bot failing vs already signed) 728 2014-05-15 00:32:31 spicyj zpao: well now it makes a second comment? 729 2014-05-15 00:32:42 spicyj I guess it doesn't do that on every PR though? 730 2014-05-15 00:32:45 spicyj I don't know when it does 731 2014-05-15 00:32:57 spicyj like it didn't comment on my https://github.com/facebook/jest/pull/12 732 2014-05-15 00:33:05 zpao right because you signed it already 733 2014-05-15 00:33:15 zpao so it doesn't do anything 734 2014-05-15 00:33:40 spicyj gotcha 735 2014-05-15 00:33:49 spicyj yes, labels would be nice 736 2014-05-15 00:34:37 spicyj I thought maybe it had just concluded that I work at Facebook now 737 2014-05-15 00:42:02 zpao lol 738 2014-05-15 00:46:00 vjeux jeffmo: arnihr: welcome :) 739 2014-05-15 00:46:17 arnihr hi, vjeux asked me to paste gists I've mentioned to him about errors in jest 740 2014-05-15 00:46:20 arnihr https://gist.github.com/arnihermann/2c769330beecfead34f0 is the error 741 2014-05-15 00:46:30 jeffmo hey arnihr: So vjeux relayed that error to me — I have seen that. It’s a pretty horrible error message (we should fix that), but it usually means a module.exports === undefined somewhere 742 2014-05-15 00:46:42 arnihr and https://gist.github.com/arnihermann/35fc9c11bf53a7172621 743 2014-05-15 00:46:43 arnihr jeffmo: ok hi 744 2014-05-15 00:46:45 jeffmo arnihr: there’s a good chance you need to unmock react 745 2014-05-15 00:46:52 arnihr react is already unmocked 746 2014-05-15 00:47:08 arnihr I've got "unmockedModulePathPatterns": ["/node_modules/react"], 747 2014-05-15 00:47:45 arnihr I tried one thing 748 2014-05-15 00:48:04 arnihr stopped require('../store') and used eventemitter from the localstore.js file 749 2014-05-15 00:48:08 arnihr that worked 750 2014-05-15 00:48:21 jeffmo arnihr: hmm, ok — can you try console.log(LanguageSelection) in your LanguageSelection.js file right before the module.exports = LanguageSelection; ? 751 2014-05-15 00:48:30 arnihr sure 752 2014-05-15 00:48:36 jeffmo oh 753 2014-05-15 00:49:16 arnihr I don't seem to get any output from console.log :\\ 754 2014-05-15 00:49:17 arnihr at all 755 2014-05-15 00:49:45 jeffmo arnihr: are you, by chance, using solarized+iterm? 756 2014-05-15 00:49:54 arnihr no 757 2014-05-15 00:49:59 arnihr terminal 758 2014-05-15 00:50:38 arnihr if I remove the require() from my test 759 2014-05-15 00:50:48 arnihr I can see console.log in the test file 760 2014-05-15 00:50:56 jeffmo hmmm, ok — so you say that when you comment out the require(‘../store’) in localstore.js it fixes the issue? maybe let’s start there 761 2014-05-15 00:51:04 arnihr var LanguageSelection = require('../LanguageSelection'); -> console.log('foo') 762 2014-05-15 00:51:26 arnihr ok I didn't comment it out, I actually unfolded store.js into LocalStore.js 763 2014-05-15 00:51:42 arnihr instead of calling a function, I just put the code in LocalStore.js (removed the abstraction) 764 2014-05-15 00:52:18 arnihr I can put another gists up which works 765 2014-05-15 00:52:26 jeffmo Ah, I wonder if store.js is being mocked — you probably don’t want it to be 766 2014-05-15 00:52:46 jeffmo because your LocalStore.js is effectively doing module.exports = store( … ) 767 2014-05-15 00:52:52 jeffmo if store is a mock function, it’s going to return undefined 768 2014-05-15 00:53:21 jeffmo arnihr: does that make any sense? 769 2014-05-15 00:53:41 arnihr right 770 2014-05-15 00:54:11 arnihr sort of like... A -> B -> C and C must not be mocked 771 2014-05-15 00:55:16 arnihr jeffmo: totally makes sense 772 2014-05-15 00:56:00 jeffmo sweet 773 2014-05-15 00:56:19 jeffmo sorry about the terribl error message — I made an issue to track progress on making it more clear: https://github.com/facebook/jest/issues/14 774 2014-05-15 00:56:31 arnihr this is kind of awesome btw, mock by default but I wasn't prepared that dependencies that make sense not to mock must be unmocked 775 2014-05-15 00:56:37 arnihr somehow :) 776 2014-05-15 00:57:21 jeffmo yea — it’s kind of an inversion of what lots of other mocking frameworks do: You can either mock by default and explicitly list the things to opt-out of mocking….or you can not mock by default (using jest.autoMockOff()) and explicitly list the things you want to be mocked out 777 2014-05-15 00:57:37 jeffmo which one you choose usually depends on whether you have more things you want to mock than unmock or vice versa 778 2014-05-15 00:57:52 arnihr yeah 779 2014-05-15 00:58:00 arnihr btw, I really like this 780 2014-05-15 00:58:13 arnihr I guess I'm still just wrapping my head around this 781 2014-05-15 00:58:32 jeffmo thanks! Would love to hear feedback as you go 782 2014-05-15 00:58:50 arnihr will do 783 2014-05-15 00:59:56 arnihr btw, if I want to mock return values from LocalStore.getAvailableLanguages() 784 2014-05-15 01:00:07 arnihr would LocaleStore.getAvailableLanguages().mockReturnValueOnce work? 785 2014-05-15 01:01:23 jeffmo arnihr: if LocalStore is being mocked, then yes that should work (from your gist, it looks like it would be mocked) 786 2014-05-15 01:01:41 arnihr trying it out 787 2014-05-15 01:01:46 arnihr this is amazingly powerful 788 2014-05-15 01:02:24 spicyj LocaleStore.getAvailableLanguages.mockReturnValueOnce I think, no parens 789 2014-05-15 01:02:37 jeffmo arnihr: minor correction: You’d want LocaleStore.getAvailableLanguages.mockReturnValueOnce() 790 2014-05-15 01:02:39 jeffmo spicyj: beat me 791 2014-05-15 01:02:46 arnihr k 792 2014-05-15 01:02:58 arnihr right 793 2014-05-15 01:08:41 arnihr LocaleStore.getAvailableLanguages.mockReturnValue doesn't seem to work 794 2014-05-15 01:08:57 spicyj arnihr: what do you get? 795 2014-05-15 01:09:02 arnihr always undefined 796 2014-05-15 01:09:42 jeffmo arnihr: can you send an update gist? 797 2014-05-15 01:09:46 jeffmo *updated 798 2014-05-15 01:10:40 arnihr https://gist.github.com/arnihermann/583a9ef92aea1d1b9bfa 799 2014-05-15 01:10:46 arnihr there's a console.log in LanguageSelection.js 800 2014-05-15 01:10:48 arnihr it's always undefined 801 2014-05-15 01:12:36 jeffmo hmmm 802 2014-05-15 01:12:57 jeffmo ah 803 2014-05-15 01:13:19 jeffmo I think you need to move your requires that sit at the top of the file in to your spec (or into a beforeEach()) 804 2014-05-15 01:13:32 jeffmo jest will reset the module registry between each spec run 805 2014-05-15 01:14:06 jeffmo so if you require(‘LanguageSelection’) at the top of the test file, you’ll get the version that closes over LocaleStore that doesn’t have a mocked return value 806 2014-05-15 01:14:10 arnihr yeah that's it 807 2014-05-15 01:14:15 arnihr right 808 2014-05-15 01:14:24 arnihr makes senese 809 2014-05-15 01:14:25 jeffmo that’s a really annoying behavior that I wish I could find a way to make more apparent 810 2014-05-15 01:14:27 arnihr sense* 811 2014-05-15 01:14:41 arnihr it makes total sense from a traditional mocking perspective 812 2014-05-15 01:14:45 arnihr somehow 813 2014-05-15 01:15:12 jeffmo it’s just that you require() at the top, then before each spec we throw away the module (but you’ve already required, so you have a pointer to that old module object still) 814 2014-05-15 01:15:27 jeffmo so when you require again inside your spec you get a reference to the *new* version of the module 815 2014-05-15 01:15:43 jeffmo but the version you’re calling .mockReturnValue() on is the old one that jest already threw away 816 2014-05-15 01:16:07 jeffmo so if you always do your require()s inside the spec, you can avoid the problem 817 2014-05-15 01:16:31 arnihr https://gist.github.com/arnihermann/e2846007a387e814b568 818 2014-05-15 01:16:49 arnihr yeah I'll be sure to require the modules from within the specs 819 2014-05-15 01:17:12 arnihr have you seen this react error before? 820 2014-05-15 01:17:30 jeffmo arnihr: https://gist.github.com/jeffmo/774236d5eee454e1f859 821 2014-05-15 01:17:46 arnihr yeah this is nicer 822 2014-05-15 01:17:48 jeffmo arnihr: I’m not sure about that one — spicyj any idea? 823 2014-05-15 01:18:38 vjeux jeffmo: if require is not working outside of define(), can you warn when this is happening? 824 2014-05-15 01:18:53 arnihr jeffmo: when I run the code you pasted, I get failed but no trace 825 2014-05-15 01:19:02 jeffmo vjeux: hmmm — yea that’s a pretty good idea actually 826 2014-05-15 01:20:10 arnihr no way 827 2014-05-15 01:20:12 arnihr no wait* 828 2014-05-15 01:20:13 arnihr it's passing 829 2014-05-15 01:20:20 arnihr ok 830 2014-05-15 01:20:35 arnihr jeffmo: the error I pasted last time, doesn't happen with your gist 831 2014-05-15 01:20:51 arnihr so I better do the require() like you just did I guess 832 2014-05-15 01:20:55 arnihr not globally 833 2014-05-15 01:21:20 vjeux jeffmo: haha https://twitter.com/jasminebdd/statuses/466718900416045056 834 2014-05-15 01:21:39 jeffmo arnihr: ok cool. I think a lot of people are going to hit this issue, so I’ll see if I can make it more obvious 835 2014-05-15 01:22:04 jeffmo vjeux: hahaha 836 2014-05-15 01:22:17 vjeux what's new in jasmine 2.0? 837 2014-05-15 01:22:32 jeffmo vjeux: biggest thing I know of is that it() specs pass a done() callback to their functions now 838 2014-05-15 01:22:36 jeffmo (for async testing) 839 2014-05-15 01:22:41 vjeux but we don't care about that 840 2014-05-15 01:22:48 jeffmo vjeux: right, for the most part 841 2014-05-15 01:22:48 vjeux since we have mock functions 842 2014-05-15 01:23:12 jeffmo there might be some other wins in jasmine 2 also though — worth looking at at least 843 2014-05-15 01:23:19 jeffmo that’s just the only new feature I know of 844 2014-05-15 01:24:14 vjeux https://www.packtpub.com/sites/default/files/downloads/7204OS_The_Future_Jasmine_2_0.pdf 845 2014-05-15 01:24:41 vjeux looks like new syntax for custom matchers, asynchronous, spies 846 2014-05-15 01:25:03 jeffmo ya — not a ton of stuff really it seems 847 2014-05-15 01:25:10 jeffmo most of that I don’t think we really care much about 848 2014-05-15 01:25:15 vjeux and not really stuff that we use anyway 849 2014-05-15 01:25:31 jeffmo but when we get to building out support for pluggable frameworks, we should make a jasmine-2 plugin as well 850 2014-05-15 01:29:24 vjeux do you think it would be a good idea to support the done callback? 851 2014-05-15 01:29:28 vjeux i'm not convinced it would 852 2014-05-15 01:31:19 vjeux https://news.ycombinator.com/item?id=7747478 853 2014-05-15 01:31:22 vjeux ahhh, the first hater! 854 2014-05-15 01:38:08 arnihr "/node_modules/react" seems to work fine in unmockedModulePathPatterns, but "/node_modules/underscore" doesn't 855 2014-05-15 01:38:23 arnihr however, jest.dontMock('underscore') works 856 2014-05-15 01:38:47 arnihr never mind, underscore is dev dependency by mistake 857 2014-05-15 01:38:49 arnihr probably that 858 2014-05-15 01:39:18 arnihr ok no that wasn't it 859 2014-05-15 01:44:47 jeffmo vjeux: yea I think we should — it’s hellaciously bad 860 2014-05-15 01:48:20 jeffmo vjeux: mmm haterade — tastes so sweet! 861 2014-05-15 01:48:25 jeffmo arnihr: hmm, that’s add... 862 2014-05-15 01:48:26 jeffmo *odd 863 2014-05-15 01:49:37 jeffmo (trying it out myself to see if I can repro) 864 2014-05-15 01:52:26 jeffmo arnihr: hmm, seems to work for me 865 2014-05-15 01:55:33 jeffmo (trying to figure out the gist tool so I can share my test repo and see if you spot any differences) 866 2014-05-15 01:57:09 jeffmo arnihr: https://gist.github.com/jeffmo/9f12003835c77d8fb8ac 867 2014-05-15 02:14:59 spicyj jeffmo: seen https://gist.github.com/spicyj/cc61ea3a1bc967b84081? 868 2014-05-15 02:15:28 spicyj it's hanging there 869 2014-05-15 02:15:33 spicyj this is after 870 2014-05-15 02:15:33 spicyj Found 6 matching tests... 871 2014-05-15 02:15:35 jeffmo spicyj: I haven’t seen that before, no 872 2014-05-15 02:15:50 jeffmo looks like node-haste doing its dependency tree scan 873 2014-05-15 02:15:55 spicyj I mean, it prints that and then hangs 874 2014-05-15 02:16:26 spicyj ah jk 875 2014-05-15 02:16:30 spicyj I did something silly 876 2014-05-15 02:16:48 spicyj that is apparently what happens if you run jest on the react repo without any jest config? 877 2014-05-15 02:16:52 spicyj like on master 878 2014-05-15 02:17:00 jeffmo it’s probably node-haste bailing out (for whatever reason) and then all the worker children not getting killed 879 2014-05-15 02:17:24 jeffmo heh — I’m pretty zapped, but I can take a look either later tonight or tomorrow 880 2014-05-15 02:17:28 jeffmo probably tomorrow 881 2014-05-15 02:18:36 spicyj just sent https://github.com/facebook/react/pull/1531 882 2014-05-15 02:18:43 spicyj which will make that firstChild thing error earlier 883 2014-05-15 02:18:54 spicyj hopefully with an obvious message 884 2014-05-15 02:19:00 spicyj I'm sure sema will tell me I'm doing it completely wrong 885 2014-05-15 02:19:52 spicyj but let me know if that makes at least a little sense 886 2014-05-15 02:20:22 jeffmo nit: it(“should … — just drop the “should”, only takes up precious spec description char space :) 887 2014-05-15 02:21:19 spicyj updated 888 2014-05-15 02:27:30 jeffmo spicyj: I’m pretty out-of-touch with react internals these days, but invarianting early makes sense to me 889 2014-05-15 09:23:54 arnihr jeffmo: your example only works for me if I have jest.dontMock('underscore') 890 2014-05-15 09:24:13 arnihr jeffmo: it's weird, I'm going to inspect this later 891 2014-05-15 09:48:40 jbaiter is there a way to tell jest not to mock only certain parts of a module? 892 2014-05-15 09:48:59 jbaiter in my case i have a component that depends on Backbone's event system 893 2014-05-15 09:49:12 jbaiter i.e. it's an implementation detail that I'd like to have as-is 894 2014-05-15 09:49:25 jbaiter however, the component also uses jQuery for AJAX 895 2014-05-15 09:49:49 jbaiter which i would like to have mocked 896 2014-05-15 09:50:18 jbaiter but since Backbone uses jQuery itself, it doesn't get mocked in my component 897 2014-05-15 09:55:10 jbaiter http://pastebin.com/PsjS1BYg 898 2014-05-15 09:55:13 jbaiter here's a minimal example 899 2014-05-15 09:55:45 jbaiter also demonstrates that completely mocking Backbone fails 900 2014-05-15 09:57:28 jbaiter http://pastebin.com/wdCJmgAg <- here with test results 901 2014-05-15 09:58:11 jbaiter oops, there's a slight typo, should be 'backbone, unmocked' in the second test 902 2014-05-15 10:03:14 jbaiter in my case, i'd like either to mock out all of backbone, except for the Events function, or to exclude jQuery from the auto-mocking 903 2014-05-15 17:34:37 jeffmo arnihr: fyi, I think the issue jbaiter found might be related to yours (https://github.com/facebook/jest/issues/20) — I’m testing out a fix right now to make sure it doesn’t break stuff 904 2014-05-15 20:10:52 rileytg hello 905 2014-05-15 20:11:06 rileytg just stopping by to inquire on require js support 906 2014-05-15 20:12:16 vjeux rileytg: hey 907 2014-05-15 20:12:28 rileytg yo 908 2014-05-15 20:13:10 rileytg any idea on whether anyone is wokring on require js support OR whether thats even a realistic endevour? 909 2014-05-15 20:16:50 vjeux rileytg: jeffmo is currently in a meeting 910 2014-05-15 20:16:59 vjeux i'll ask to answer you back when hit ends 911 2014-05-15 20:17:16 rileytg awesome 912 2014-05-15 20:17:23 rileytg is jeffmo the lead dev? 913 2014-05-15 20:17:49 rileytg looks like it from github... 914 2014-05-15 20:18:31 vjeux yeah :) 915 2014-05-15 20:18:35 vjeux i'm just the guy that did the website 916 2014-05-15 20:19:52 rileytg cool cool 917 2014-05-15 20:19:55 rileytg nice work 918 2014-05-15 20:22:50 vjeux rileytg: thanks :) 919 2014-05-15 20:23:07 vjeux so a response is that right now we've focused on open sourcing what we had 920 2014-05-15 20:23:25 vjeux but the underlying system has been designed to be pretty extensible 921 2014-05-15 20:23:38 vjeux so it should be possible to support requirejs-style module loader 922 2014-05-15 20:24:03 vjeux jeffmo: rileytg is asking about requirejs support :) 923 2014-05-15 20:24:15 rileytg hi jeffmo 924 2014-05-15 20:24:30 jeffmo hey rileytg 925 2014-05-15 20:24:33 rileytg library looks awesome, getting some buzz on my team 926 2014-05-15 20:24:36 rileytg BUT 927 2014-05-15 20:24:37 vjeux jeffmo: it seems like a common request, do you know where the code is? 928 2014-05-15 20:24:39 rileytg were using require 929 2014-05-15 20:24:54 rileytg and it seems like some others in the twittersphere are showing interest 930 2014-05-15 20:25:06 rileytg what are your thoughts on supporting it? 931 2014-05-15 20:25:24 rileytg my team and i would be happy to hack on it if you pointed us in the right direction 932 2014-05-15 20:25:54 jeffmo rileytg: I’d love to have support for it. One of the things I’d like to get to eventually is supporting different types of module loaders (CommonJS, es6-shim module loaders, require.js) 933 2014-05-15 20:26:21 jeffmo That would be cool, so the place to start is by looking at the (admittedly, monstrous) HasteModuleLoader class 934 2014-05-15 20:27:01 jeffmo It should be possible to build a replacement for that that handles something like require.js-style modules 935 2014-05-15 20:27:15 rileytg hmmm k lemme poke around 936 2014-05-15 20:27:29 jeffmo and you “should” be able to plug it in in place of the HasteModuleLoader by means of the “moduleLoader” config property 937 2014-05-15 20:27:48 vjeux jeffmo: i have a feeling that CommonJS require() and RequireJS can be made compatible 938 2014-05-15 20:27:52 jeffmo I say should because I designed it intentionally to leave that option value, but haven’t actually tried building another module loader for it yet 939 2014-05-15 20:28:06 vjeux var a = require('a') vs require('a', function(a) { ... }) 940 2014-05-15 20:28:21 vjeux if there's a callback, then call the required module with the value, otherwise return it 941 2014-05-15 20:28:46 jeffmo vjeux: yep — you’d just need the module loader to do that for you, I think 942 2014-05-15 20:29:41 jeffmo Sadly the HasteModuleLoader class isn’t as broken out as I wish it were (there’s a lot of stuff in there that’s not even specific to CommonJS — and someone building a require.js loader would probably want to use) 943 2014-05-15 20:30:05 jeffmo I hope to do that as soon as I can find the time — it just hasn’t hit the top of the queue yet 944 2014-05-15 20:31:31 vjeux https://github.com/facebook/jest/blob/master/src/HasteModuleLoader/HasteModuleLoader.js#L572-L576 945 2014-05-15 20:32:27 vjeux i think that if you just change this function to check if the second argument is a function, and wire down things correctly you should be good to go 946 2014-05-15 20:34:23 jeffmo I think that would only work if none of your moduels rely on require.js’ asynchronous module loading API 947 2014-05-15 20:35:15 vjeux jeffmo: the async version is just for bundling on the client i think. if you are running it on node you already have the files available 948 2014-05-15 20:35:26 vjeux ohh, but it's not using module.exports 949 2014-05-15 20:36:11 jeffmo yea, it’s quite a different module system than CJS 950 2014-05-15 21:33:00 balpert jeffmo: there's a short style guide here https://github.com/facebook/react/blob/master/CONTRIBUTING.md 951 2014-05-15 21:33:12 balpert what does "Commas last," mean though? 952 2014-05-15 21:37:10 jeffmo balpert: means not commas first (There’s a stile while people do var a = [ \\n item1 \\n ,item2 \\n ,item3 \\n ]; to try to preserve blame when adding a new item to the list 953 2014-05-15 21:37:14 jeffmo *style 954 2014-05-15 21:37:18 jeffmo *style where 955 2014-05-15 21:37:19 balpert ah 956 2014-05-15 21:37:22 jeffmo man, my fingers suck 957 2014-05-15 21:37:44 balpert well in non-IE8 you can just do trailing commas which seems better 958 2014-05-15 22:15:28 MoDFoX Trying to run the basic sum.js test on the getting started page and having some troubles. every time I try to run the tests it says: 959 2014-05-15 22:15:29 MoDFoX Found 1 matching tests... 960 2014-05-15 22:15:29 MoDFoX undefined:1 961 2014-05-15 22:15:29 MoDFoX Anyone experience this or know what might be the problem? 962 2014-05-15 22:23:50 jeffmo MoDFoX: Which version of jest do you have installed? 0.1.3? 963 2014-05-15 22:24:19 MoDFoX Yep 964 2014-05-15 22:25:03 jeffmo MoDFoX: Hmm, seems to be working for me — did you make any changes at all? 965 2014-05-15 22:26:03 MoDFoX jeffmo: no changes, I just did npm install --save-dev, set up my js file, then the test in the __tests__folder. 966 2014-05-15 22:28:07 jeffmo MoDFoX: Ok, now I’m getting the repro... 967 2014-05-15 22:28:09 jeffmo looking 968 2014-05-15 22:28:33 jeffmo (I was using the examples diretory checked in to the repo before) 969 2014-05-15 22:30:10 MoDFoX ah. I see. 970 2014-05-15 22:31:52 MoDFoX this is how I've set it up https://github.com/WillsonSmith/JestLearn 971 2014-05-15 22:32:24 jeffmo MoDFoX: Interesting, if I use the npm installed version I get the error — but if I delete node_modules/jest-cli and instead just copy over the git repo, it seems to work…still digging in... 972 2014-05-15 22:32:48 MoDFoX hm strange 973 2014-05-15 22:36:54 jeffmo wtf 974 2014-05-15 22:37:04 jeffmo this is weird 975 2014-05-15 22:37:38 MoDFoX Is the git repo using a globally installed version or something? 976 2014-05-15 22:38:11 jeffmo MoDFoX: shouldn’t be — I killed the node_modules dir and re- npm installed just to be sure 977 2014-05-15 22:38:26 MoDFoX herm 978 2014-05-15 22:38:37 jeffmo gunna try and dive into the error 979 2014-05-15 22:39:19 MoDFoX I appreciate it. :) 980 2014-05-15 22:39:36 jeffmo While I’m at it (just to make sure I’m sane) If you do the same (delete the npm-installed version from node_modules and replace it with the git repo), does that also work for you? 981 2014-05-15 22:40:39 MoDFoX I'll give it a try 982 2014-05-15 22:49:45 MoDFoX running the test just in the repo works jeffmo but I can't just copy over jest.js and set that as my test 983 2014-05-15 22:50:38 jeffmo MoDFoX: yea, this appears to be deep in the loins of one of jest’s dependencies (node-haste) — it’s an old and decrepid chunk of code…so still wading 984 2014-05-15 22:50:49 MoDFoX ah 985 2014-05-15 23:08:10 jeffmo MoDFoX: aha 986 2014-05-15 23:08:39 MoDFoX Find the issue? 987 2014-05-15 23:09:00 jeffmo it’s this stupid file: node_modules/jest-cli/node_modules/cover/node_modules/cli-table/node_modules/colors/._package.json 988 2014-05-15 23:09:25 jeffmo jest tries to build the dependency graph of your project ahead of time, so that it’s fast to run the tests and find dependencies later 989 2014-05-15 23:09:44 jeffmo in the process of doing that, it finds all the .js and .json files and tries to read them in for metadata 990 2014-05-15 23:09:57 jeffmo and when it tries to read that file, it pukes 991 2014-05-15 23:10:34 jeffmo let me see if I can fix it 992 2014-05-15 23:10:37 jeffmo so it doesn’t throw up 993 2014-05-15 23:10:56 MoDFoX Ahhh. Getting ahead of itself. Haha 994 2014-05-15 23:18:42 jeffmo MoDFoX: Ok, I pushed an update to node-haste, let me bump the version in jest and push an update there 995 2014-05-15 23:19:04 jeffmo MoDFoX: thanks a ton for the report here, btw 996 2014-05-15 23:20:12 balpert filePath.lastIndexOf('package.json') === filePath.length - 12 997 2014-05-15 23:20:13 balpert lol 998 2014-05-15 23:20:17 jeffmo yap 999 2014-05-15 23:20:37 jeffmo facepalm 1000 2014-05-15 23:20:38 MoDFoX jeffmo: no problem! always glad to get things going. 1001 2014-05-15 23:22:43 MoDFoX jeffmo: yep, that worked. Awesome, thank you. 1002 2014-05-15 23:22:47 jeffmo MoDFoX: woohoo! 1003 2014-05-15 23:22:54 MoDFoX :D 1004 2014-05-16 00:59:42 arnihr I'm getting this error after upgrading to 0.1.5: https://gist.github.com/arnihermann/7381ec9b1c109204e9d7 1005 2014-05-16 00:59:58 arnihr tried removing node_modules and installing again 1006 2014-05-16 01:00:16 arnihr any ideas? I'm completely blank 1007 2014-05-16 01:07:56 jeffmo ugh, node-haste again 1008 2014-05-16 01:08:15 jeffmo arnihr: looking 1009 2014-05-16 01:09:21 jeffmo arnihr: can you send a gist, or tell me how I might repro it? 1010 2014-05-16 01:11:20 jeffmo arnihr: sorry — might be tricky to send all the things in the gist 1011 2014-05-16 01:19:39 jeffmo arnihr: Mind going into /Users/arnihermann/Code/quizup-questions/node_modules/jest-cli/node_modules/, delete the node-haste dir, and do an `npm install node-haste` in there? I just published a new version that should at least give a more helpful error message here and give some insight into what’s going on 1012 2014-05-16 01:19:51 jeffmo (version node-haste@1.2.3) 1013 2014-05-16 01:26:43 spicyj arnihr: quizup! 1014 2014-05-16 01:26:45 spicyj fun game. 1015 2014-05-16 01:37:07 jeffmo (I also just published a new jest patch pointing at the latest version of node-haste) — we’re at patch #6 after 2 days…impressive 1016 2014-05-16 06:35:47 chenglou https://news.ycombinator.com/item?id=7751610 1017 2014-05-16 06:39:27 spicyj I was afraid that was a response to Jest when I saw it earlier 1018 2014-05-16 08:27:05 jbaiter is there a way to specify what a "new Mock()" call should return? 1019 2014-05-16 08:29:40 jbaiter i used .mockReturnValue(), but that doesn't work, the constructor returns an empty object 1020 2014-05-16 08:33:37 jbaiter or should i just use regular jasmine spies for those cases? 1021 2014-05-16 08:44:33 spicyj looks like mockImplementation should work 1022 2014-05-16 08:47:50 jbaiter mh, nope 1023 2014-05-16 08:48:40 jbaiter jasmine.createSpy().andReturn(myObj) does the trick 1024 2014-05-16 08:49:33 jbaiter jest.genMockFunction().mockImplementation(function(){return myObj;}) doesn't 1025 2014-05-16 08:50:39 spicyj hmm 1026 2014-05-16 08:51:28 spicyj oh, it calls the impl but doesn't return the value? https://github.com/facebook/jest/blob/master/src/lib/moduleMocker.js#L70-L86 1027 2014-05-16 09:05:45 jbaiter don't know 1028 2014-05-16 09:25:35 arnihr spicyj: thanks 1029 2014-05-16 09:25:56 spicyj :) 1030 2014-05-16 09:25:58 arnihr :) 1031 2014-05-16 09:29:37 arnihr jeffmo: npm ERR! fetch failed https://registry.npmjs.org/node-haste/-/node-haste-1.2.3.tgz 1032 2014-05-16 09:37:20 arnihr jeffmo: this is the error after I linked node-haster@master into jest, https://gist.github.com/arnihermann/cb5bbb008c6dea0dda93 1033 2014-05-16 09:37:35 arnihr jeffmo: oh shit, sorry this is wrong, let me check again 1034 2014-05-16 09:39:03 arnihr jeffmo: this is it: https://gist.github.com/arnihermann/ea4dafad4be9ea68cbb0 1035 2014-05-16 10:05:28 arnihr jeffmo: this is related to this file: node_modules/webpack/node_modules/enhanced-resolve/test/fixtures/node_modules/invalidPackageJson/package.json 1036 2014-05-16 11:22:38 arnihr fixture from webpack which breaks node-haste 1037 2014-05-16 11:48:10 jbaiter i encountered that one as well, worked around it by excluding webpack from module discovery 1038 2014-05-16 13:05:51 arnihr jbaiter: excluding from module discovery? 1039 2014-05-16 13:07:02 arnihr ah yes, via v 1040 2014-05-16 13:07:03 arnihr modulePathIgnorePatterns 1041 2014-05-16 13:51:24 jbaiter arnihr: yep .) 1042 2014-05-16 13:59:20 jbaiter does somebody know how to best mock promises as returned by jQuery.ajax? 1043 2014-05-16 13:59:47 jbaiter i.e. how to best mock 'fail' and 'complete' in a call like "jQuery.ajax(params).fail(cb).complete(cb)" 1044 2014-05-16 14:00:22 jbaiter for now i've made .ajax return a 'promise' object with 'fail' and 'complete' methods that return the same object again 1045 2014-05-16 16:07:34 jeffmo arnihr: Yea I was seeing that 404 and others as well — I have no idea what’s going on with npm, but I just bumped the version of node-haste + re-published stuff to see if that flushes out the problem 1046 2014-05-16 16:15:10 jeffmo jbaiter: I’m seeing this working: https://gist.github.com/jeffmo/e2a2528c3a91d6c85843 1047 2014-05-16 16:15:44 jeffmo jbaiter: fix coming for .mockImplementation() not returning the result of the given function 1048 2014-05-16 16:16:16 jeffmo I can’t believe mockImpl has been like that for as long as we’ve had that file… 1049 2014-05-16 17:14:07 jeffmo arnihr: jbaiter: I just pushed a fix to node-haste that should fix all the issues that I saw that webpack was exposing 1050 2014-05-16 21:51:19 arnihr so far my experience with jest has been very nice, only thing that's currently stopping me from going all in is I'm using webpack and I use require() for stylesheets (e.g. require('./Page.css')) 1051 2014-05-16 22:37:27 vjeux arnihr: what happens with jest 1052 2014-05-16 22:37:27 vjeux does it crash? 1053 2014-05-16 22:41:51 arnihr vjeux: https://gist.github.com/arnihermann/1d5adac1f92e8e0b0f5d 1054 2014-05-16 22:41:53 arnihr something like this 1055 2014-05-16 22:42:20 arnihr I'm actually require-ing a .styl file 1056 2014-05-16 22:42:32 arnihr which is compiled to css via webpack 1057 2014-05-16 22:42:36 vjeux arnihr: can you add a transform that looks at .css files and return something that can be parsed as js 1058 2014-05-16 22:42:58 arnihr yeah I'm going to try that 1059 2014-05-16 22:42:59 vjeux http://facebook.github.io/jest/docs/tutorial-coffeescript.html#content 1060 2014-05-16 22:43:07 vjeux look at the preprocessor.js file 1061 2014-05-16 22:43:22 vjeux not sure if you can get the same transform that webpack is doing 1062 2014-05-16 22:43:31 arnihr not sure if I need it really 1063 2014-05-16 22:43:37 vjeux oh just return a stub 1064 2014-05-16 22:43:49 arnihr it'll probably be a stub 1065 2014-05-16 22:43:51 vjeux anything that makes your js compile and not crash 1066 2014-05-16 22:44:56 arnihr vjeux: that did the trick 1067 2014-05-16 22:45:07 vjeux yay 1068 2014-05-16 22:45:36 arnihr it can basically be an empty string, unless I want to use the output from the style files, I can return it as strings or something 1069 2014-05-16 22:45:43 arnihr I'm probably not going to do that 1070 2014-05-16 22:46:06 arnihr vjeux: thanks 1071 2014-05-16 22:51:57 vjeux arnihr: nice! 1072 2014-05-16 22:52:07 vjeux would be nice if you could open an issue with the solution and auto-close it 1073 2014-05-16 22:52:13 vjeux so other people can google for it 1074 2014-05-16 22:52:37 arnihr sure, I'll do it 1075 2014-05-16 23:41:38 arnihr vjeux: https://github.com/facebook/jest/issues/27 1076 2014-05-16 23:41:42 vjeux thanks 1077 2014-05-16 23:43:43 arnihr no prob 1078 2014-05-17 05:51:24 ekline @jeffmo: hey so I just saw your most recent comment about the v8 error 1079 2014-05-17 05:51:35 jeffmo heya ekline 1080 2014-05-17 05:52:02 ekline @jeffmo: thanks for trying to figure this out with me 1081 2014-05-17 05:52:18 jeffmo yea you bet 1082 2014-05-17 05:52:23 ekline I've been using React on some projects at work 1083 2014-05-17 05:52:35 jeffmo any chance you could make a gist of what you have so far? maybe I can try it locally to see if I can repro 1084 2014-05-17 05:52:47 ekline well 1085 2014-05-17 05:52:49 jeffmo oh yea? how’s it been treating you? 1086 2014-05-17 05:52:56 ekline I got that initial error from git cloning 1087 2014-05-17 05:53:04 ekline been great, really improved UI workflow 1088 2014-05-17 05:53:24 ekline would love to clean it up a bit with tests and modularizing it with browserify 1089 2014-05-17 05:53:35 ekline so Jest looks like a great tool 1090 2014-05-17 05:53:48 ekline I figured I wasnt requiring something correctly when I did the git clone 1091 2014-05-17 05:54:06 jeffmo so just to be clear: That “lazy symbol binding failed” error you got by doing git clone; cd examples/react; npm install; npm test? 1092 2014-05-17 05:54:16 ekline im not sure a gist would help, besides for the error i got with the lazy binding 1093 2014-05-17 05:54:17 ekline no no 1094 2014-05-17 05:54:27 ekline the git clone was the initial error i opened the issue for 1095 2014-05-17 05:54:35 ekline then I was testing it without the JSX syntax 1096 2014-05-17 05:54:37 ekline and got that error 1097 2014-05-17 05:54:42 ekline ill open a gist for that... 1098 2014-05-17 05:56:24 jeffmo Hmm, I’m a little confused on how you got the initial error — maybe if you just list out the sequence of commands I can piece it together. Heh, sorry been a long day :p 1099 2014-05-17 05:57:13 jeffmo oh I think I see what you meant 1100 2014-05-17 05:58:17 ekline lol sorry about to send link to the gist 1101 2014-05-17 05:58:22 jeffmo heh ok 1102 2014-05-17 05:59:06 ekline https://gist.github.com/evankline/d56bbd2e3590e52757e3 1103 2014-05-17 06:00:21 ekline so ya, I was just trying to see if it was a JSX issue, so I copy and pasted the JSX into the JSX compiler and removed the /** jsx */ from both files and changed the Checkbox to use the React.DOM syntax and reran the tests to get those 2 new errors 1104 2014-05-17 06:00:45 ekline and with JSX I didnt get an error, but the test didnt return any result 1105 2014-05-17 06:03:07 jeffmo ok, so let’s start with the first issue you were seeing (not the lazy symbol binding error) 1106 2014-05-17 06:03:46 jeffmo It seems when I download the files from your jist, npm install, and run npm test the test runs and passes for me 1107 2014-05-17 06:04:10 jeffmo gist even 1108 2014-05-17 06:04:46 jeffmo what happens if you install jest globally and try running the tests that way. So: npm install -g jest-cli; cd examples/react; jest 1109 2014-05-17 06:04:49 ekline ok so the first issue was just cloning the repo and changing into the examples/react directory 1110 2014-05-17 06:05:27 ekline i actually did the install globally to begin with 1111 2014-05-17 06:05:33 jeffmo does installing globally and trying to run the tests that way hang too? 1112 2014-05-17 06:05:37 ekline then did cd examples/react 1113 2014-05-17 06:05:42 ekline and ran npm test 1114 2014-05-17 06:05:51 ekline im going to remove the repo 1115 2014-05-17 06:05:52 ekline reclone 1116 2014-05-17 06:05:54 ekline and try again 1117 2014-05-17 06:05:56 jeffmo try just using the `jest` command you installed globally 1118 2014-05-17 06:05:57 jeffmo ok 1119 2014-05-17 06:06:14 jeffmo let’s see if that does anything 1120 2014-05-17 06:06:53 ekline do you think i should uninstall/reinstall the cli also or just the repo? 1121 2014-05-17 06:07:10 ekline just cloned the repo again 1122 2014-05-17 06:07:29 jeffmo you can leave the globally installed cli for now I think 1123 2014-05-17 06:07:32 jeffmo shouldn’t interfere 1124 2014-05-17 06:07:33 ekline ok 1125 2014-05-17 06:07:53 jeffmo then basically just cd examples/react; npm install; npm test 1126 2014-05-17 06:07:58 jeffmo still hangs? 1127 2014-05-17 06:08:19 ekline im getting command not found jest 1128 2014-05-17 06:08:58 jeffmo when you hit the npm test part it gives you that error? 1129 2014-05-17 06:09:18 ekline I just ran: 1130 2014-05-17 06:09:28 ekline cd examples/react; npm install; jest 1131 2014-05-17 06:09:36 ekline after cloning and got command not found: jest 1132 2014-05-17 06:09:46 ekline then I went back to the top level /jest folder 1133 2014-05-17 06:09:49 ekline and ran: 1134 2014-05-17 06:09:58 ekline npm install -g jest-cli; cd examples/react; jest 1135 2014-05-17 06:10:19 ekline and got an error about node gyp-rebuild 1136 2014-05-17 06:10:28 ekline npm ERR! contextify@0.1.8 install: `node-gyp rebuild` 1137 2014-05-17 06:10:44 jeffmo oh, try running npm test instead of just straight up `jest` 1138 2014-05-17 06:11:12 jeffmo oh you know what 1139 2014-05-17 06:11:21 jeffmo I think you actually need to run npm install at the top level too 1140 2014-05-17 06:11:31 jeffmo (like in the root dir, not just the examples/react dir) 1141 2014-05-17 06:11:46 jeffmo not npm install -g — just plain old `npm install` 1142 2014-05-17 06:11:47 ekline I just did and got the same contextify error 1143 2014-05-17 06:12:07 jeffmo what version of node are you running? 1144 2014-05-17 06:12:09 jeffmo node -v 1145 2014-05-17 06:12:11 ekline hold on im upgrading from 0.11.12 to 0.11.13 1146 2014-05-17 06:12:28 jeffmo oh, I think node 0.11 is technically unstable 1147 2014-05-17 06:12:39 ekline ok that works 1148 2014-05-17 06:12:45 ekline and says it found 8 matching tests 1149 2014-05-17 06:12:46 jeffmo upgrading fixed it? 1150 2014-05-17 06:12:54 ekline but its hanging after the 3rd test 1151 2014-05-17 06:13:03 ekline yes upgrading allowed me to run npm install in the root directory 1152 2014-05-17 06:13:13 ekline Using Jest CLI v0.1.8 Found 8 matching tests... PASS __tests__/TestRunner-test.js (0.342s) PASS lib/__tests__/utils-normalizeConfig-test.js (0.118s) PASS lib/__tests__/FakeTimers-test.js (2.152s) 1153 2014-05-17 06:13:17 jeffmo I see — it wouldn’t surprise me if this is related to running an odd version of node 1154 2014-05-17 06:13:24 jeffmo they’re notoriously unstable 1155 2014-05-17 06:13:33 ekline so you think I should downgrade to 0.10.x 1156 2014-05-17 06:13:49 jeffmo yea you probably should 1157 2014-05-17 06:13:58 jeffmo looks like 0.10.28 is the most recent stable release 1158 2014-05-17 06:14:07 jeffmo 0.11 is basically beta 1159 2014-05-17 06:14:23 ekline now im getting that lazy symbol error again... 1160 2014-05-17 06:14:23 jeffmo the way the node releases work are they do stable releases with even numbers, and the odd numbers are betas for the next even 1161 2014-05-17 06:14:31 ekline i see 1162 2014-05-17 06:14:38 jeffmo so 0.9 was beta for 0.10, 0.11 is beta for 0.12, etc 1163 2014-05-17 06:14:47 ekline should i delete the folder and reclone it 1164 2014-05-17 06:14:53 ekline start fresh with the stable node version? 1165 2014-05-17 06:15:12 jeffmo after you downgrade to 0.10, I think you can just delete the node_modules dir in the root of the repo 1166 2014-05-17 06:15:20 jeffmo (and then also the examples/react/node_modules dir) 1167 2014-05-17 06:15:27 jeffmo then just start over with the npm installs 1168 2014-05-17 06:15:27 ekline ok 1169 2014-05-17 06:15:43 ekline lol giving this another shot! 1170 2014-05-17 06:15:49 jeffmo heh thanks for bearing with 1171 2014-05-17 06:16:04 jeffmo I wonder if there’s a way to specify compatible node versions in the package.json to make this more clearer for everyone 1172 2014-05-17 06:16:39 jeffmo looks like there is!: https://www.npmjs.org/doc/json.html#engines 1173 2014-05-17 06:16:39 ekline success on the top level npm install 1174 2014-05-17 06:17:17 ekline and success running npm test in the react folder! 1175 2014-05-17 06:17:21 ekline thank you! 1176 2014-05-17 06:17:26 jeffmo woohoo! thanks for the report 1177 2014-05-17 06:18:59 ekline is Jest typically setup this way in package.json? 1178 2014-05-17 06:20:08 ekline and do u typically use the jest command or npm test? 1179 2014-05-17 06:21:15 jeffmo I just recently made it possible to do npm install -g and have it work correctly — but npm test is my personal preference just because it doesn’t require that people install anything on their system if they don’t want to 1180 2014-05-17 06:21:44 jeffmo but it’s up to you — they should both work 1181 2014-05-17 06:21:52 ekline so if i run npm install -g jest-cli I should be able to use the jest command? 1182 2014-05-17 06:21:57 jeffmo yep 1183 2014-05-17 06:22:04 ekline got it, thanks! 1184 2014-05-17 06:22:16 jeffmo as long as you’ve cd’d into a repo that has jest tests, running `jest` should do the right thing 1185 2014-05-17 06:23:08 ekline and in terms of the setup, is the preprocess.js to do the ReactTools.transform only if you're using the JSX syntax? 1186 2014-05-17 06:24:22 jeffmo right, if you’re just using vanilla JS there’s no need fo rit 1187 2014-05-17 06:25:18 jeffmo basically jest runs all files through the preprocessor before trying to evaluate them — so if it’s vanilla JS, then it can just execute it without pre-processing anything 1188 2014-05-17 06:26:18 ekline ok awesome, so the React setup if you're using vanillaJS the only thing to make sure of is the unmockedModulePatterns and the testIgnorePath, but the testIgnorePath would be for any node_modules that also included tests right? 1189 2014-05-17 06:26:35 ekline sorry for the million questions 1190 2014-05-17 06:26:42 ekline and thanks again for all the help 1191 2014-05-17 06:27:06 jeffmo ekline: yep that sounds about right — and fire away with the questions. Happy to help 1192 2014-05-17 06:27:35 ekline and for the great libraries/frameworks, really having fun with them 1193 2014-05-17 06:27:56 jeffmo so great to hear — always fun to see what people do with them :) 1194 2014-05-17 06:28:11 ekline thanks! ill definitely come back into the room the next time I have some, have a great night and a great weekend! 1195 2014-05-17 06:28:22 jeffmo you too — ttyl 1196 2014-05-19 18:52:00 simenbrekken I'm trying to run my first rest with Jest and I'm running into what I consider must be a trivial problem, my build application code (build/modules) can't locate anything in node_modules when tests are running, any ideas? 1197 2014-05-19 18:52:56 vjeux jeffmo: ^^ 1198 2014-05-19 18:59:41 simenbrekken Running the said module normally with node build/modules/Application.js works fine, seems there's something else screwing up the resolve path 1199 2014-05-19 19:32:51 jeffmo simenbrekken: can send me an example gist of what one of your tests looks like? 1200 2014-05-19 19:37:45 jeffmo simenbrekken: also, you mention “build application code” — by that, do you mean you’re building the code using browserify or something similar? 1201 2014-05-19 20:30:58 simenbrekken jeffmo: right now I'm just transforming jsx to js with react-tools. 1202 2014-05-19 20:31:55 jeffmo simenbrekken: got it, so just to be clear: You have one of your application modules in, say: build/modules/Application.js — and then you have a test file in, say, build/modules/__tests__/Application-test.js 1203 2014-05-19 20:32:40 jeffmo and in build/modules/__tests__/Application-test.js you have something like require(‘underscore’) (where you’ve `npm install`’d underscore at some point prior), and that’s not working? 1204 2014-05-19 20:33:01 jeffmo (just want to be sure I’m understanding correctly) 1205 2014-05-19 20:33:36 spicyj jestbot: hello 1206 2014-05-19 20:33:57 jeffmo spicyj: he’s not very smart yet 1207 2014-05-19 20:34:00 simenbrekken jeffmo: here's a gist: https://gist.github.com/sbrekken/029a49dc97b2e9a84e34 1208 2014-05-19 20:34:12 jeffmo jestbot was my sunday post-bay-to-breakers-hangover project 1209 2014-05-19 20:34:23 jeffmo all he does is log stuff in the channel 1210 2014-05-19 20:34:23 spicyj jeffmo: just quiet, it seems 1211 2014-05-19 20:34:31 simenbrekken awww, bay to breakers, i loved that :) 1212 2014-05-19 20:34:33 jeffmo you can / msg jestbot help for commands 1213 2014-05-19 20:34:56 spicyj cute 1214 2014-05-19 20:37:50 jeffmo simenbrekken: looking at your gist — let’s see if I can repro 1215 2014-05-19 20:38:01 simenbrekken it just seems way too ordinary to fail 1216 2014-05-19 20:38:51 jeffmo simenbrekken: tbh — we don’t use standard node_modules/node-module-resolution at FB (we use the @providesModule stuff you might’ve noticed in the React repo), so some of that stuff still has a few kinks 1217 2014-05-19 20:39:26 simenbrekken supporting standard node_module resolution is for me a must at least 1218 2014-05-19 20:39:45 jeffmo simenbrekken: it’s a must for Jest (and me) as well — just have to work out the kinks 1219 2014-05-19 20:39:53 jeffmo very much interested in making it work for standard node 1220 2014-05-19 20:40:17 jeffmo let’s see what’s going on here though 1221 2014-05-19 20:40:44 jeffmo “making it work for standard node” is a bit misleading — it should alreayd, and if ever it doesn’t it’s a bug :) 1222 2014-05-19 20:41:05 spicyj simenbrekken: you could try my PR 1223 2014-05-19 20:41:06 simenbrekken I was looking at HasteModuleLoader but at 1k lines its a beast 1224 2014-05-19 20:41:14 spicyj https://github.com/facebook/jest/pull/32 1225 2014-05-19 20:41:24 jeffmo simenbrekken: I know :( that’s top of my list for refactoring 1226 2014-05-19 20:44:11 jeffmo simenbrekken: Is the build/modules/Application module file “build/modules/Application”? Or is it “build/modules/Application/index.js”? 1227 2014-05-19 20:44:25 simenbrekken jeffmo: the former 1228 2014-05-19 20:49:22 jeffmo simenbrekken: interesting, I’m using your test file the config from your gist and it seems to be running — here’s what I have (wondering if we can spot differences somewhere): https://gist.github.com/jeffmo/5817ba22b05e597a03e0 1229 2014-05-19 20:49:45 jeffmo simenbrekken: curious what version of jest you’re using? (jest -v) 1230 2014-05-19 20:56:45 simenbrekken jeffmo: sorry, ISP is being an ISP 1231 2014-05-19 20:57:08 jeffmo simenbrekken: did you get my prev few messages? 1232 2014-05-19 20:57:14 jeffmo last one was: 1233 2014-05-19 20:57:16 simenbrekken jeffmo: yes, irccloud ftw! 1234 2014-05-19 20:57:19 jeffmo oh nice 1235 2014-05-19 20:57:21 simenbrekken jeffmo: 0.1.9 1236 2014-05-19 20:57:51 jeffmo hmm, ok 1237 2014-05-19 20:58:16 simenbrekken jeffmo: I tried both node_modules/.bin/jest and installing it globally 1238 2014-05-19 20:59:15 jeffmo simenbrekken: oh wait, I think my example isn’t doing the same thing as yours — mine doesn’t require(‘react’) from Application.js…let’s try that... 1239 2014-05-19 20:59:20 simenbrekken jeffmo: I updated the gist with a complete stacktrace 1240 2014-05-19 20:59:24 spicyj simenbrekken: can you try cloning my branch spicyj/gh-31 and testing? https://github.com/facebook/jest/pull/32 1241 2014-05-19 20:59:48 jeffmo worth a try ^^ 1242 2014-05-19 21:00:02 simenbrekken spicyj: any easy way of doing that btw? cloning a PR i mean 1243 2014-05-19 21:02:16 spicyj easiest is probably to just clone the repo, add me as a remote, then fetch and check out that branch 1244 2014-05-19 21:02:26 spicyj well you could also just clone my fork directly 1245 2014-05-19 21:04:27 jeffmo simenbrekken: spicyj: Have to run to a meeting, but should be back a little later to continue 1246 2014-05-19 21:05:09 simenbrekken jeffmo: I'm on another continent so I'll probably have gone to bed but I'll catch you later 1247 2014-05-19 21:05:27 simenbrekken spicyj: Error: Unknown config option: testDirectoryName, was it renamed or something? 1248 2014-05-19 21:05:46 spicyj I don't think so? 1249 2014-05-19 21:06:04 jeffmo simenbrekken: ok — hopefully I can figure this out and get back to you. I usually hang out in this room, so feel free to hop in any time 1250 2014-05-19 21:10:34 simenbrekken spicyj: seems so, at least in your fork 1251 2014-05-19 21:12:02 spicyj did you check out the gh-31 branch? 1252 2014-05-19 21:12:33 simenbrekken doh. 1253 2014-05-19 21:14:38 simenbrekken spicyj: working! 1254 2014-05-19 21:14:44 spicyj simenbrekken: sweet 1255 2014-05-19 21:19:02 jeffmo simenbrekken: spicyj: To be clear, spicyj’s diff fixes the issue? 1256 2014-05-19 21:19:15 simenbrekken jeffmo: seems so, it's not barfing on that at least 1257 2014-05-19 21:24:19 jeffmo simenbrekken: woo! 1258 2014-05-19 21:27:27 spicyj jeffmo: see you should just always merge my stuff 1259 2014-05-19 21:28:21 jeffmo spicyj: I just need to pull it into internal and run it to make sure it’s functionally equiv 1260 2014-05-19 21:28:27 spicyj mmhm 1261 2014-05-19 21:28:28 spicyj m 1262 2014-05-19 21:50:02 ekline is there anyway to get a more verbose output in terms of how many tests are being run... if I have 2 files with multiple tests in each file, it still only says it finds 2 tests 1263 2014-05-19 21:50:22 spicyj not currently 1264 2014-05-19 21:50:36 ekline spicyj: ok just wanted to make sure I wasnt missing some flag on the cli 1265 2014-05-19 21:50:36 spicyj https://github.com/facebook/jest/issues/4 1266 2014-05-19 21:51:16 ekline spicyj: yes would be a great feature, easier to debug, and more euphoric when they all pass :) 1267 2014-05-19 21:51:25 spicyj np 1268 2014-05-19 21:51:34 ekline spicyj: thanks! 1269 2014-05-19 23:34:45 jeffmo spicyj: fyi — getting several errors running your diff through our internal tests. I think some of them are just us doing crazy, non-standard, disappointing things with package.json files 1270 2014-05-19 23:35:09 spicyj all right 1271 2014-05-19 23:35:17 jeffmo still diving 1272 2014-05-19 23:39:57 jeffmo simenbrekken: you’re sleeping at this point, I assume? 1273 2014-05-20 00:03:33 jeffmo jbaiter: I’m digging into https://github.com/facebook/jest/issues/31 — I’m getting a repro, but when I wipe the npm installed v0.1.9 and drop in the git repo, it seems to fix the issue. The weird part is, nothing significant (that should have affected this) has changed between the npm v0.1.9 and the git repo 1274 2014-05-20 00:07:47 jeffmo kwell, actually, either I’m going insane (highly possible), or this is some kind of race. Arbitrarily seeing it happen *sometimes* in both cases 1275 2014-05-20 00:10:25 jeffmo jbaiter: derp — you outlined this pretty well in the issue and I just didn’t pay attention 1276 2014-05-20 00:10:45 jeffmo node-haste issue 1277 2014-05-20 00:11:28 spicyj I can answer more questions about it too, I did enough digging 1278 2014-05-20 00:11:41 spicyj basically haste doesn't do node_modules or package.json correctly 1279 2014-05-20 00:11:57 spicyj for example, package.json name is used only by npm, not by the resolution algorithm 1280 2014-05-20 00:14:24 jeffmo spicyj: nice catch 1281 2014-05-20 00:14:43 spicyj and I was going to rewrite it myself 1282 2014-05-20 00:14:59 spicyj but figured it was easier to use substack's resolve which was already half-used :) 1283 2014-05-20 00:16:19 jeffmo spicyj: yea, resolve seems most ideal. The issue we have internally that I’m seeing with your PR is that we don’t have our CJS packages sitting inside a node_modules dir 1284 2014-05-20 00:16:37 spicyj caaaan you fix it? 1285 2014-05-20 00:16:48 jeffmo so node-haste was designed to just look for dirs with a package.json file, and call those “projects" 1286 2014-05-20 00:17:04 jeffmo hmmm 1287 2014-05-20 00:17:56 spicyj yeah, that is pretty much totally wrong 1288 2014-05-20 00:18:35 spicyj can you add symlinks if you don't want to move stuff around? 1289 2014-05-20 00:18:40 spicyj that's what we do for some stuff at KA 1290 2014-05-20 00:19:18 jeffmo it’d be a bit odd and out-of-context internally to require these packages to sit inside some node_modules dir somewhere 1291 2014-05-20 00:19:56 jeffmo ideally we would just write our own “FBModuleLoader” plugin that has all the @providesModule non-sense — then the open-source version woudl ship with a NodeModuleLoader that was tiny and basically just wrapped `resolve` 1292 2014-05-20 00:20:13 spicyj right, so you just ln -s static_upstream/react node_modules/react or something? 1293 2014-05-20 00:20:25 jeffmo spicyj: you know way too much about our internal code 1294 2014-05-20 00:20:29 jeffmo have to kill you or hire you 1295 2014-05-20 00:20:52 jeffmo spicyj: I’m saying that would be really strange to explain to people that we have this concept of ‘node_modules’ directories 1296 2014-05-20 00:20:57 spicyj okay 1297 2014-05-20 00:21:05 jeffmo trying to think if there’s something more transparent 1298 2014-05-20 00:22:34 jeffmo Might be able to try using resolve first, then fallback to the fb-clowntown rules 1299 2014-05-20 00:22:36 jeffmo for now 1300 2014-05-20 00:22:50 jeffmo resolve should always fail for us *because* we don’t use node_modules dirs 1301 2014-05-20 00:24:01 spicyj uh huh 1302 2014-05-20 00:24:18 jeffmo spicyj: you seem enthralled with this discussion 1303 2014-05-20 00:24:40 spicyj I am in favor of anything that has less clowntown 1304 2014-05-20 00:25:29 spicyj can you just ln -s static_upstream node_modules? 1305 2014-05-20 00:25:35 spicyj or do you have them in other places too 1306 2014-05-20 00:25:44 jeffmo spicyj: other places as well 1307 2014-05-20 00:27:52 spicyj I just pay attention to what you guys say about FB's code so I can help you better 1308 2014-05-20 00:28:02 jeffmo spicyj: haha I was kidding :) 1309 2014-05-20 00:28:07 spicyj :) 1310 2014-05-20 00:28:11 spicyj help me help you! 1311 2014-05-20 00:40:05 jeffmo <3 try-catch-continues 1312 2014-05-20 00:40:20 spicyj mm? 1313 2014-05-20 00:40:29 jeffmo wait till you see my fix :) 1314 2014-05-20 00:41:03 jeffmo var resolveError = null; try { resolve.sync() } catch (e) { resolvError = e; } /* do FB-specific nonsense */ throw resolveError; 1315 2014-05-20 00:42:41 spicyj haha 1316 2014-05-20 00:42:45 spicyj perfect 1317 2014-05-20 00:43:19 spicyj at least you rethrow it 1318 2014-05-20 00:43:47 spicyj better than nonsense like https://secure.phabricator.com/D9171?id=21785#inline-35714 1319 2014-05-20 00:44:55 spicyj wait is your re-throw outside of the catch? 1320 2014-05-20 00:45:05 spicyj that makes sense 1321 2014-05-20 00:46:57 jeffmo spicyj: https://github.com/facebook/jest/commit/8106ade4b8d0317330b2bc7b605c1f36867483ff 1322 2014-05-20 00:47:56 jeffmo if (NODE_CORE_MODULES[moduleName]) { return null; } /* YES INDEED */ 1323 2014-05-20 10:34:38 Ron30``` hey guys can anyone help me 1324 2014-05-20 10:37:47 Ron30``` if i need to make doc changes and send a pull request should i make it in markdown files in the master branch? 1325 2014-05-20 10:38:20 Ron30``` Usually changes to github hosted sites are made in gh-pages branch , so I ask.. 1326 2014-05-20 10:39:02 Ron30``` Is it that the .html files in ghpages branch are gbeing generated from the .md files in master branch? 1327 2014-05-20 10:46:34 chenglou Ron30```: yes, modify the md files 1328 2014-05-20 10:46:40 chenglou htmls are generated 1329 2014-05-20 10:52:17 Ron30``` alrighty,.but i accidentally pushed a commit to an html file...is it ok if i push another commit to undo the changes ...since I am using the github site to make changes and not any client...so cant revert.. 1330 2014-05-20 10:52:40 Ron30``` deleting the repository didnt help.. 1331 2014-05-20 10:52:56 andreypopp "git reset HEAD^" - removes commit 1332 2014-05-20 10:52:57 chenglou Ron30```: deleting the repo should totally have worked? lol 1333 2014-05-20 10:53:13 chenglou andreypopp: he's doing it on github.com 1334 2014-05-20 10:53:20 andreypopp ah... 1335 2014-05-20 10:53:37 Ron30``` i mean deleting the forked copy.. 1336 2014-05-20 10:53:57 chenglou Ron30```: if you delete your fork and edit the md again it'll re-fork a new version 1337 2014-05-20 10:53:58 andreypopp ACTION is not holding any liability for what I'm saying here :-) 1338 2014-05-20 10:54:01 chenglou last time I checked 1339 2014-05-20 10:54:45 Ron30``` i deleted the forked and then again forked ...but the commit changes to the html files still exist 1340 2014-05-20 10:55:21 chenglou woah that's new... 1341 2014-05-20 10:55:29 Ron30``` github bug perhaps 1342 2014-05-20 10:55:57 chenglou might be 1343 2014-05-20 10:56:32 Ron30``` so is it ok if i just push a commit to an html file to undo the changes ? 1344 2014-05-20 10:57:35 Ron30``` since I haven't edited any .md file yet.. 1345 2014-05-20 10:57:53 chenglou I think you'll be asked to squash your commits into one, in which case you'd need to use git anyways 1346 2014-05-20 10:58:03 chenglou do you need any help with git? 1347 2014-05-20 11:10:03 Ron30``` I'll try deleting it again...if it doesnt help..let me know the git way to do it...I have git installed on my home computer.. 1348 2014-05-20 11:11:11 chenglou k 1349 2014-05-20 11:33:14 Ron30``` lol solved the issue..sry for the late reply..was busy with other work.. 1350 2014-05-20 11:33:39 Ron30``` Thanks for the help chenglou and andreypopp anyway :) 1351 2014-05-20 11:34:35 chenglou np! 1352 2014-05-20 11:34:42 chenglou what was the problem? 1353 2014-05-20 11:37:37 Ron30``` outdated commits (from deleted repos) still existed...that was causing confusion..github should probably look into it.. 1354 2014-05-20 11:38:17 Ron30``` i'll send a pull request today or tom.. 1355 2014-05-20 11:38:31 Ron30``` cya 1356 2014-05-20 14:42:51 devexial hey all - i current run my npm test command using "test": "karma start" 1357 2014-05-20 14:43:02 devexial is there a way i can pull in jest around my existing tests? 1358 2014-05-20 14:44:08 devexial by adding an entry to karmajs' files [] array? 1359 2014-05-20 14:44:27 devexial files: [ 1360 2014-05-20 14:44:27 devexial 'public/assets/application.js', 1361 2014-05-20 14:44:27 devexial 'public/assets/mocks.js', 1362 2014-05-20 14:44:27 devexial 'public/assets/jest.js ] 1363 2014-05-20 14:44:29 devexial for example? 1364 2014-05-20 18:30:32 jeffmo devexial: I’m not very familiar with karma, so I’m not completely sure how to help there — a quick search suggests karma uses jasmine tests? 1365 2014-05-20 18:31:43 devexial jeffmo: yeah, karmajs starts a local node.js server to serve up jasmine tests 1366 2014-05-20 18:32:35 devexial and then launches a browser (in my case phantomjs) and calls the jasmine tests 1367 2014-05-20 18:32:48 jeffmo devexial: I see — well if it’s using jasmine, it might be possible to run jest over the tests. Are you using CommonJS for your modules at all? (I’m not super familiar with what standard practice is for angular app modules) 1368 2014-05-20 18:33:04 devexial actually not an angular app here 1369 2014-05-20 18:33:08 devexial not using commonjs either 1370 2014-05-20 18:33:18 devexial i was intrigued by the automocks moreso 1371 2014-05-20 18:33:21 devexial in jest 1372 2014-05-20 18:35:06 jeffmo devexial: ah gotcha — well to be up front: Jest is most ideally geared toward CommonJS modules. Because it understands commonjs it’s able to find modules, analyze them, automatically build mocks for them, and then return those mocks from CommonJS’s require() function. Are you, by chance, using any other similar kind of module system? 1373 2014-05-20 18:36:17 devexial jeffmo: i see. no, we're not 1374 2014-05-20 18:36:38 devexial rails app, everything is precompiled into a massive application.js 1375 2014-05-20 18:36:50 devexial minified and gzipped 1376 2014-05-20 18:36:56 devexial single page app 1377 2014-05-20 18:37:14 devexial well, thanks for the info! 1378 2014-05-20 18:37:25 jeffmo devexial: Ah, yea could be tricky then :( We do have longer term plans to support other module systems than just CJS — but jest’s mocking system really only works if there’s a module system for it to interact with 1379 2014-05-20 18:37:52 jeffmo devexial: you bet! One thing that just occurred to me: 1380 2014-05-20 18:38:47 jeffmo devexial: are you already using a mocking system of some kind? 1381 2014-05-20 18:40:44 devexial jeffmo: nope, we just make our own mock objects as we go/as needed 1382 2014-05-20 18:41:05 devexial just happen to be thinking about moving towards something better at some point 1383 2014-05-20 18:41:18 devexial the phrase automock caught my attention 1384 2014-05-20 18:41:23 devexial #lazy 1385 2014-05-20 18:43:30 jeffmo devexial: :p gotcha. I was going to say: I know there are a couple standalone libs out there that just help you construct and build mocks — but yea, auto-generating a mock for a thing is hard if you can’t automatically know where to find the real thing to generate the mock for 1386 2014-05-20 18:43:47 jeffmo sinon.js, for example, seems like a pretty popular one 1387 2014-05-20 18:47:49 devexial hm i think we could benefit from trying jest out - the automocks on the DOM api still seem super useful 1388 2014-05-20 18:48:12 devexial basically no browser needed, right? 1389 2014-05-20 19:06:39 jeffmo devexial: oh sorry, my irc thing didn’t beep at me. Right, if you can manage to work in CommonJS modules for your JS somehow, you can run your tests in our command-line environment which has a fully faked-out DOM API included 1390 2014-05-20 19:08:34 jeffmo devexial: I’m also ashameldy unfamiliar enough with rails to truly understand how feasible it would be to have rails spit out CJS modules — but if it could, you could easily run the tests across that…then use something like browserify to finish the job (browserify takes a bag of CommonJS modules and wraps them all up into a single massive application.js file similar to what you described earlier) 1391 2014-05-20 19:09:25 jeffmo The nice thing about a module system is that it just makes management of your JS code much more sane for humans (IMO, at least) 1392 2014-05-20 19:10:23 devexial i see, that's super helpful. indeed its possible 1393 2014-05-20 19:10:24 devexial https://github.com/maccman/sprockets-commonjs 1394 2014-05-20 19:10:37 devexial sprockets is the actual asset pipeline compiler used by rails 1395 2014-05-20 19:11:08 jeffmo oh nice — btw, I know zpao has done some stuff in this space with regard to react 1396 2014-05-20 19:15:09 devexial not familiar but from our chat i've learned a bunch of stuff to investigate 1397 2014-05-20 19:15:21 devexial thanks double, triple for the answers 1398 2014-05-20 19:23:14 jeffmo devexial: any time 1399 2014-05-20 19:25:04 spicyj jeffmo: merge https://github.com/facebook/jest/pull/34? 1400 2014-05-20 19:26:42 jeffmo spicyj: done 1401 2014-05-20 19:36:38 simenbrekken jeffmo: any more documentation around for jstransform? I'm trying to transform require('FooModule') statements into require('./FooModule') 1402 2014-05-20 20:08:05 jeffmo simenbrekken: not a great amount of docs other than the Readme :/ Happy to answer any questions though? 1403 2014-05-20 20:08:19 simenbrekken jeffmo: then consider that my first question :) 1404 2014-05-20 20:08:46 jeffmo Ok, are you trying to combine this with other transforms (like the react JSX transforms)? Or are we talking clean slate? 1405 2014-05-20 20:09:44 jeffmo iirc you were working with React the other day when we talked, right? 1406 2014-05-20 20:09:53 simenbrekken jeffmo: combine 1407 2014-05-20 20:10:29 simenbrekken jeffmo: i'm trying to compile JSX, and make all requires relative to a single module directory, like react does. 1408 2014-05-20 20:10:46 jeffmo So you’ll want to start by writing a visitors file similar to what’s describe in the Readme: https://github.com/facebook/jstransform/blob/master/README.md 1409 2014-05-20 20:11:12 jeffmo A visitors file basically has [at least] two things: (1) a visitor function and (2) a test function for that visitor 1410 2014-05-20 20:11:47 jeffmo jstransform will parse the source into an AST, walk the syntax tree it parsed, and apply each test function to each node in the tree 1411 2014-05-20 20:12:11 simenbrekken jeffmo: I've gotten this far: https://gist.github.com/0253ba11d8b281aaa642 1412 2014-05-20 20:12:14 jeffmo if the test function returns true for a given node, jstransform will run the visitor function on that node 1413 2014-05-20 20:13:14 jeffmo simenbrekken: perfect — where you have your ‘do magical stuff’ commen you can start by console.log()ing out the node you’re visiting to get a sense for what you’re working with 1414 2014-05-20 20:13:39 simenbrekken jeffmo: I know that node.arguments[0].value is the value i'd like to modify, I just can't figure out how to make the change 1415 2014-05-20 20:14:01 simenbrekken jeffmo: Basically my entire transform could be return './' + moduleName 1416 2014-05-20 20:17:13 jeffmo Got it — so you’re going to also want to do var utils = require(‘jstransform/src/utils’);, and then you can replace the original text with new text by doing: 1417 2014-05-20 20:17:17 jeffmo utils.catchup(node.arguments[0].range[0] + 1, state); /* <- moves the transformation cursor up to right after the first quote of the “ModuleName” string */ 1418 2014-05-20 20:17:23 jeffmo utils.append(“./“, state); /* <- adds a ./ right before the module name */ 1419 2014-05-20 20:17:28 jeffmo utils.catchup(node.range[1], state); /* <- moves the cursor all the way through to the end of the node before continuing traversal */ 1420 2014-05-20 20:18:15 jeffmo utils.catchup moves you to a certain point in the node, utils.append adds stuff to the source wherever you’re currently at 1421 2014-05-20 20:19:21 simenbrekken great, thanks :) 1422 2014-05-20 20:25:55 simenbrekken Here's the final gulp task for anyone else that was curious: https://gist.github.com/93813e95d8115e713d33 1423 2014-05-20 20:27:59 vjeux_ simenbrekken: what does it do? 1424 2014-05-20 20:29:19 simenbrekken My sources are in src/scripts/Application.jsx and src/scripts/components/ui/Button.jsx etc. This task transforms all sources JSX into vanilla JS and makes sure I can do var Button = require('Button') from anywhere in the source tree 1425 2014-05-20 20:39:33 vjeux simenbrekken: nice! 1426 2014-05-20 20:39:50 simenbrekken now I just need to make it fast :) 1427 2014-05-21 06:47:18 spicyj jeffmo: ReactEventEmitter-test has .dontMock('BrowserScroll') which jest doesn't like because that doesn't exist in open source 1428 2014-05-21 06:47:26 spicyj what do I do? :) 1429 2014-05-21 06:49:04 jeffmo spicyj: check with zpao to see if it’s necessary — and if not, maybe we can delete it. (if it is, we’ll need to make some kind of stub for it in OS) 1430 2014-05-21 06:49:12 spicyj k 1431 2014-05-21 19:10:35 ide jeffmo: i am setting up jest to give it a spin 1432 2014-05-21 19:10:47 vjeux ide: nice! 1433 2014-05-21 19:10:59 ide hi vjeux :) 1434 2014-05-21 19:11:03 jeffmo ide: nice 1435 2014-05-21 19:11:03 vjeux hey 1436 2014-05-21 19:11:14 ide i had a question, maybe one of you guys could answer it 1437 2014-05-21 19:11:38 jeffmo shoot 1438 2014-05-21 19:11:47 ide in one of the examples i saw that testPathIgnorePatterns was set to ignore node_modules 1439 2014-05-21 19:11:54 ide which makes a lot of sense 1440 2014-05-21 19:12:03 ide i was wondering why that’s not the default 1441 2014-05-21 19:12:14 vjeux the docs says it is the default 1442 2014-05-21 19:12:17 ide oh 1443 2014-05-21 19:12:31 vjeux http://facebook.github.io/jest/docs/api.html#config-testpathignorepatterns-array-string 1444 2014-05-21 19:12:38 ide haha ok 1445 2014-05-21 19:12:48 ide i was reading the last paragraph of http://facebook.github.io/jest/docs/tutorial-react.html#content 1446 2014-05-21 19:12:51 jeffmo https://github.com/facebook/jest/blob/master/src/lib/utils.js#L22 1447 2014-05-21 19:13:01 jeffmo ide: vjeux: We should probably just take that out of the example then 1448 2014-05-21 19:13:16 vjeux jeffmo: did you add it as default after launch? 1449 2014-05-21 19:13:27 vjeux i'm pretty sure it wasn't when i wrote the example 1450 2014-05-21 19:13:29 jeffmo vjeux: I might have 1451 2014-05-21 19:13:31 vjeux ok 1452 2014-05-21 19:13:37 vjeux then yeah, need to remove it from the example 1453 2014-05-21 19:13:46 vjeux ide: sorry for the confusion! 1454 2014-05-21 19:14:00 vjeux let me submit a pr for this 1455 2014-05-21 19:19:18 vjeux ide: https://github.com/facebook/jest/commit/efc1b79a9d34c59db29fcf7a0672a55ff63ae905 thanks :) 1456 2014-05-21 19:19:35 ide cool 1457 2014-05-21 19:59:34 vjeux jeffmo: this is excellent https://github.com/facebook/jest/pull/45 1458 2014-05-21 21:33:13 vjeux ide: what is `jest -o` supposed to do? 1459 2014-05-21 21:33:41 vjeux oh, --onlyChanged, -o 1460 2014-05-21 21:34:38 vjeux https://gist.github.com/anonymous/a925ed9950acff4767b1 1461 2014-05-22 02:57:44 vjeux jeffmo: https://twitter.com/jameschesters/status/469275336195047424 1462 2014-05-22 21:20:30 jacktoole1 Hello! 1463 2014-05-22 21:21:25 jacktoole1 I'm trying to set up jest for a project that pulls in requirejs, but the haste loader is dying on requirejs. Does anyone know if the sandbox has a way to access node's raw require function? (Would that even make sense to access?) 1464 2014-05-22 21:25:49 jeffmo jacktoole1: Unfortunately at the moment jest only works for commonjs-style modules (https://github.com/facebook/jest/issues/17). We have high hopes of building a module loader plugin for amd-style modules (a la requirejs) at some point in the future, but it’s a little ways off right now :/ 1465 2014-05-22 21:29:10 jeffmo jacktoole1: I wonder if it would be possible to build a simple transpiler that converts require([‘dep1’, ‘dep2’], function(dep1, dep2) { /* module code here */ }) into something like var dep1 = require(‘dep1’); var dep2 = require(‘dep2’); /* module code here */ though? 1466 2014-05-22 21:29:41 jeffmo If you could, then you might be able to plug that into jest and have it pre-process requirejs amd modules that way in order to understand them 1467 2014-05-22 21:30:03 jeffmo (I don’t know all the ins and outs of requirejs though myself, so I’m not sure if that would miss some important use-cases?) 1468 2014-05-22 21:30:15 jeffmo jacktoole1: ^ 1469 2014-05-22 21:32:31 jacktoole1 I don't know the ins and outs of requirejs either. jest/haste's require function is actually dying on the requirejs file itself, with "Unexpected token ILLEGAL" 1470 2014-05-22 21:33:27 jacktoole1 I was thinking if there was a way to grab node's actual require function, I could just use that; I'm not actually trying to test any of the requirejs stuff 1471 2014-05-22 21:33:49 jeffmo jacktoole1: not sure exactly what you mean by node’s actual require function? 1472 2014-05-22 21:34:07 jeffmo jacktoole1: also, which file is jest fataling on? 1473 2014-05-22 21:34:17 jeffmo (one of yours? or one of requirejs’ lib files?) 1474 2014-05-22 21:34:37 jacktoole1 requirejs's main lib file 1475 2014-05-22 21:35:04 jacktoole1 (well, r.js, maybe it's not the main lib file) 1476 2014-05-22 21:37:54 jeffmo jacktoole1: hmm, I’m not getting the unexpected token ILLEGAL message with the following: https://gist.github.com/jeffmo/23095265687c554e935d 1477 2014-05-22 21:38:45 jeffmo I have an r.js file at the root dir, a little test under __tests__/Foo-test.js, and I just run `jest` and it fatals with Object [object Object] has no method 'match' (but not a parse error) 1478 2014-05-22 21:39:58 jacktoole1 hmm, interesting 1479 2014-05-22 21:40:36 jeffmo an that looks like it’s because r.js is trying to eval a require() that doesn’t work well with jest’s (or node’s, for that matter) form of require() 1480 2014-05-22 21:40:59 jeffmo but I am curious why you’d be getting a parse error... 1481 2014-05-22 21:41:45 jacktoole1 r.js shoud work with node (I have the tests running in mocha), though I'd understand if it didn't with jest's require 1482 2014-05-22 21:42:05 jacktoole1 not sure on the parse error either. I'm going to try to see if I can load the web version of requirejs since we have jsdom 1483 2014-05-22 21:46:36 jeffmo jacktoole1: I think it’s thrown off by jest because it thinks its in a browser (probably because it’s keying off of some API that exists in vanilla node, but not in a JSDom context) 1484 2014-05-22 21:47:31 jeffmo so it might be seeing something like document.createElement (random browser-only API that I’m just using as an example), and says “hey, I’m not in node! so I dont have to use node’s require()!” 1485 2014-05-22 21:48:56 jacktoole1 believable! especially for the web version 1486 2014-05-22 21:49:38 jacktoole1 I did have r.js working in mocha with jsdom though 1487 2014-05-22 21:57:43 jacktoole1 some success! I managed to get it to not crash 1488 2014-05-22 21:59:53 jeffmo jacktoole1: what was the issue? 1489 2014-05-22 22:14:50 jacktoole1 Okay; I ended up precompiling the requirejs stuff and requireing that, which worked :) 1490 2014-05-22 22:15:31 jeffmo jacktoole1: whoa, cool! How are you precompilng it? 1491 2014-05-22 22:19:56 jeffmo ide: v0.1.12 published — should be able to re-install -g now 1492 2014-05-22 22:20:12 ide thanks jeffmo 1493 2014-05-22 22:26:50 spicyj jeffmo: http://requirejs.org/docs/optimization.html 1494 2014-05-22 22:26:56 spicyj (hi jacktoole1) 1495 2014-05-22 22:28:10 jeffmo oh nice 1496 2014-05-22 22:29:03 jeffmo spicyj: pete mentioned something about webpack having some magic related to requirejs/commonjs/es6 modules/etc — I’m curious if that could be of use somehow too 1497 2014-05-22 22:29:09 jeffmo in the medium term 1498 2014-05-22 22:29:13 spicyj yes, webpack is magic 1499 2014-05-22 22:29:25 vjeux ide: were you involved in haste (at fb) at all? 1500 2014-05-22 22:29:28 spicyj I haven't thought much about how it could integrate with jest 1501 2014-05-22 22:30:02 ide vjeux: lol 1502 2014-05-22 22:30:28 vjeux ? 1503 2014-05-22 22:30:33 vjeux (did you write it? :p) 1504 2014-05-22 22:31:03 ide epriestley wrote the first version 1505 2014-05-22 22:31:27 ide i refactored a bunch of it and wrote some of the newer features 1506 2014-05-22 22:31:30 vjeux i see :) 1507 2014-05-22 22:32:00 ide i thought there was a chance you were joking when you asked that :P 1508 2014-05-22 22:32:46 vjeux now i understand why you have so many feedback on jest's haste :p 1509 2014-05-22 22:34:00 vjeux that's cool to see that fb alumni are using projects we open source 1510 2014-05-23 07:28:08 bjorn_ Hello, just took Jest out for a spin and hit a block right away: “define is not defined”. Any simple solution to this? 1511 2014-05-23 07:33:30 bjorn_ Ah, found the problem - No RequireJS support. Bummer! 1512 2014-05-23 12:30:42 Miitch Hi there I am working on integrating jest that was pretty easy 1513 2014-05-23 12:30:54 Miitch but I am running in some issues while trying to mock superagent 1514 2014-05-23 12:31:28 Miitch I am getting this kind of errors: https://gist.github.com/mitchelkuijpers/6e4fae2c5a2f693ab79b 1515 2014-05-23 12:40:11 Miitch Any ideas? I got somewhere by adding jest.dontMock('buffer'); and that kind of fun 1516 2014-05-23 12:51:10 Miitch It seems to be something with core node modules 1517 2014-05-23 14:46:32 inkwellian So... I would like to be able to use coffeescript without having to add the .coffee extension in my requires (in the lib code, not the test code). 1518 2014-05-23 14:47:25 inkwellian I would guess that in my test a require('coffee-script/register') would work -- but I'd be wrong. :) 1519 2014-05-23 14:47:31 inkwellian Anyone gotten this working? 1520 2014-05-23 15:12:47 AsaAyers What is the best way to try to debug a test? When I used Jasmine I would use the Chrome debugger, or when running from the console I would console.log, but neither seem to be an option with Jest 1521 2014-05-23 15:32:31 AsaAyers inkwellian, I was looking at the logs and saw your question about requiring coffee files without the extension. I'm working on fixing that in https://github.com/facebook/jest/pull/45 1522 2014-05-23 15:37:20 inkwellian AsaAyers: Nice! I guess I have to wait for that to get stabilized and release. Alas. 1523 2014-05-23 15:37:46 inkwellian AsaAyers: I was able to log to the console using process.stdout.write() 1524 2014-05-23 15:41:28 AsaAyers Thanks, that got me the info I need, only to find that Jest isn't mocking my require like I expected :( 1525 2014-05-23 16:27:22 luismreis hello ? 1526 2014-05-23 16:52:03 luismreis I'm getting "SyntaxError: /Users/lmfr/work/sapo/doidos/tip/lib/models/show.js: /Users/lmfr/work/sapo/doidos/tip/node_modules/JSONStream/index.js: Unexpected token ILLEGAL" when requiring a module that requires 'JSONStream' 1527 2014-05-23 16:52:54 luismreis If I comment that require('JSONStream'), my (for now empty) test runs. 1528 2014-05-23 17:05:54 luismreis anyone here that is not a cricket ? 1529 2014-05-23 17:06:00 luismreis ... 1530 2014-05-23 17:26:09 luismreis ??? 1531 2014-05-23 17:32:29 luismreis hello ??? 1532 2014-05-23 17:32:37 AsaAyers hello 1533 2014-05-23 17:33:34 luismreis I'm having trouble with a module that requires JSONStream 1534 2014-05-23 17:34:16 luismreis I'm getting "SyntaxError: .../lib/models/show.js: .../node_modules/JSONStream/index.js: Unexpected token ILLEGAL" when requiring a module that requires 'JSONStream' 1535 2014-05-23 17:34:30 luismreis If I comment that require('JSONStream'), my (for now empty) test runs. 1536 2014-05-23 17:36:26 AsaAyers ¯\\_(?)_/¯ I have no idea. Maybe you can create a gist or a small repo that reproduces the problem. 1537 2014-05-23 17:39:39 AsaAyers From your description it sounds like the kind of problem where your only hope is that someone else is having the same problem. If you have reproducible code someone should be able to poke at it. 1538 2014-05-23 17:43:02 luismreis ok, thanks 1539 2014-05-23 17:59:37 rcs luismreis: Anything that's doing naive js parsing of JSONStream/index.js is going to have some issues. It's got a #! line up top which isn't correct js. node's require has some magic to work around it. 1540 2014-05-23 18:00:06 rcs https://github.com/dominictarr/JSONStream/blob/master/index.js#L1 1541 2014-05-23 18:54:50 juntheman Hi all, when using Jest + React, did anyone run into an issue where $(this.getDOMNode()) returns undefined? 1542 2014-05-23 19:02:17 vjeux juntheman: what did you use to render the element? 1543 2014-05-23 19:02:20 vjeux ReactTestUtils? 1544 2014-05-23 19:02:26 juntheman yes 1545 2014-05-23 19:03:06 vjeux ReactTestUtils doesn't use the DOM 1546 2014-05-23 19:03:25 vjeux React.renderComponent if you want to test against the dom 1547 2014-05-23 19:03:30 vjeux but it's going to make the test slower 1548 2014-05-23 19:04:25 juntheman ok, thx for the tip! 1549 2014-05-23 19:05:00 vjeux juntheman: we should probably write a warning if you call getDOMNode() while using ReactTestUtils 1550 2014-05-24 00:14:17 luismreis hi 1551 2014-05-24 00:16:22 luismreis I had a problem with jest/contextify today... 1552 2014-05-24 00:16:50 luismreis because JSONStream's index.js starts with a shebang. Any hint on how to fix this ? 1553 2014-05-24 00:36:51 luismreis anyone here ? 1554 2014-05-24 15:56:44 jeffmo luismreis: heya, still there? 1555 2014-05-24 16:07:41 jeffmo luismreis: I just pushed a fix for this + an updated version v0.1.13 — if you get a chance, mind confirming that fixes your issue? 1556 2014-05-24 16:07:57 luismreis hi 1557 2014-05-24 16:08:47 jeffmo luismreis: https://github.com/facebook/jest/commit/9bcd5297366ae9076fe5692ce8a1222cf823ea0b 1558 2014-05-24 16:09:23 luismreis going for it right now! 1559 2014-05-24 16:10:04 jeffmo ok — I have to head out, but if you’re still having issues feel free to open a github issue so we don’t lose track of it 1560 2014-05-24 16:13:31 luismreis Not working :( ... I've seen the patch and it should... 1561 2014-05-24 16:29:26 luismreis THe issue was already filed as #52. 1562 2014-05-25 22:16:50 piotrpalek_ hey all, I got a question about Jest :) 1563 2014-05-25 22:17:15 piotrpalek_ is it possible to set it up like Karma? I mean so tests run fast and update when files change 1564 2014-05-25 22:17:58 piotrpalek_ now when i run 'npm test' it takes a while (10-15s) until the test framework etc. is able to bootstrap itself, after that the tests run 1565 2014-05-25 22:18:29 piotrpalek_ and it is not nice to have to wait such a long time -> translates into tests not being written/run every time 1566 2014-05-25 22:18:39 piotrpalek_ i'd like to avoid that.. 1567 2014-05-25 22:19:11 spicyj it shouldn't take 10-15s 1568 2014-05-25 22:20:26 piotrpalek_ uh, ok now it takes 3s.. well nevermind the speed 1569 2014-05-25 22:21:04 piotrpalek_ hmm so I should probably just watch for file changes and re-run npm test every time? 1570 2014-05-25 22:21:29 piotrpalek_ I am curious how facebook uses Jest in their workflow, any idea about that 1571 2014-05-25 22:21:30 spicyj I think there's a PR open to add a --watch 1572 2014-05-25 22:21:36 spicyj we'll see if it makes it in 1573 2014-05-25 22:21:41 piotrpalek_ would be nice :) 1574 2014-05-27 15:31:33 jeffmo spicyj: hey, yt? You’re the one who made https://github.com/facebook/jest/blob/master/website/src/jest/img/opengraph.png right? 1575 2014-05-27 15:31:40 jeffmo What font is that? 1576 2014-05-27 15:35:26 syranide jeffmo: helvetica neue perhaps? 1577 2014-05-27 15:36:07 jeffmo syranide: not quite — for ex: the bottom serif on the ’t’ doesn’t quite match 1578 2014-05-27 15:36:31 jeffmo not the end of the world if I can’t figure it out — but curious for my slides for jsconf 1579 2014-05-27 15:38:39 syranide jeffmo: ah but ofc 1580 2014-05-27 15:38:42 syranide proxima nova 1581 2014-05-27 15:39:05 syranide or not, it's some weird mix of those two 1582 2014-05-27 15:39:31 syranide hmm, I'm pretty sure it's proxima nova 1583 2014-05-27 15:40:08 syranide jeffmo: http://www.fonts.com/font/mark-simonson-studio/proxima-nova/semibold/web-font 1584 2014-05-27 15:50:26 jeffmo syranide: nice, that seems pretty close to me 1585 2014-05-27 15:50:50 syranide jeffmo: I'm pretty damn sure it's the one (it's even referenced in a CSS file there :P) 1586 2014-05-27 15:51:24 jeffmo oh nice 1587 2014-05-27 15:51:32 syranide make sure to link to your talk when it's done! 1588 2014-05-27 17:44:41 spicyj definitely Proxima Nova to match the text on the site 1589 2014-05-27 17:44:47 spicyj oh he's gone 1590 2014-05-27 17:53:14 syranide ^^ 1591 2014-05-27 17:54:14 syranide if you just say "Proxima Nova" whenever someone asks a font question, you're pretty much guaranteed a 50/50 chance of being right ;) 1592 2014-05-27 18:10:12 spicyj that's sort of true 1593 2014-05-27 18:10:20 spicyj what font does the KA site use? 1594 2014-05-27 18:10:22 spicyj Proxima Nova! 1595 2014-05-27 18:11:43 syranide and our c5mail? proxima nova! 1596 2014-05-28 02:08:02 Lingo Hi — new to freenode, anyone here? 1597 2014-05-28 06:35:28 RonD @jeffmo : This is regarding https://github.com/facebook/jest/pull/49 ...needed your help rebasing if you have the time.. 1598 2014-05-28 06:36:08 RonD I have been visiting here for the past 2-3 days..but couldn't find you online. 1599 2014-05-28 06:51:07 spicyj RonD: jeffmo might be traveling, not sure 1600 2014-05-28 06:53:45 RonD oh ok, I asked for his help since he was the collaborator who responded to my pull request on github..can you help me out? or should I talk to him instead? 1601 2014-05-28 06:55:28 spicyj sure, what's up? 1602 2014-05-28 06:58:53 RonD He asked me to rebase ( https://github.com/facebook/jest/pull/49 ). But I havent't rebased before. Also I am unsure as to which commit should be rebased (Only the ones to the README.md or all of them ?) 1603 2014-05-28 07:01:20 spicyj I'd recommend reading a guide like https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request 1604 2014-05-28 07:01:49 spicyj I think everything there should be applicable except replace 'edx' with 'facebook' and 'edx-platform' with 'jest' in the commands 1605 2014-05-28 07:04:14 RonD Thanks..willl read it..Also, since I've committed from a local branch created off master..wouldn't it be easier to just delete it and push fresh changes to my local repo and then send a pull request..Or do you prefer rebasing? 1606 2014-05-28 07:04:48 RonD The old pull request will have to be closed then. 1607 2014-05-28 07:06:15 spicyj you can delete your branch locally, recreate it, and force-push to the same remote branch and the existing PR will update 1608 2014-05-28 07:06:17 spicyj that's fine too 1609 2014-05-28 07:07:07 spicyj thanks for contributing :) 1610 2014-05-28 07:10:06 RonD You are welcome :) I'll read the guide and take necessay actions. Thanks for helping ! 1611 2014-05-31 01:36:45 maspwr Hi! Are there any examples of integrating webpack with jest? 1612 2014-05-31 01:48:00 maspwr If anyone has suggestions, please tweet at me @maspwr. Thanks! 1613 2014-06-03 13:29:37 cantera25 ping 1614 2014-06-03 18:24:34 kunalm mnovati: sorry, had to get off the shuttle. back 1615 2014-06-03 20:51:31 jacktoole1 Hey, I think I may have found a bug in jest 1616 2014-06-03 20:51:37 spicyj jacktoole1: I think you're right! 1617 2014-06-03 20:51:39 spicyj jeffmo isn't here 1618 2014-06-03 20:51:47 spicyj neither is vjeux 1619 2014-06-03 20:52:03 jacktoole1 ahaha aww 1620 2014-06-03 20:52:10 jacktoole1 I'll go put it on github 1621 2014-06-03 20:52:26 spicyj although 1622 2014-06-03 20:52:31 spicyj the code definitely claims to read json 1623 2014-06-03 20:52:42 spicyj https://www.irccloud.com/pastebin/5lyAwLCT 1624 2014-06-03 20:52:53 spicyj in HasteModuleLoader.js 1625 2014-06-03 20:52:55 spicyj so 1626 2014-06-03 20:58:09 jacktoole1 it read it correctly the first time! 1627 2014-06-03 20:58:19 jacktoole1 just not the second time the same file was require'd :( 1628 2014-06-03 20:58:47 jacktoole1 https://github.com/facebook/jest/issues/62 1629 2014-06-03 20:59:20 spicyj oh! 1630 2014-06-03 20:59:49 spicyj curious 1631 2014-06-03 21:01:11 spicyj jacktoole1: I think I have a fix 1632 2014-06-03 21:01:26 jacktoole1 spicyj: yay! 1633 2014-06-03 21:06:48 spicyj https://github.com/facebook/jest/pull/63 1634 2014-06-04 01:28:55 ekline would I be able to integrate Jest into a Django app? 1635 2014-06-04 04:26:03 ekline I'm getting an error when I'm attempting to run Jest 1636 2014-06-04 04:26:05 ekline ReactCompositeComponent.js: Cannot read property 'DEFINE_MANY' of undefined 1637 2014-06-04 04:26:16 ekline the error is happening at line 100 column 21 1638 2014-06-04 04:26:30 ekline mixins: SpecPolicy.DEFINE_MANY, 1639 2014-06-04 04:26:40 ekline but it seems SpecPolicy is defined 1640 2014-06-04 04:28:46 ekline any ideas why this error is occurring? 1641 2014-06-04 18:15:03 aaronshaf It's not clear to me where to do config for jest 1642 2014-06-04 18:15:05 aaronshaf in package.json? 1643 2014-06-04 18:16:08 aaronshaf aha, nevermind, I see from the cli 1644 2014-06-04 18:16:11 aaronshaf --config 1645 2014-06-04 18:17:27 jeffmo aaronshaf: you can do —config or you can add a “jest” entry in the package.json 1646 2014-06-04 18:17:36 jeffmo we should probably clarify that in the docs better 1647 2014-06-04 18:17:55 jeffmo aaronshaf: the common case would be to add it to the “jest” property of package.json 1648 2014-06-04 18:18:08 aaronshaf excellent, thank you! 1649 2014-06-04 18:19:48 aaronshaf might want to make that more apparent in the README 1650 2014-06-04 18:20:21 jeffmo aaronshaf: yea, agreed 1651 2014-06-04 18:20:36 jeffmo feel free to open a GH issue (or send a pull request :] ) 1652 2014-06-04 18:24:05 aaronshaf They should just rename the button on GitHub to "complain" 1653 2014-06-04 18:24:15 aaronshaf :-D 1654 2014-06-04 18:27:57 jeffmo aaronshaf: lol 1655 2014-06-04 19:07:08 spicyj jeffmo: https://github.com/facebook/jest/pull/63 1656 2014-06-04 19:07:21 spicyj woah, github changed the diff font 1657 2014-06-04 20:34:26 jeffmo spicyj: swamped at the moment — will try to take a look as soon as I can 1658 2014-06-04 20:34:38 spicyj jeffmo: np 1659 2014-06-05 22:12:22 aaronshaf I get "Found 1 matching tests..." and it just hangs :( 1660 2014-06-05 22:13:18 aaronshaf My test is just a simple expect(1).toEqual(1) 1661 2014-06-05 22:13:39 aaronshaf bah, nevermind 1662 2014-06-05 22:37:48 aaronshaf Any troubleshooting tips on jest running so slow? 1663 2014-06-05 22:39:26 jeffmo aaronshaf: common issues we’ve seen (we need to write some faqs): preprocessing too many things (or pre-processor is slow — like coffeescript), expensive require()s in a beforeEach() that you might try moving out of beforeEach() and simply resetting any necessary module state directly in the beforeEach() 1664 2014-06-05 22:40:09 jeffmo FWIW preprocessor is slow is usually a one-time startup cost though (pre-processing is cached) 1665 2014-06-05 22:40:24 aaronshaf thanks. would love a way to get stats on how much time each stage takes 1666 2014-06-05 22:40:39 jeffmo aaronshaf: yea I agree 1667 2014-06-05 22:41:08 jeffmo aaronshaf: per-test-file runtime is a good start, but we definitely need a lot more perf numbers 1668 2014-06-05 22:42:17 jeffmo Might be able to include runtime numbers with https://github.com/facebook/jest/issues/4 (add a breakdown per passing/failing it-spec like we have now per-file) 1669 2014-06-05 22:42:47 aaronshaf ???? 1670 2014-06-05 22:44:17 jeffmo luckily — jest already reports mostly detailed test results (per-spec) up to the CLI output printer. All we’d need to do is include timing data + print it 1671 2014-06-05 22:45:12 jeffmo (i.e. test results are reported up to the CLI in a data structure. The CLI is responsible for printing them — so we really just need to add some more data to that results data and the rest should be pretty simple) 1672 2014-06-05 22:47:03 aaronshaf awesome 1673 2014-06-05 22:47:22 aaronshaf Even after first pass, it's taking 5 seconds to do a simple expect(0).toEqual(0) test 1674 2014-06-05 22:47:47 jeffmo aaronshaf: what’s your config setup? 1675 2014-06-05 22:47:56 jeffmo and do you have a beforeEach in your test? 1676 2014-06-05 22:48:39 aaronshaf https://gist.github.com/aaronshaf/d1b19ee9ec384cb0cbb8 1677 2014-06-05 22:48:54 aaronshaf no beforeEach 1678 2014-06-05 22:53:09 jeffmo hmmm, interesting… it’s always tricky to debug perf remotely :( normally what I’d do if I had it in front of me though is throw some timers into the CLI (bin/jest.js) to see how much time is spent searching for tests 1679 2014-06-05 22:54:02 jeffmo then some timers into the module loader (src/HasteModuleLoader/HasteModuleLoader.js) — usually around the _execModule method (https://github.com/facebook/jest/blob/master/src/HasteModuleLoader/HasteModuleLoader.js#L203) 1680 2014-06-05 22:54:11 jeffmo that’s where module files themselves actually get executed 1681 2014-06-05 22:54:31 aaronshaf thanks much, I'll give it a shot 1682 2014-06-05 22:54:32 jeffmo and when debugging here, using jest -i (to run all tests in a single process rather than child processes) is helpful 1683 2014-06-05 23:07:54 aaronshaf so I inserted console.log(modulePath), and it looks like most of the time is spent going through node_modules/react/lib/* 1684 2014-06-05 23:08:05 aaronshaf (in Loader.prototype._execModule) 1685 2014-06-05 23:58:02 Cody So, I seem to be having an issue where calling dontMock on anything turns off all mocking on everything. (https://github.com/facebook/jest/issues/64) 1686 2014-06-05 23:59:40 Cody Any chance someone could sanity check what I’m doing? Seems like a pretty major regression to slip through, but I’m basically just copying and pasting from the docs, so... 1687 2014-06-06 22:00:54 aaronshaf How do I prevent jest from running my preprocessors on modules defined from node_modules? 1688 2014-06-06 22:07:10 aaronshaf I only want the preprocessor to process the test files themselves 1689 2014-06-06 22:07:16 aaronshaf No, scratch that 1690 2014-06-06 22:07:35 aaronshaf I just the preprocessor to ignore contents of node_modules 1691 2014-06-06 22:13:10 jeffmo aaronshaf: preprocessor gets the file path as the second argument — so you can conditionally pre-process based on the path of the file 1692 2014-06-06 22:13:37 aaronshaf jeffmo, thanks! 1693 2014-06-06 22:14:36 aaronshaf that just shaved a few seconds off. thanks so much! 1694 2014-06-07 05:19:37 shaunooo hello, is anyone using jest-cli on windows? having trouble running 'npm test', after following the intro guide, i believe i've done everything i need to, but it doesn't matter whether i have anything in my __tests__ folder or not, i get this error: http://pastebin.com/raw.php?i=z3vWJQNc 1695 2014-06-07 05:20:12 shaunooo seems to be node-haste having trouble with FileFinder.find which leads me to think it maybe a platform issue.. ill google that 1696 2014-06-07 05:22:17 spicyj hmm 1697 2014-06-07 05:22:32 spicyj yeah, that seems like a bug 1698 2014-06-07 05:22:47 spicyj can you try editing 1699 2014-06-07 05:22:48 spicyj node_modules\\jest-cli\\node_modules\\node-haste\\lib\\FileFinder.js 1700 2014-06-07 05:22:51 spicyj and on line 91 1701 2014-06-07 05:22:55 spicyj change "this.find" to just "find" 1702 2014-06-07 05:22:57 shaunooo this commit came up on google: https://github.com/facebook/node-haste/commit/e319ce600a8d18fcc18ee1d3f69ea950683a9ae8 - that does appear to be in my copy of FileFinder.js in jest-cli's node_modules, but seems to be the line it's actually crashing on 1703 2014-06-07 05:23:19 shaunooo TypeError: undefined is not a function 1704 2014-06-07 05:23:43 shaunooo weird considering i can see the find function right there above findNative 1705 2014-06-07 05:23:47 spicyj same stack trace or different? 1706 2014-06-07 05:23:51 spicyj oh I see 1707 2014-06-07 05:24:02 shaunooo yeah, same stacktrace 1708 2014-06-07 05:24:03 spicyj down on 104 there is another thing called find 1709 2014-06-07 05:24:21 spicyj so change that to 'proc' or something 1710 2014-06-07 05:24:59 shaunooo yep that's fixed it 1711 2014-06-07 05:25:07 spicyj okay 1712 2014-06-07 05:25:09 shaunooo also combined with removing 'this.' 1713 2014-06-07 05:25:23 spicyj want to submit a PR to node-haste? 1714 2014-06-07 05:25:33 shaunooo cheers 1715 2014-06-07 05:25:34 shaunooo alright i 1716 2014-06-07 05:25:41 shaunooo i'll give a shot, never done such a thing before 1717 2014-06-07 05:25:45 spicyj okay 1718 2014-06-07 05:25:50 spicyj let me know if you run into trouble 1719 2014-06-07 05:28:07 shaunooo i've put my test back in the __tests__ folder but it's reporting 0 tests found, is there a specific file pattern it's looking for? xxx-test.js is what i have, does it need a specific header too? could still be a problem with the find 1720 2014-06-07 05:29:05 shaunooo let me paste my test 1721 2014-06-07 05:30:19 shaunooo http://pastebin.com/iba0eJyL 1722 2014-06-07 05:31:39 spicyj I think that should work 1723 2014-06-07 05:32:10 shaunooo bit of a stretch but is there any tool i can use to place breakpoints in the FileFinder.js while jest runs? 1724 2014-06-07 05:35:53 spicyj I don't think so, just have to use console.log 1725 2014-06-07 05:35:59 spicyj running jest -i may help; it disables multithreading 1726 2014-06-07 05:36:46 shaunooo doesn't seem to have, i'll see if i can debug the filefinder with console.logging 1727 2014-06-07 05:37:41 shaunooo jest doesn't seem to be adding the __tests__ subdirectory into the scanDirs parameter 1728 2014-06-07 05:38:16 spicyj https://github.com/facebook/jest/pull/18 1729 2014-06-07 05:41:12 spicyj shaunooo: also, I see someone has a PR open to fix node-haste as well https://github.com/facebook/node-haste/pull/12 1730 2014-06-07 05:43:06 shaunooo nice one, i updated my jest files with #18 and it all works now 1731 2014-06-07 05:43:14 shaunooo thanks for your help, looks like they're a step ahead 1732 2014-06-07 05:44:40 spicyj great 1733 2014-06-07 05:44:42 spicyj np 1734 2014-06-07 05:48:01 shaunooo does jest eat console.log's from within the tests? funny it worked inside node-haste but nothing is being output when i console.log inside an "it" - expect(1).toBe(1) is passing but more module load & test is failing but there's no error output 1735 2014-06-07 05:50:52 spicyj I don't think it means to 1736 2014-06-07 05:52:48 chenglou shaunooo: jasmine does. Jest doesn't 1737 2014-06-07 05:57:11 shaunooo have i done something dumb here? seems whenever i try to include my module, it just starts failing, not giving me any kind of error output, besides that the test failed http://pastebin.com/sydN6TRn - i wonder if it's still related to paths? i 'll double check that PR on jest and make sure i got it all 1738 2014-06-07 06:04:29 spicyj shaunooo: should be require("../Dataset") 1739 2014-06-07 06:04:33 spicyj and same with dontMock 1740 2014-06-07 06:04:37 spicyj oh jk 1741 2014-06-07 06:04:42 spicyj I did the paths wrong 1742 2014-06-07 06:05:02 spicyj yeah, that works for me 1743 2014-06-07 06:05:08 spicyj https://www.irccloud.com/pastebin/Kl9rpsGy 1744 2014-06-07 06:05:16 spicyj (on a mac) 1745 2014-06-07 06:05:19 shaunooo ok 1746 2014-06-07 06:05:26 shaunooo i think it's still related to node haste maybe 1747 2014-06-07 06:05:41 shaunooo should i be able to cd into node_modules/jest-cli and run npm test ? 1748 2014-06-07 06:05:52 shaunooo or do i have to download the source from github 1749 2014-06-07 06:06:30 shaunooo seems like it's definitely a platform issue but unsure why the creator of #18 can successfully run tests 1750 2014-06-07 06:07:14 shaunooo how do you run 'jest' just like that? should i npm install jest-cli -g ? 1751 2014-06-07 06:07:17 spicyj I think you need to clone it from github 1752 2014-06-07 06:07:24 spicyj oh, npm test is fine if you set up package.json 1753 2014-06-07 06:07:31 spicyj but yeah, you can also npm install jest-cli -g 1754 2014-06-07 06:07:34 shaunooo ok yeah i have that setup 1755 2014-06-07 06:15:29 shaunooo seems module loading tests are failing when i npm test on jest-master, http://pastebin.com/raw.php?i=4wb0A4wA 1756 2014-06-07 06:19:30 shaunooo re-reading PR#18 i don't see how kl3ryk got his tests to succeed 1757 2014-06-07 06:40:31 shaunooo and now i know why 1758 2014-06-07 06:40:49 shaunooo there'd been a change to HasteModuleLoader.js since his PR, i bet his tests will start failing again 1759 2014-06-07 06:41:04 shaunooo this change broke it, https://github.com/facebook/jest/commit/3710cfbd50e5ffed0a0f5c36a71debb21b5bbaa4#diff-c57162543a4f0bc311cba66ba52baf7b 1760 2014-06-07 06:41:51 shaunooo there's a bit too much going on there for me to get my head around right now but i'll come back to it later to see what i can do - need a break 1761 2014-06-07 06:42:50 shaunooo just skimming, i don't think the 'moduleFileExtensions' config is being passed into this._config 1762 2014-06-07 06:44:58 shaunooo yeah, that's it, though im not sure why but if i hardcode it on the new line 412: var extensions = ['js', 'json']; - everything works fine 1763 2014-06-07 09:35:37 shaunooo argh fuck 1764 2014-06-07 09:36:00 shaunooo it's because i overwrote my lib/urils.js file with the one from #18 which removed the new config moduleFileExtensions 1765 2014-06-07 09:37:45 shaunooo utils* 1766 2014-06-07 09:38:48 shaunooo silly me 1767 2014-06-07 09:43:37 shaunooo back in business baby, so all my issues will be solved once the PR merges happen in #18 from jest and #12 from node-haste 1768 2014-06-07 09:43:55 shaunooo is there a way to +1 those somehow hhe 1769 2014-06-07 10:06:18 shaunooo fuck i give up, my own test is still failing when i include a module, goddamn it 1770 2014-06-07 10:18:19 shaunooo siighh just my fucking broken code 1771 2014-06-07 10:18:42 shaunooo i need a way to warn me about dumb shit: '.protoype' 1772 2014-06-07 10:31:08 shaunooo is there a configuration or something i need to use to get exceptions to show up in the test output? doesn't seem to matter what i do in my own project, no console output or user thrown exceptions show up, though the errors i had when testing jest itself had stacktraces etc 1773 2014-06-07 11:20:24 shaunooo the defaultTestResultHandler really only seems like to output 1 console message and then all others just get eaten 1774 2014-06-07 14:12:42 shaunooo it'd be great if someone were able to run "npm test" on this project for me, i just can't seem to get it to output a the individual test failures :/ 1775 2014-06-07 14:12:44 shaunooo https://www.dropbox.com/s/dwnej0vr5zqtk1y/jest-brokentest.zip 1776 2014-06-07 14:13:23 shaunooo which makes things pretty much useless, i dont understand why though because i can npm test jest itself and it does output individiual test failures if they fail 1777 2014-06-07 14:13:28 shaunooo including stacktraces, exceptions etc 1778 2014-06-07 14:13:38 shaunooo no matter what i do with my package, it just eats all messages :/ 1779 2014-06-07 14:15:29 shaunooo http://pastebin.com/raw.php?i=gP857Cxg that's the only output i get, i should at least be getting an 'expected this, got this' message for the failed test :( 1780 2014-06-07 14:48:46 Cody shaunooo: Are you only worried about windows, or any platform? Because it works on OS X... 1781 2014-06-07 14:49:41 shaunooo thanks for testing, any platform, im on windows in particular which seems to have a few issues, i wanted to first see if it was my project itself or a platform issue 1782 2014-06-07 14:49:50 shaunooo its nearly 3am so im going to sleep and pick it up again tomorrow 1783 2014-06-07 14:50:23 Cody http://pastebin.com/tQsRcnPe I had to re-install jest to get it to work due to binaries needing to be recompiled, but otherwise it Just Worked. 1784 2014-06-07 14:51:20 Cody Nearly 3am? Let me guess, NZ? 1785 2014-06-07 14:52:08 shaunooo cheers that's the output i'd expect and hope to get here, strange too because the actual jest repo gives me proper test output, ah well, yep nz 1786 2014-06-07 23:53:40 shaunoo im so damn stumped, i've tried everything short of a new operating system and i just can't get my tests to output anything besides pass/fail.. even though testing jest itself gives correct output >_< 1787 2014-06-07 23:54:10 spicyj shaunoo: maybe a new OS is just what you need ;) 1788 2014-06-07 23:54:16 shaunoo exact same project tests fine/correct output on a mac 1789 2014-06-07 23:54:26 shaunoo >_< might have to 1790 2014-06-07 23:54:26 spicyj sorry that our Windows support isn't up to par 1791 2014-06-07 23:54:51 shaunoo it's bizarre i'd be happy if it jests own tests had the same issue but they don't 1792 2014-06-07 23:55:00 shaunoo then at least i could find a problem 1793 2014-06-07 23:55:19 shaunoo it's all good just a really quirky one 1794 2014-06-07 23:56:25 shaunoo oh wtf 1795 2014-06-07 23:56:44 shaunoo if i force some random console output at the top of TestRunner.prototype.runTestsParallel all my output now shows correctly 1796 2014-06-07 23:57:20 shaunoo but only if i have multiple files of tests 1797 2014-06-07 23:57:34 shaunoo bizarre.. better get food and keep investigating at least it's something new 1798 2014-06-08 00:16:29 shaunooo it's the call to harmonize() right at the end of jest.js before the _main() call, i if i get rid of that harmonize call, everything works fine 1799 2014-06-08 00:16:54 shaunooo but of a fluke to even comment that out, not sure why i did, or if if jest relies on harmony, how it still runs fine 1800 2014-06-08 00:17:16 shaunooo but i also note that in the TestRunner when spawning the workerpool, it already adds the --harmony flag to the test workers, which doesn't cause issue 1801 2014-06-08 00:17:27 spicyj right, jest spins off worker processes with --harmony 1802 2014-06-08 00:17:40 spicyj the harmonize call is really only necessary when running jest -i to run things in a single process 1803 2014-06-08 00:17:58 shaunooo ah, and jest -i still never worked for me 1804 2014-06-08 00:18:09 shaunooo it had the same issues 1805 2014-06-08 00:18:40 shaunooo wonder if there's some bug in the harmonize module - it's so obscure it's only eating console output in some areas of the codebase 1806 2014-06-08 00:18:55 shaunooo and that symptom may just point to some other issue 1807 2014-06-08 00:18:56 spicyj yeah, that's odd 1808 2014-06-08 00:19:23 spicyj https://github.com/dcodeIO/node-harmonize/blob/master/harmonize.js 1809 2014-06-08 00:19:32 spicyj the source is pretty simple 1810 2014-06-08 00:20:20 shaunooo that's bizarre, i think all of that is cross platform 1811 2014-06-08 00:20:37 shaunooo i better get my coffee and food and will see if i can dig in some more 1812 2014-06-08 01:33:09 shaunooo seems to be the parent process interruption in harmonize that's causing issue: https://github.com/dcodeIO/node-harmonize/blob/master/harmonize.js#L37-L39 1813 2014-06-08 01:33:16 shaunooo must be a little hack or something that's not entirely cross platform 1814 2014-06-08 02:02:03 shaunooo alright, the fix for windows platform is to to replace "test": "jest", with "test": "node --harmony ./node_modules/jest-cli/bin/jest.js" 1815 2014-06-08 02:02:47 shaunooo will need to create a reduced repo of the issue to log with the node-harmonize project as their method of spawning the child process and then interrupting the parent process does not work correctly on windows, not all stdout is piped 1816 2014-06-08 02:17:46 spicyj shaunooo: sounds great, thanks 1817 2014-06-08 02:50:32 shaunooo can't for the life of me figure out a reduced repo that doesn't involve just running a jest test, https://github.com/facebook/jest/blob/master/src/TestRunner.js#L370 the quirks start at this point, so it could be anything in the jasmineTestRunner, JasmineReporter or jasmine itself, if you try to console.log("anything"); inside the result of that promise, only the first console.log will actually 1818 2014-06-08 02:50:33 shaunooo work 1819 2014-06-08 02:51:36 shaunooo if you do any console logs before the testRunner starts, it's fine 1820 2014-06-08 02:52:38 shaunooo damn windows 1821 2014-06-08 03:06:11 shaunooo any console.log inside this return function() gets completely eaten if run using harmonize() - https://github.com/facebook/jest/blob/master/vendor/jasmine/jasmine-1.3.0.js#L1787- might give me something to build off for a repro case 1822 2014-06-08 03:06:27 shaunooo since i think all task runner/jasmine related callbacks are executed via that function 1823 2014-06-08 03:32:57 shaunooo sorry going to have to give up on this, there's just a variety of things combining to cause this issue and i can't pinpoint it, i'm just gonna run with my workaround but was hoping to give something solid for other windows users, my js skills just aren't there for this one unfortunately 1824 2014-06-08 03:33:54 shaunooo i'll log an issue with node-harmonize anyway later in the day outlining the problem i have when used in conjuction with jest but that's about all i can do 1825 2014-06-08 03:34:22 shaunooo at least i can use it now 1826 2014-06-08 11:24:31 joern_ hey, i just discovered jest and trying to setup my test environment. I've seen the config.collectCoverage option but i don't know where i can see the coverage report. 1827 2014-06-09 00:18:33 ekline I am getting errors on these tests despite the component working. I'm not sure how to access the method on a component to write a Spy, heres a gist with the code, https://gist.github.com/evankline/9b9d51bd981c2ccc5710 1828 2014-06-09 00:18:52 ekline can anyone help me understand why Im getting the following errors: when accessing via prototype: spyOn could not find an object to spy upon for handleChange() 1829 2014-06-09 00:19:02 ekline when accessing directly: Error: Expected a spy, but got Function. 1830 2014-06-09 22:31:39 spicyj jeffmo: presumably the stack is the same as if you throw a string right? 1831 2014-06-09 22:31:51 spicyj I just said 1832 2014-06-09 22:31:51 spicyj jeffmo: presumably the stack is the same as if you throw a string right? 1833 2014-06-09 22:32:30 jeffmo spicyj: not sure I understand what you mean? 1834 2014-06-09 22:32:37 spicyj throw "hi jeffmo"; 1835 2014-06-09 22:32:44 spicyj "hi jeffmo".stack // undefined 1836 2014-06-09 22:32:47 spicyj throw undefined; 1837 2014-06-09 22:32:47 jeffmo right 1838 2014-06-09 22:33:53 jeffmo spicyj: var str = “hi jeffmo”; str.stack wouldn’t through (it would just eval to `undefined`) 1839 2014-06-09 22:34:11 spicyj right, I just meant that the new treatment of undefined is no worse than the existing treatment of strings 1840 2014-06-09 22:34:12 jeffmo but var a = undefined; a.stack // throws 1841 2014-06-09 22:34:20 jeffmo spicyj: oh gotcha 1842 2014-06-09 22:34:21 jeffmo sure 1843 2014-06-09 22:34:38 spicyj +1 for more informative notes though 1844 2014-06-09 22:35:13 jeffmo I think ‘No stack trace found’ is still reasonable for throwing strings, do you agree? 1845 2014-06-09 22:35:28 jeffmo although I guess in this case you wouldn’t get it for a thrown string 1846 2014-06-09 22:35:30 jeffmo you’d get undefined 1847 2014-06-09 22:35:35 jeffmo because str.stack === undefined 1848 2014-06-09 22:35:47 jeffmo and !!str === true 1849 2014-06-09 22:39:12 spicyj 'stack' in e 1850 2014-06-09 22:39:18 spicyj e instanceof Error 1851 2014-06-09 22:39:20 spicyj something like that 1852 2014-06-11 16:55:42 aaronshaf npm install jest-cli failing on node 0.11.x 1853 2014-06-11 16:58:24 aaronshaf works on 0.10.29, fails on 0.11.13 1854 2014-06-11 18:07:08 vjeux aaronshaf: how does it fail? 1855 2014-06-11 18:12:39 vjeux jeffmo: 1856 2014-06-11 18:12:42 vjeux aaronshaf 1857 2014-06-11 18:12:42 vjeux npm install jest-cli failing on node 0.11.x 1858 2014-06-11 18:12:42 vjeux aaronshaf 1859 2014-06-11 18:12:43 vjeux works on 0.10.29, fails on 0.11.13 1860 2014-06-11 18:12:56 jeffmo 0.11 is unstable 1861 2014-06-11 18:13:08 vjeux ok 1862 2014-06-11 18:13:20 jeffmo 0.10 is latest stable 1863 2014-06-11 18:13:26 jeffmo things break all the time on latest unstable though 1864 2014-06-11 19:01:16 aaronshaf in which I start using `npm shrinkwrap` :) 1865 2014-06-11 21:49:00 ide what do you guys think about adding jest.dontMockRecursive? Use case is: I require(‘es6-promise’) in a module under test. I don’t want to automock it since it is part of the module’s implementation (vs. interface). Internally es6-promise is made of a bunch of modules but I don’t know what they are (without poking into es6-promise’s code) so I can’t blacklist them from the automocker. 1866 2014-06-11 21:49:34 ide so I want to tell jest that es6-promise and all the modules it requires should not be mocked 1867 2014-06-11 21:49:47 vjeux i asked for that a long time ago as well :p 1868 2014-06-11 21:49:49 vjeux jeffmo: 1869 2014-06-11 21:49:54 ide I feel like there’s been a conversation about dontMockRecursive before :) 1870 2014-06-11 21:50:08 vjeux the problem is that mocks are global 1871 2014-06-11 21:50:22 ide yeah. with node_modules though that changes things 1872 2014-06-11 21:50:33 vjeux so if you don't mock recursive something, then you may don't mock something totally unrelated by mistake 1873 2014-06-11 21:51:02 ide yeah. that’s true in haste 1874 2014-06-11 21:52:41 spicyj chenglou also asked 1875 2014-06-11 21:52:56 jeffmo this is something that I don’t think we’ve been able to come up with a good solution for. We could temporarily keep a recursiveDontMock list when executing require()s in a given module…but you wind up with a pretty confusing situation then. elliot tried doing this by default in autobahn and i think he wound up going back on it after lots of people had trouble with it 1876 2014-06-11 21:53:20 spicyj jeffmo: that doesn't seem terribly confusing to me at first glance 1877 2014-06-11 21:54:05 jeffmo spicyj: it is in practice for the reason vjeux outlined: you do something in one module (not recursively mocked) that has no cross-cutting effects that another module (recursively automocked) depends on 1878 2014-06-11 21:54:54 spicyj jeffmo: sorry, not sure I understand 1879 2014-06-11 21:55:03 jeffmo much easier to reason about and debug “my test isnt working because ModuleX isnt mocked” than “my test isnt working because ModuleX isnt mocked in ModuleY but is in ModuleZ, and ModuleY only works correctly when ModuleZ set it up" 1880 2014-06-11 21:55:55 spicyj in this scenario, Y requires X and you have dontMockRecursive(Z)? 1881 2014-06-11 21:57:13 jeffmo I think so yea 1882 2014-06-11 21:57:43 jeffmo basically you hit a mock for a module depending on how you arrived at that module 1883 2014-06-11 21:57:49 jeffmo when traversing the dependency tree 1884 2014-06-11 21:59:33 jeffmo I think the only issue with it was the confusion aspect though — I should ping elliot again and ask why he pulled out (and I should write this down when I run through this again because it’s a pretty confusing topic) 1885 2014-06-11 21:59:56 spicyj you can record your thoughts in https://github.com/facebook/jest/issues/65 1886 2014-06-11 22:00:03 jeffmo yep 1887 2014-06-11 22:00:13 jeffmo one day, when I dig my way out of this backlog of stuff 1888 2014-06-12 12:36:53 k__ hi, have any of you guys tried to generate tests/coverage report files from jest? 1889 2014-06-12 14:12:04 k__ i believe that the commented out statement "if (config.collectCoverage)" in src/defaultTestResultHandler.js is the answer to my question about coverage report output :( 1890 2014-06-13 00:11:34 kylemathews is there a way to stop jest from taking up to 20 seconds to start? I'm assuming it's related to JSDOM. On subsequent runs it goes much faster but if there's more than a minute or so delay between runs then the next run also takes 20ish seconds #sad 1891 2014-06-13 04:45:18 spicyj kylemathews: jest doesn't take nearly that long for me 1892 2014-06-13 04:53:03 kylemathews spicyj: it takes 20+ seconds every time I run a test... I'm on macosx and the latest version of 10.x node 1893 2014-06-13 04:53:21 kylemathews spicyj: how long does a test run take for you? 1894 2014-06-13 05:30:59 spicyj kylemathews: running 'npm test' in the jest repo takes 4.4 seconds for me 1895 2014-06-13 05:31:19 kylemathews spicyj: I'll try cloning that and see what happens 1896 2014-06-13 05:34:42 kylemathews spicyj: in this repo https://github.com/facebook/jest ? Nothing is happening there for me. I run `node bin/jest.js` and it says it "Found 8 matching tests..." then quits 1897 2014-06-13 05:52:31 spicyj odd 1898 2014-06-13 05:52:43 spicyj I'm not sure why that would be 1899 2014-06-13 16:32:09 Chillax (re-posting from #reactjs to here): anyone using jest to test their react components? Trying to get it working for a project and getting really slow test times (6-7 seconds on only 2 tests). Seems that most of the time is coming from requiring the tested component 1900 2014-06-13 16:58:54 kylemathews Chillax: yup, exactly what I'm seeing except it's even slower for me 1901 2014-06-13 16:58:58 kylemathews 20+ seconds on the first run 1902 2014-06-13 16:59:14 kylemathews though strangely if I run it right after the total time drops to ~5 seconds 1903 2014-06-13 17:46:05 jbaiter Chillax: can confirm, tests take a very long time 1904 2014-06-13 17:46:16 jbaiter are you requiring React in the beforEach as well? 1905 2014-06-13 18:08:43 Chillax jbaiter: not using beforeEach, was just trying to dive in with some simple tests and hit the wall of super slow to the point where i can't see how you could use it during development 1906 2014-06-13 18:09:07 Chillax perhaps as a pre-build automatic process where time wasn't as important, but even then annoying that it should be so slow 1907 2014-06-13 18:37:36 Chillax is there anyone with a large number of react components that uses this for continuous testing? if so, how do you get past the slowness? 1908 2014-06-13 18:37:57 vjeux Chillax: at fb we barely test react component themselves 1909 2014-06-13 18:38:30 vjeux since react components are mostly about display 1910 2014-06-13 18:38:47 vjeux all the mutations are passed to a store via flux, which is heavily tested 1911 2014-06-13 18:38:58 vjeux and are mostly pure functions, don't need to bring in react 1912 2014-06-13 18:51:56 smussell123 Is there an example somewhere of a jest config file? 1913 2014-06-13 18:52:45 vjeux smussell123: in the example folders 1914 2014-06-13 18:52:50 vjeux examples folder 1915 2014-06-13 18:53:02 vjeux https://github.com/facebook/jest/tree/master/examples 1916 2014-06-13 18:53:14 vjeux look at package.json 1917 2014-06-13 18:55:11 smussell123 ok, thanks 1918 2014-06-13 18:57:37 Chillax thanks vjeux that helps correct our approach for testing react apps a bit 1919 2014-06-13 18:58:28 Chillax we had fat components that probably included too much of the component rendering logic directly instead of abstracted out to a util or lib function or object that was required into the component 1920 2014-06-13 18:59:13 vjeux Chillax: in our experience, trying to test the rendering part is not really useful 1921 2014-06-13 18:59:28 vjeux it's really repetitive, and doesn't provide a lot of value 1922 2014-06-13 19:02:34 Chillax yeah, i think our problem was that we had too much logic in our components that didn't really belong there, so moving it out will make it easier to test them as plain js without the unnecessary react overhead 1923 2014-06-13 19:02:59 vjeux what kind of logic? 1924 2014-06-13 19:23:54 Chillax well we structure react components into pages or components, page components map to site pages and handle business logic for that page and pull in the individual ui components 1925 2014-06-13 19:24:33 Chillax we had too much business logic for the app in the page component and just need to look at abstracting that out to libs or utils that we can require in specifically and make it easier to test those individually and separate from the page component 1926 2014-06-13 19:25:44 Chillax ACTION goes to stuff food in face, back shortly 1927 2014-06-13 19:26:14 vjeux sounds good :) 1928 2014-06-13 22:33:49 Gu_______ How do I test modules that use browserify? 1929 2014-06-13 22:34:37 duncan Sorry. Weird nickname 1930 2014-06-13 22:36:13 Guest52338 I'm I'm getting an error from really deep in node_modules: `/node_modules/jest-cli/node_modules/jsdom/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json` 1931 2014-06-13 22:36:35 Guest52338 It's an error reading file: 1932 2014-06-13 22:37:58 spicyj Guest52338: .json requiring is a little buggy right now, https://github.com/facebook/jest/pull/63 may help 1933 2014-06-16 19:10:05 Tark_ Hi there, tried jest today for our project and since dev being on windows we ran into some issues that seems to be solved in a pull request done by kl3ryk. Any idea when it might get integrated? 1934 2014-06-16 19:10:31 vjeux jeffmo: ^^ 1935 2014-06-16 19:22:35 jeffmo Tark_: let me take a look — I’ve been pretty swamped the last couple of weeks, so I haven’t been doing a great job of keeping up on those 1936 2014-06-16 19:22:40 jeffmo (sorry about that) 1937 2014-06-16 19:25:57 jeffmo Tark_: I just pinged the PR — I just need him to do one more thing with it then we can merge. If I don’t hear back in the next day or two I’ll just merge it and make the one change in a follow-up myself 1938 2014-06-16 19:27:12 Tark_ jeffmo: Ah, sounds great. Thanks 1939 2014-06-16 19:39:51 Tark_ Is there a clean/preferred way of adding another reporter to jasmine? Lets say i want to add one for TeamCity 1940 2014-06-16 19:43:26 jeffmo Tark_: do you mean for printing results to the CLI? 1941 2014-06-16 19:45:59 jeffmo Tark_: the way we do it at FB is we have our own custom CLI (we have various FB-specific CLI args that wouldn’t make sense in open source). For the most part writing a custom CLI should be relatively straightforward — it’s just a matter of creating an instance of TestRunner (src/TestRunner.js) with a config file, then calling testRunner.runTestsParalle(arrOfTestPaths, onResultFoundCallback) 1942 2014-06-16 19:46:41 jeffmo the onResultFoundCallback will be called once for each test result as soon as it’s ready — and it’ll be called with a structured object representing test results 1943 2014-06-16 19:47:10 jeffmo so you can print the results, or store them to the database…or both....etc 1944 2014-06-16 19:47:26 jeffmo the defaul result handler (the one that ships with jest) is in src/defaultTestResultHandler 1945 2014-06-16 19:49:37 Tark_ jeffmo: Sounds fair, i don't mind doing that. Just wanted to check that i don't reinvent the wheel by doing my own cli 1946 2014-06-16 19:50:25 jeffmo awesome. Just let me know if you hit any snags, happy to help 1947 2014-06-17 15:51:00 cd377 , 1948 2014-06-18 16:23:20 rmosolgo hello, I'm new to jest and i have a quick question: 1949 2014-06-18 16:23:41 rmosolgo when I use Karma, I can easily put `debugger` in my code, then I can hop in and debug during the test run 1950 2014-06-18 16:23:47 rmosolgo is there anything like that for jest? 1951 2014-06-18 19:28:36 aaronshaf Looking for a way to get jest to ignore the "debug" package (see someone else on this here too: http://stackoverflow.com/questions/24216958/how-do-i-get-jest-to-ignore-the-fairly-common-debug-node-package) 1952 2014-06-18 19:36:09 aaronshaf Any ideas? 1953 2014-06-18 19:40:10 aaronshaf This is a blocker :) Any help is much appreciated 1954 2014-06-18 19:42:23 spicyj aaronshaf: not sure off the top of my head, sorry – file an issue if you can make a small repro case? 1955 2014-06-18 19:42:41 aaronshaf sure, let me try 1956 2014-06-18 19:43:16 spicyj thanks 1957 2014-06-18 19:45:18 aaronshaf spicyj: I just reproduced using the example here: http://stackoverflow.com/q/24216958 1958 2014-06-18 19:45:26 aaronshaf (small) 1959 2014-06-18 19:47:40 spicyj okay 1960 2014-06-18 19:47:50 spicyj that's using the debug package from npm? 1961 2014-06-18 19:47:58 aaronshaf yes 1962 2014-06-18 19:48:21 spicyj mind filing an issue? 1963 2014-06-18 19:48:38 aaronshaf sure 1964 2014-06-18 19:48:50 spicyj thanks 1965 2014-06-18 19:52:31 aaronshaf I wonder if there is something special about the "debug" name? 1966 2014-06-18 19:53:54 spicyj I'm not sure 1967 2014-06-18 19:54:08 aaronshaf I wonder if there is something special about the "debug" name? 1968 2014-06-18 19:54:14 aaronshaf Ouch, sorry about that 1969 2014-06-18 19:54:21 aaronshaf up-arrow-enter on wrong app 1970 2014-06-23 19:20:15 messfromspace Hello everyone. My English sucks, but I'll try my best to explain my problem. Basically, current realization of .dontMock is real pain in the butt. If I require, for example, 3 modules to my test file and disable mocks for one of them by using .dontMock, it disables mocks for all of them. So I have two options here: either use .mock for other modules or use requireActual (my current use case). Is it popular issue or I just do something wrong? 1971 2014-06-23 19:47:24 spicyj there are a few open issues that sound along those lines 1972 2014-06-24 20:11:59 hojberg i seem to constantly run into issues with a module that jest can't figure out how to mock 1973 2014-06-24 20:12:17 hojberg this mean i should just create manual mock usually? 1974 2014-06-24 21:12:07 zpao hojberg: yea, i would 1975 2014-06-24 21:12:20 zpao ACTION is not an expert thouogh 1976 2014-06-25 08:28:43 NiKo` hello :) 1977 2014-06-25 08:29:08 NiKo` so I'm trying to enable code coverage in jest 1978 2014-06-25 08:29:37 NiKo` I tried passing --coverage and/or enabled collectCoverage in json config, but nothing seems to work 1979 2014-06-25 08:29:42 NiKo` hints? 1980 2014-06-27 17:33:51 jlumpe hello 1981 2014-06-27 17:34:51 jlumpe is it possible for jest to return always the same mocked instance? for example if i mock ‘modulea’ in my test and then require a module, which in turn requires ‘modulea’, i cannot performan an === check, since they’re not the same 1982 2014-06-27 17:35:22 jlumpe background: in a component i want to test if a child is of a certain type and if not, ignore it 1983 2014-06-27 17:45:26 spicyj hmm I would have guessed that that would be the default 1984 2014-06-27 17:47:33 jlumpe well i tried to do “component.type === child.type” and it returned false 1985 2014-06-27 17:47:50 jlumpe inside the module i’m testing that is 1986 2014-06-27 17:48:22 jlumpe inside the test file an component.type === compinstance.type is true 1987 2014-06-27 17:48:37 jlumpe maybe i’m doing something wrong? 1988 2014-06-27 17:48:55 jlumpe before the component is passed to the module as a child the check returns true, inside the compoennt the check returns false 1989 2014-06-27 17:49:27 jlumpe leading me to believe that the require’d module inside the component isn’t the same as the one require’d in the test file 1990 2014-06-27 20:29:22 jlumpe jeffmo: around? 1991 2014-06-27 20:29:30 jeffmo jlumpe: hey 1992 2014-06-27 20:29:43 jlumpe ah hey 1993 2014-06-27 20:29:48 jlumpe quick question: 1994 2014-06-27 20:30:34 jlumpe i have a component, which is supposed to check its childen component’s type and throw an error (or just console.log) when a non-matching type has been passed in 1995 2014-06-27 20:31:00 jlumpe so i’m telling jest that it shouldn’t mock my component and the component i want to pass in as a child 1996 2014-06-27 20:31:22 jlumpe but when i then instantiate my component and pass in the child, inside the component the type-checking fails 1997 2014-06-27 20:31:35 jlumpe eg Constructor.type is not === to child.type 1998 2014-06-27 20:31:48 jlumpe so the test fails 1999 2014-06-27 20:31:56 jlumpe but when i run the same code in production, it works 2000 2014-06-27 20:32:19 jlumpe so i’m wondering if there is an issue with jest or somthing i’m missing? (like jest not returning the same object for both requires?) 2001 2014-06-27 20:32:40 jeffmo jlumpe: did you configure jest so that it doesn’t mock react internals? 2002 2014-06-27 20:32:41 jlumpe i’m telling jest to not mock ‘../moduleA’ 2003 2014-06-27 20:33:07 jlumpe yeah i have jest.dontMock(‘react’); 2004 2014-06-27 20:34:07 jlumpe is there a problem that i tell jest to not mock ‘../module’ but inside my component i require it with ‘./module’? 2005 2014-06-27 20:34:14 jeffmo This may or may not matter, but try putting the whole react dir into the ‘unmockedModulePathPatterns’ config entry for jest like it shows here: http://facebook.github.io/jest/docs/tutorial-react.html#content 2006 2014-06-27 20:34:24 jeffmo The react module itself requires other stuff I think 2007 2014-06-27 20:34:41 jeffmo and I think, by virtue of the way react is built, you just have to unmock react entirely 2008 2014-06-27 20:35:31 jlumpe well testing other react stuff works fine 2009 2014-06-27 20:35:38 jlumpe let me try this real quick 2010 2014-06-27 20:35:42 jlumpe just to be sure 2011 2014-06-27 20:35:50 jlumpe if my component requires moduleA 2012 2014-06-27 20:35:56 jlumpe and i told jest to not mock moduleA 2013 2014-06-27 20:36:13 jeffmo ok, that may not be the issue then — when you dig in and look at Constructor.type and child.type, what are each of their actual respective values? 2014 2014-06-27 20:36:16 jlumpe it shouldn’t mock that out at all, right? even if it isn’t erquired in the test file, but in my component 2015 2014-06-27 20:36:40 jeffmo right, jest.dontMock(‘../ModuleA’) means ModuleA isn’t mocked anywhere for the duration of the test 2016 2014-06-27 20:37:14 jlumpe ok, but does it also count for ‘./ModuleA’ ? 2017 2014-06-27 20:37:32 smussell123 hi 2018 2014-06-27 20:37:44 jlumpe does jest understand that depending on the path ../ModuleA and ./ModuleA refer to the same module? 2019 2014-06-27 20:38:14 jeffmo jlumpe: yes, if you mean ../ModuleA called from a child directory, and ./ModuleA called from the same directory 2020 2014-06-27 20:38:19 jlumpe yeah 2021 2014-06-27 20:38:24 jeffmo (jest normalizes the path before putting it into the list of dontMocks) 2022 2014-06-27 20:38:29 jeffmo smussell123: hi 2023 2014-06-27 20:38:29 jlumpe ok cool 2024 2014-06-27 20:38:46 jlumpe let me try to long the values for constructor.type and child.type 2025 2014-06-27 20:38:47 smussell123 I tried to use —coverage and I don't see that output, I think I'm missing something 2026 2014-06-27 20:39:48 jeffmo smussell123: heh, looking at the open source CLI, it looks like it’s collecting coverage but it’s just not printing it 2027 2014-06-27 20:39:57 smussell123 ah, ok 2028 2014-06-27 20:40:26 jeffmo smussell123: hang on, let me point you to where you could see the results and maybe you can hack it together easily — one sec… 2029 2014-06-27 20:40:45 jlumpe jeffmo: they both log an empty function (Constructor.type.toString() and child.type.toString()) 2030 2014-06-27 20:40:54 jeffmo smussell123: https://github.com/facebook/jest/blob/master/src/defaultTestResultHandler.js#L100 :p 2031 2014-06-27 20:41:33 smussell123 jeffmo: thanks 2032 2014-06-27 20:41:36 jeffmo jlumpe: hmmm, let me ask someone around here what it’s supposed to be (I’m no expert on what it’s *supposed* to be) 2033 2014-06-27 20:41:46 jlumpe :) ok cool thank you very much 2034 2014-06-27 20:42:00 smussell123 jeffmo: also I was at the jest talk yesterday, I enjoyed it a lot, thanks 2035 2014-06-27 20:42:17 jeffmo smussell123: great to hear, thanks for coming! 2036 2014-06-27 20:43:59 jlumpe jeffmo: btw if i remove the dontMock call for my module, then type isn’t an empty function anymore but actually the mock function 2037 2014-06-27 20:44:08 jeffmo jlumpe: I just confirmed that both Component.type and child.type are indeed supposed to be empty functions 2038 2014-06-27 20:44:15 jlumpe ok cool 2039 2014-06-27 20:44:32 jlumpe then i just don’t get it why they’re not the same object in my tests, but when actually using the code 2040 2014-06-27 20:44:40 jeffmo but they are also supposed to be the *same* empty function (if the child is of Component type) 2041 2014-06-27 20:45:00 jeffmo doing something like console.log(Component.type === child.type) gives you false? 2042 2014-06-27 20:45:49 jlumpe jeffmo: that’s the weird part. 2043 2014-06-27 20:45:56 jlumpe doing this inside the test file returns true: 2044 2014-06-27 20:45:58 jlumpe var Column = require('../Column'); 2045 2014-06-27 20:45:59 jlumpe var c = Column(); 2046 2014-06-27 20:46:00 jlumpe console.log(Column.type == c.type); 2047 2014-06-27 20:46:35 jlumpe but when i pass my column to the component i’m actually testing and then inside that component require the column module to test for the type it returns false 2048 2014-06-27 20:47:14 jeffmo jlumpe: can you send me a gist of your test file? 2049 2014-06-27 20:47:43 jlumpe yeah sec 2050 2014-07-02 16:47:41 jlumpe hey guys 2051 2014-07-02 16:47:48 jlumpe how can i instruct jest to only execute a single test file? 2052 2014-07-02 16:48:43 jlumpe it.only doesn’t work, since it still executes all files 2053 2014-07-02 16:48:59 jlumpe so i assume that is only contained within a single test group 2054 2014-07-02 16:49:54 jlumpe nevermind 2055 2014-07-02 16:50:12 jlumpe passing the path to the cli works fine 2056 2014-07-03 11:07:41 jlumpe is there a way to mock a fluent interface and keep the abiltiy to use mock functions? 2057 2014-07-03 11:07:44 jlumpe for example 2058 2014-07-03 11:07:52 jlumpe $.ajax().then() 2059 2014-07-03 11:08:33 jlumpe if i wanted to asser that the correct data is passed to ajax() but also a function is being passed to then(), what would be the normal approach? 2060 2014-07-03 11:08:56 jlumpe *assert 2061 2014-07-03 11:09:27 jlumpe nevermind 2062 2014-07-03 11:09:40 jlumpe mockImplementation seems to be the way to go 2063 2014-07-03 22:56:28 tengbretson Hi there, Im trying out jest for the first time. The command line tool seems to work, it outputs: "Found 2 matching tests...", but then it exits with no other output 2064 2014-07-04 09:11:47 simenbrekken tengbretson: can you please make a gist with your test? 2065 2014-07-04 11:23:53 jlumpe instead of writing a custom mock, is it valid to add some mock functions to the automatic mock inside the tests? 2066 2014-07-04 11:24:52 jlumpe e.g. $ = require(‘jquery’); $.ajax = jest.genMockFunction().mockReturnThis(); $.ajax.then = jest.getMockFunction().mockReturnThis(); 2067 2014-07-04 11:25:50 jlumpe so basically the whole public api is auto-mocked and then just some additions can be made from test to test? 2068 2014-07-04 18:47:14 tengbretson Are there any issues with the current version of jest? I was having problems in my project, so I created a new clean project and copy-pasted the 'getting started' code from the jest website and ran the commands listed. Jest finds 1 matching test but still wont show any output. 2069 2014-07-07 16:07:04 tengbretson I'm using an ubuntu server VM as my dev machine that im sshed into, the problem I'm having is that since I don't have X installed, I can't see any of the output of jest's tests because of the colored highlighting. Is there a no-color mode for jest? 2070 2014-07-07 16:25:04 spicyj does your terminal not support color at all? you shouldn't need X for colors to work over SSH 2071 2014-07-07 16:30:15 tengbretson my terminal supports colors, and it works over ssh too, its lines with background coloring that are getting left out 2072 2014-07-07 16:32:41 tengbretson im using iterm2 on osx. When I use jest locally everything displays just fine. When I'm sshed into my dev machine it doesnt display. 2073 2014-07-07 16:40:59 tengbretson Also, when i use the CLI directly in virtual box the highlighting doesnt work 2074 2014-07-07 18:02:08 jlumpe can anybody explain why jest runs out of memory when i’m trying to log a domnode? 2075 2014-07-07 18:02:39 rmosolgo maybe theres a circular reference in there? that happens to me sometimes :S 2076 2014-07-07 18:03:47 jlumpe i’m just trying to log a node created with React.DOM.li 2077 2014-07-07 18:03:53 jlumpe weird 2078 2014-07-09 22:51:31 Chillax thoughts on adding a data provider helper, perhaps something like https://github.com/jphpsf/jasmine-data-provider ? 2079 2014-07-10 00:09:56 chenglou anything preventing jest from using jasmine 2.0? 2080 2014-07-10 06:52:39 jlumpe are tehre any plans to update jest to jasmine 2.0 so we can take advantage of the new done() functionality for testing async stuff? 2081 2014-07-10 06:52:43 jlumpe *there 2082 2014-07-10 20:54:55 tengbretson Hello, I'm having problems with the .toBeCalled() function in jest. Im calling it like so: expect().toBeCalled(), and im getting: TypeError: Object [object Object] has no method 'toBeCalled' 2083 2014-07-10 21:01:10 chenglou tengbretson: is that function a mock? 2084 2014-07-10 21:01:14 chenglou jest mock 2085 2014-07-15 10:28:03 KarlPurk Hi guys. Jest isn't outputting my console.log messages - I've had a good search but can't really find any information on this. Can anyone offer any guidance on this? 2086 2014-07-15 10:37:53 jlumpe what do you mean it doesn’t output console.log? 2087 2014-07-15 10:38:32 jlumpe can you create a basic test file, with a single describe and a single it(…) and inside that console.log(‘test’) ? 2088 2014-07-15 10:38:44 jlumpe that should be output without issues 2089 2014-07-15 10:38:54 KarlPurk I can run jest against an empty file with nothing but a single console.log statement and nothing is output. I run the same file with node and the console.log statement is output to stdout. 2090 2014-07-15 10:40:34 jlumpe KarlPurk: it gets logged normally for me 2091 2014-07-15 10:40:44 jlumpe single file, with console.log(‘TEST’); 2092 2014-07-15 10:40:50 jlumpe then: jest filename 2093 2014-07-15 10:40:55 jlumpe and it logs ‘TEST’ 2094 2014-07-15 10:42:35 KarlPurk what version of jest are you using? I'm running v0.1.17 2095 2014-07-15 10:43:50 KarlPurk I did find another reference to this issue here too: https://groups.google.com/forum/#!topic/jestjs/M3kquWvufkU This doesn't help me resolve my issue, but it's good for my sanity! 2096 2014-07-15 10:43:51 jlumpe 0.0.15 2097 2014-07-15 10:44:03 jlumpe should update my jest 2098 2014-07-15 10:44:23 jlumpe KarlPurk: is there a reason why you want to console log there, instead of inside a describe/it call ? 2099 2014-07-15 10:44:32 jlumpe do logs there get output normally? 2100 2014-07-15 10:44:41 KarlPurk nope, I dont get any logging at all 2101 2014-07-15 10:44:53 KarlPurk jest swallows all output - including errors 2102 2014-07-15 10:46:43 jlumpe let me update 2103 2014-07-15 10:47:32 KarlPurk ok - thanks for helping out 2104 2014-07-15 10:48:48 jlumpe heh, after updating jest also throws an error for on a test O_o 2105 2014-07-15 10:48:55 jlumpe actually not on the test 2106 2014-07-15 10:49:01 jlumpe but after the tests have finished 2107 2014-07-15 10:49:31 jlumpe KarlPurk: when you execute jest -v 2108 2014-07-15 10:49:45 jlumpe does jest only return the version or also some weird error? 2109 2014-07-15 10:50:08 KarlPurk I just get the version - no errors 2110 2014-07-15 10:50:13 jlumpe wtf 2111 2014-07-15 10:50:23 jlumpe let me remove jest and reinstall 2112 2014-07-15 10:52:35 jlumpe somethign is broken here 2113 2014-07-15 10:55:20 jlumpe one sec 2114 2014-07-15 10:56:44 jlumpe ok jest works normally again 2115 2014-07-15 10:58:27 jlumpe KarlPurk: bad news 2116 2014-07-15 10:58:38 jlumpe even with jest 0.0.17 i see my console.log 2117 2014-07-15 11:01:34 jlumpe KarlPurk: maybe try npm uninstall jest-cli and reinstall again? 2118 2014-07-15 11:01:46 jlumpe do you maybe have a global version installed too, which might be conflicting? 2119 2014-07-17 09:24:55 kossnocorp_ Hey, is there is way to create custom matchers and enable them globally? 2120 2014-07-17 11:35:02 calumet Is there any way to get Jest to use webpack as its preprocessor instead of return ReactTools.transform(src);? I'm using the jsx-loader to auto-include @jsx React.DOM , but Jest doesn't see this. 2121 2014-07-17 20:36:47 hojberg is it possible to set autoMockOff for all tests in like a global config? 2122 2014-07-17 23:29:47 jeffmo hojberg: heya (sorry just seeing your message) — yes, you can put your entire project in the unMockedModulePathPatterns config entry 2123 2014-07-17 23:30:20 jeffmo that should effectively be the same thing as calling autoMockOff() in all tests 2124 2014-07-17 23:30:39 jeffmo hojberg: http://facebook.github.io/jest/docs/api.html#config-unmockedmodulepathpatterns-array-string 2125 2014-07-18 00:01:14 hojberg jeffmo: I see - I can still manually mock modules in that glob right? 2126 2014-07-18 19:52:25 jeffchan Running the most basic test file with jest takes at least 6 seconds. Is that the expected bootup time, or am I doing something wrong? 2127 2014-07-18 20:00:45 vjeux jeffchan: this is definitively not expected 2128 2014-07-18 20:01:00 vjeux it's not super snappy but shouldn't take more than a second 2129 2014-07-18 20:01:13 vjeux and this time is amortized when running many tests 2130 2014-07-18 20:03:25 jeffchan vjeux: Hm I see. I’m using the coffeescript example and it’s ~7 seconds. I thought it might’ve had to do with the preprocessor but I dont think that’s the case 2131 2014-07-18 20:07:36 jeffchan vjeux: ah, I narrowed it down. seems like I have a bad require 2132 2014-07-18 20:14:48 vjeux jeffchan: oh, maybe it's recompiling the entire require which is doing so many things all the time 2133 2014-07-18 20:15:31 vjeux with npm it's pretty easy to require the entire world (good and bad) 2134 2014-07-18 20:15:49 vjeux whereas at facebook we've got a more constrained environment so we don't tend to run into those issues as frequently 2135 2014-07-18 20:15:55 vjeux we definitively need to find a solution though 2136 2014-07-18 20:18:52 jeffchan vjeux: ah yes, that makes sense. thanks 2137 2014-07-21 19:50:17 syranide oh right, the error message for when it encounters unexpected DOM nodes is not finished, but otherwise it shouldn't be anything "bad" 2138 2014-07-21 20:57:31 spicyj mm? 2139 2014-07-24 12:23:47 sspi What would be required to get requirejs support? 2140 2014-07-24 12:26:57 jlumpe sspi: are you running jest in the browser? 2141 2014-07-24 12:28:33 sspi I want to introduce reactjs into my team in a step by step way, so Im also looking into testing... 2142 2014-07-24 12:28:50 sspi Currently requirejs and jasmine are used 2143 2014-07-24 12:29:26 jlumpe ah 2144 2014-07-24 12:29:26 sspi Introducing jest seems doable, commonjs seems a bridge too far for now 2145 2014-07-24 12:29:49 sspi ( I do hate requirejs though... ) 2146 2014-07-24 12:30:08 jlumpe i'm asking because i'll soon write some code which i have to test in-browser bcause it's an indexeddb-wrapper 2147 2014-07-24 12:30:14 jlumpe and i'm not sure that jest even runs in the browser 2148 2014-07-24 12:31:20 jlumpe but maybe it could be browserify'd 2149 2014-07-24 12:31:42 sspi Would expect so 2150 2014-07-24 12:32:10 sspi But Im no jest expert :-) 2151 2014-07-24 12:32:30 sspi Jest n00b actually ;-) 2152 2014-07-24 12:34:15 jlumpe haha 2153 2014-07-24 12:34:27 jlumpe i'll just have to try 2154 2014-07-24 12:37:11 sspi Me too, will try to hack something 2155 2014-07-24 16:41:03 mbrgm hi everyone! is there a gulp wrapper for jest already? 2156 2014-07-24 19:06:43 hojberg mbrgm: why would you need one? 2157 2014-07-24 20:42:34 mbrgm hojberg: I want to watch/run my tests from gulp 2158 2014-07-24 20:42:49 hojberg ah watch makes sense 2159 2014-07-24 21:02:58 mbrgm hojberg: do you have an idea if I could use the node module directly? or would there have to be some wrapper around it? 2160 2014-07-24 21:03:14 hojberg mbrgm: i use it directly 2161 2014-07-24 21:03:23 hojberg just run `jest` on the command line 2162 2014-07-24 21:03:32 hojberg or update `npm test` to do the same 2163 2014-07-24 21:20:46 mbrgm hojberg: I already set the npm test script to run jest. What I meant was whether I could require the node module from gulp and then use it there? 2164 2014-07-24 21:35:39 hojberg oh 2165 2014-07-24 21:35:48 hojberg i havent tried that sorry 2166 2014-07-24 21:40:47 mbrgm sry was afk 2167 2014-07-24 22:45:08 mbrgm how can I debug a failing test? 2168 2014-07-24 22:45:47 mbrgm jest-cli seems to ignore my `debugger;` breakpoint, even when running with `node --debug /path/to/jest.js -i` 2169 2014-07-25 17:40:59 mbrgm hi! is there a way to get a reference to the automatically created mocks in jest? or do I have to create a mock function and dependency-inject it into my class under test? 2170 2014-07-26 17:03:51 mbrgm hi! how can I avoid that a module, which is required in the module under test, gets mocked? 2171 2014-07-30 18:33:53 billy is it possible to have jest recognize browserify aliases? 2172 2014-07-31 12:05:31 simenbrekken Can I access the jest runtime in some way in setupEnvScriptFile? I'm trying to add top level functions to jest such as jest.genMockPromise 2173 2014-08-05 23:11:44 pletcher hi all, I'm working on tests for an app that makes use of the Flux architecture, and I'm finding that I frequently need to provide a mockImplementation for getter functions in the store. Is this the right way to proceed, or should I take this as an indication that we should move that functionality to the component(s)? 2174 2014-08-05 23:12:02 pletcher *in a store, that is 2175 2014-10-16 08:31:02 hareth hello! 2176 2014-10-16 18:47:55 seanadkinson hey there jestjs... any solutions for dealing with require() statements that are formatted specifically for webpack? 2177 2014-10-16 18:48:03 seanadkinson require("imports?jQuery=jquery!../vendor/jquery-timepicker-1.4.6/jquery.timepicker"); 2178 2014-10-16 18:48:16 seanadkinson jest complaining that it cant find that module (of course) 2179 2014-10-16 18:49:18 seanadkinson spicyj: ? 2180 2014-10-16 22:18:03 seanadkinson anyone know how to debug a jest run? 2181 2014-10-16 22:18:11 seanadkinson hoping to set a breakpoint and examine stuff 2182 2014-10-16 22:18:39 seanadkinson Found this, but same deal, not quite working: http://stackoverflow.com/questions/25142173/debugging-jest-test-cases-using-node-inspector 2183 2014-10-16 22:18:51 seanadkinson spicyj or vjeux ? 2184 2014-10-16 22:19:01 spicyj I don't know, sorry 2185 2014-10-16 22:19:23 seanadkinson np, thanks 2186 2014-10-16 22:26:43 seanadkinson looks like the issue is with harmonize.js:30... var node = child_process.spawn(process.argv[0], ['--harmony'].concat(process.argv.slice(1)), {}); 2187 2014-10-16 22:26:53 seanadkinson spawns a child process, skipping debug params 2188 2014-10-16 22:30:07 ShaunO``wrk freaking hate that piece of code it completely breaks jest on windows platforms 2189 2014-10-16 22:45:47 seanadkinson looks like if i comment out lines 30-35 i can get the debugger attached 2190 2014-10-16 22:45:51 seanadkinson node --debug-brk --harmony ./node_modules/jest-cli/bin/jest.js --runInBand 2191 2014-10-16 23:16:11 seanadkinson got debug working with a hack: http://stackoverflow.com/questions/25142173/debugging-jest-test-cases-using-node-inspector/26415442#26415442 2192 2014-10-16 23:16:14 seanadkinson ShaunO``wrk: ^^ 2193 2014-10-16 23:16:22 seanadkinson spicyj: ^^ 2194 2014-10-16 23:19:07 spicyj nice 2195 2014-10-16 23:20:52 seanadkinson spicyj: are you a maintainer of jest? 2196 2014-10-16 23:21:43 seanadkinson seems like you could just check process.execArgv [http://nodejs.org/api/process.html#process_process_execargv] to see if --harmony is already present 2197 2014-10-16 23:22:06 seanadkinson if its already there, don't call harmonize(), and this would let the debug tools actually work 2198 2014-10-16 23:22:51 spicyj it's mostly jeffmo :) he made me an op here so I'd feel more obligated to answer questions 2199 2014-10-16 23:22:51 spicyj haha 2200 2014-10-16 23:23:13 spicyj jest spawns multiple processes so that it can run tests in parallel too though 2201 2014-10-16 23:23:15 spicyj not just for --harmony 2202 2014-10-16 23:23:24 spicyj so I feel like you should still expect to need --runInBand 2203 2014-10-16 23:28:08 seanadkinson for debugging, right 2204 2014-10-16 23:28:39 ShaunO``wrk the harmonize method of respawning the jest process as a child process is platform dependent in terms of how it works 2205 2014-10-16 23:28:47 seanadkinson but just for not spinning off a child process, could just check for the harmony flag 2206 2014-10-16 23:29:11 ShaunO``wrk what os are you on seanadkinson? 2207 2014-10-16 23:29:11 seanadkinson if (process.execArgv.indexOf('--harmony') !== -1) { harmonize(); } 2208 2014-10-16 23:29:17 seanadkinson mac os x 2209 2014-10-16 23:29:20 ShaunO``wrk ahh ok 2210 2014-10-16 23:29:30 ShaunO``wrk nvm me 2211 2014-10-16 23:29:40 seanadkinson is windows not working? 2212 2014-10-16 23:29:45 ShaunO``wrk not out of the box 2213 2014-10-16 23:30:06 ShaunO``wrk all of the issues are 3rd party dep issues, there were a lot more earlier in the year that have all been cleaned up 2214 2014-10-16 23:30:41 ShaunO``wrk but the harmonize child process spawning causes issues on windows, i just comment it out, its the one at the very bottom of the main jest entry point js file 2215 2014-10-16 23:40:45 seanadkinson create PR here: https://github.com/facebook/jest/pull/153 2216 2014-10-17 09:39:15 hareth hello! 2217 2014-10-18 07:45:39 hareth hello! 2218 2014-10-19 09:09:49 hareth hello 2219 2014-10-20 12:32:49 insin does jest normalize paths that will be tested against config.unmockedModulePathPatterns? I cant seem to get it to exclude my utils dir by default 2220 2014-10-20 15:51:03 ferrannp Hi all! I have a quick question. How can I simulate a click into a form (submit button)? React TestUtils simulate click into doesn't seem to work... because then, I want to check if the function from onSubmit={this.save} is called and it is not. 2221 2014-10-20 18:02:39 spicyj ferrannp: not sure, but you should be able to Simulate.submit on the form itself 2222 2014-10-20 18:14:52 ferrannp spicyj I write it more extended in here http://stackoverflow.com/questions/26470679/test-a-form-with-jest-and-react-js-testutils 2223 2014-10-20 18:15:15 ferrannp its weird cause after simulating, I can check that the state changes to the appropiate one 2224 2014-10-20 18:15:24 ferrannp but checking if function has been called is failing 2225 2014-10-20 18:28:42 ferrannp so TestUtils.Simulate.submit(myButton) is valid? 2226 2014-10-20 18:28:43 ferrannp wow 2227 2014-10-20 19:00:05 spicyj well really, you want to be calling Simulate.submit(form) 2228 2014-10-20 19:00:16 spicyj the submit event doesn't normally get triggered on the button itself 2229 2014-10-20 19:03:20 ferrannp yea that works 2230 2014-10-20 19:03:36 ferrannp the thing is that the form has onSubmit={this.save} 2231 2014-10-20 19:03:45 ferrannp and im trying to check if this.save has been called 2232 2014-10-20 19:04:53 ferrannp also on those radio buttons.. they have onChange={this.change) and im also trying to check that this.change has been triggered with no luck :S 2233 2014-10-21 15:23:56 ferrannp I hope somebody can still help me with this http://stackoverflow.com/questions/26470679/test-a-form-with-jest-and-react-js-testutils about Jest ? :) 2234 2014-10-21 20:43:18 astitva Hi can anyone help with this problem http://stackoverflow.com/questions/26470679/test-a-form-with-jest-and-react-js-testutils will be much appreciated. 2235 2014-10-21 20:46:08 astitva Been looking into it and realised that onClick or onChange functions used with the jsx or inisde the render function cannot be monkey patched 2236 2014-10-21 20:47:03 astitva i.e if I have
inside the render function. 2237 2014-10-21 20:48:10 astitva And monkey patch the rendered component instance to renderedComponentInstance.submit = jest.genMockFunction() 2238 2014-10-21 20:49:08 astitva Triggering submit will still trigger with original function 2239 2014-10-21 20:51:45 astitva However function not used inside the render can be monkey patched and does get called 2240 2014-10-21 20:52:33 astitva with the mocked instance 2241 2014-10-21 22:00:05 ferrannp +1 for astitva 2242 2014-10-21 22:00:15 ferrannp its actually my question in stackoverflow :P 2243 2014-10-21 23:47:07 kcccccc Is there a way to use Supertest and Jest in combination? https://github.com/tj/supertest 2244 2014-10-22 00:00:09 kcccccc Is there a way to use Supertest and Jest in combination? https://github.com/tj/supertest 2245 2014-10-22 09:48:44 hareth If someone have updates epic-linter (and seems there is 189 people who did it :p) and you find a bug please don’t forget to report https://github.com/fdecampredon/brackets-epic-linter/issues 2246 2014-10-22 09:49:11 hareth 0.3 was a big refactoring and while I have tested it myself for 1 week I can’t be sure there is not any bugs 2247 2014-10-22 09:50:53 hareth worry wrong channel -.- 2248 2014-10-22 11:13:00 astitva Hi anyone available here fo help 2249 2014-10-23 17:24:10 hareth stupid question I guess 2250 2014-10-23 17:24:21 hareth but what is the equivalent of ‘spyOn’ 2251 2014-10-23 17:24:22 hareth ? 2252 2014-10-23 17:28:19 jeffmo hareth: spyOn still works in jest (as long as you use it with Jasmine matchers) 2253 2014-10-23 17:28:21 jeffmo hareth: brb 2254 2014-10-23 17:41:04 zip afternoon facebookers 2255 2014-10-23 17:41:40 zip I'm just wondering if it's possible to require() jest into my REPL? I'm trying to hunt down a particularly deep bug. 2256 2014-10-23 17:42:08 zip I have suspicions that it's to do with the way jest mocks something, but I can't isolate it 2257 2014-10-23 17:48:29 zip Hm, looks like underscore-plus was getting mocked deep down. But oddly, we appeared to be getting `undefined` out of the require call. 2258 2014-10-23 17:48:46 zip Telling jest to not mock it fixed our bug, but I suspect there's something more subtle going on. 2259 2014-10-23 18:13:46 jestnoob is it possible to use Jest without CommonJS? Do I then lose all of the automock features? I'm trying to use it for testing a React app in conjunction with react-rails 2260 2014-10-23 18:32:39 jeffmo jestnoob: currently it’s not possible to use Jest without CommonJS, sorry :( It’s something we don’t mind supporting, it just hasn’t been built 2261 2014-10-23 18:33:28 jeffmo zip: I’ve seen one person hack Jest to do this, but nothing that’s shippable (the hack wasn’t published or anything, just a little weekend project) 2262 2014-10-23 18:48:34 jestnoob thanks for the info 2263 2014-10-23 20:57:45 zip Right, bigger job than I really want to take on right now then 2264 2014-10-23 20:57:53 zip We solved the bug, but thanks for the help :) 2265 2014-10-25 11:15:19 hareth hello! 2266 2014-10-26 09:01:44 hareth hello 2267 2014-10-27 12:27:00 hareth hello 2268 2014-10-28 07:50:02 hareth hello 2269 2014-10-29 09:49:50 tarkus When jest tails it doesn't show neither error message nor a stack trace.. huh? 2270 2014-10-29 10:51:22 hareth hello 2271 2014-10-29 13:55:50 jeffmo_ tarkus: tarkus can you send a paste of the output? 2272 2014-10-29 13:55:56 jeffmo_ hareth: hello 2273 2014-10-29 14:16:36 tarkus FAIL components\\__tests__\\Navbar-test.js (3.231s) 2274 2014-10-29 14:16:36 tarkus npm ERR! Test failed. See above for more details. 2275 2014-10-29 14:16:49 tarkus jeffmo_, so it's tricky to figure out what's the cause of the error 2276 2014-10-29 14:17:22 tarkus maybe there is some flag which allows to run jest in a more verbose mode? 2277 2014-10-29 14:17:33 jeffmo tarkus: hmm, that’s odd — what happens if you run jest with -i ? (-i makes it run all tests in the current process rather than forking off a worker thread) 2278 2014-10-29 14:18:27 tarkus jeffmo, same thing as without -i 2279 2014-10-29 14:18:39 tarkus just [FAIL] and the name of the file 2280 2014-10-29 14:19:32 jeffmo tarkus: unusual, I haven’t seen this before. Maybe you can try narrowing things down by bisecting the test file with comments until you can isolate a test that seems to be causing this? 2281 2014-10-29 14:21:07 tarkus jeffmo, i tried inserting expect(true).toByFalsy(); into a working test, which makes it fail but no error messages or stack trace.. no idea why the test is failed 2282 2014-10-29 14:21:29 tarkus jeffmo, maybe that's because i'm on windows ;) 2283 2014-10-29 14:21:48 jeffmo hmm, well based on the backslashes I’m guessing you’re on windows — which I’m not well suited to test unfortunately, heh 2284 2014-10-29 14:22:23 jeffmo but I’d love to find the issue if you have some time to debug the code? 2285 2014-10-29 14:24:59 jeffmo (I have to run for a bit, but I’ll be back in about 20mins) 2286 2014-10-29 14:30:05 tarkus jeffmo, yep, I can debug it 2287 2014-10-29 14:41:49 hareth jeffmo ! perhaps you should close my pr on jstransform :P 2288 2014-10-29 15:43:52 jeffmo hareth: is yours the sourcemap PR? 2289 2014-10-29 15:44:09 hareth no spread operator 2290 2014-10-29 15:44:52 jeffmo hareth: oh wow, I’m so sorry — I thought dmitry was going to look at that (he’s been building out most of the es6 transforms these days) 2291 2014-10-29 15:44:54 jeffmo let me ping him 2292 2014-10-29 15:45:17 hareth no prob it’s just that since it’s from month ago I doubt it’s still valable 2293 2014-10-29 15:45:24 hareth and so you hsould probably close it :p 2294 2014-10-29 15:49:54 jeffmo hareth: we haven’t built an alternative to spread since then if that’s what you mean? If you’re still up for taking comments, I’ll let Dmitry know — otherwise, if not, I understand and we can close it out for now 2295 2014-10-29 15:50:51 hareth I just thought it was something you had done internally 2296 2014-10-29 15:51:09 hareth but If you prefer I can try to update it and takes comments 2297 2014-10-29 15:51:17 jeffmo hareth: nope. We’ve done object-spread, but that one’s relatively easy. I’ll ping dmitry 2298 2014-10-29 15:51:23 hareth k 2299 2014-10-29 15:52:02 hareth I’ll try to update with the last from master this week end so 2300 2014-10-29 15:52:09 hareth thank you :) 2301 2014-10-29 15:52:32 jeffmo hareth: awesome. And fyi: We had a big hackathon thing last night, so it’s possible Dmitry might be sleeping in today :p 2302 2014-10-29 15:53:19 hareth yeah anyway I need to update 2303 2014-10-29 15:53:26 jeffmo sounds good 2304 2014-10-29 15:54:01 hareth before so It’s not like it’s urgent 2305 2014-10-31 02:10:52 lsmag Hi... I have a __tests__/foo-test.js and I'm trying to figure out how to make jest work (surely I'm doing something wrong), 2306 2014-10-31 02:11:13 lsmag whenever I run jest it finds the test, but doesn't seem to be running it 2307 2014-10-31 02:11:35 lsmag in my foo-test.js I have only this, nothing else: 2308 2014-10-31 02:11:50 lsmag http://pastebin.com/zHG7ZUPP 2309 2014-10-31 02:12:04 lsmag does anyone else know what I'm doing wrong? 2310 2014-10-31 02:15:48 lsmag ** -"else" 2311 2014-10-31 10:59:02 hareth hello! 2312 2014-11-03 11:03:33 hareth hello! 2313 2014-11-04 10:57:16 hareth hello! 2314 2014-11-04 18:18:33 richardiii Is there anywhere I can find release notes? 2315 2014-11-04 18:18:58 richardiii Or how to keep track of new/deprecated features? 2316 2014-11-05 18:30:18 aaronshaf I am looking for a mock of the debug module 2317 2014-11-05 18:30:25 aaronshaf (or a workaround) 2318 2014-11-05 18:32:18 jeffmo aaronshaf: what do you mean by “the debug module”? 2319 2014-11-05 18:32:46 aaronshaf See https://www.npmjs.org/package/debug and http://stackoverflow.com/questions/24216958/how-do-i-get-jest-to-ignore-the-fairly-common-debug-node-package 2320 2014-11-05 18:34:03 jeffmo Ah, but in your case (as opposed to the top answer) you actively want to mock it — not leave it unmocked? 2321 2014-11-05 18:35:58 jeffmo Is that right? If so, maybe you can write a manual mock for it if the automocker isn’t doing what you want? http://facebook.github.io/jest/docs/manual-mocks.html#content 2322 2014-11-05 18:36:23 jeffmo (need to run and grab lunch…I’m starving…but will be back in a bit) 2323 2014-11-05 18:36:26 aaronshaf Thanks, I'll give it a shot 2324 2014-11-05 20:06:19 toddhead Anyone able to help a newb work out how to mock a module? 2325 2014-11-05 20:06:32 toddhead ...or to point me to an example? 2326 2014-11-05 20:10:48 toddhead ok, here goes 2327 2014-11-05 20:11:17 toddhead I'm trying to test a module that exports a function - let's call it "A" 2328 2014-11-05 20:12:18 toddhead ...and I want to verify that A, when invoked, calls "request" (the simplified http request client), with appropriate params 2329 2014-11-05 20:16:57 toddhead here's the code: https://gist.github.com/anonymous/6f1eb71e4b42bf33eb99 2330 2014-11-05 20:17:17 toddhead go ahead y'all - teach a newb! 2331 2014-11-05 20:45:32 toddhead ok, dug deeper 2332 2014-11-05 20:46:08 toddhead I'm requiring 'request', which in turns requires a ton of other stuff. A whole lotta required code blows up from everything being automocked 2333 2014-11-05 20:46:52 toddhead I tried patching some of these sub-modules, but after 4 or 5 of these I figured I might want to just turn off automock-ing 2334 2014-11-05 20:47:22 toddhead ...but now I can't seem to mock a specific module ('request'), but not these submodules it includes 2335 2014-11-06 11:32:28 hareth hello! 2336 2014-11-06 11:51:57 webhenrik hey 2337 2014-11-07 11:10:55 hareth hello