Code Monkey home page Code Monkey logo

Comments (21)

ekaragodin avatar ekaragodin commented on July 16, 2024

You can run the testem in mode continues integration. Add parameter "ci" to "Application Parameters" field.

from testem.

jboesch avatar jboesch commented on July 16, 2024

Alright, I tried that and I get some new errors.

/usr/local/bin/node ../../../../usr/local/bin/testem ci

/usr/local/lib/node_modules/testem/lib/ci_mode_app.js:67
            console.log("# Launching " + launcher.name)
                                                 ^
TypeError: Cannot read property 'name' of undefined
    at App.runAllTheTests (/usr/local/lib/node_modules/testem/lib/ci_mode_app.js:67:50)
    at async.forEachSeries.iterate (/usr/local/lib/node_modules/testem/node_modules/async/lib/async.js:118:13)
    at Object.async.forEachSeries (/usr/local/lib/node_modules/testem/node_modules/async/lib/async.js:134:9)
    at EventEmitter.App.runAllTheTests (/usr/local/lib/node_modules/testem/lib/ci_mode_app.js:66:15)
    at App.onServerStart (/usr/local/lib/node_modules/testem/lib/ci_mode_app.js:60:18)
    at EventEmitter.BaseApp.runHook (/usr/local/lib/node_modules/testem/lib/base_app.js:49:27)
    at EventEmitter.BaseApp.runPreprocessors (/usr/local/lib/node_modules/testem/lib/base_app.js:30:14)
    at EventEmitter.App.onServerStart (/usr/local/lib/node_modules/testem/lib/ci_mode_app.js:59:14)
    at EventEmitter.emit (events.js:85:17)
    at EventEmitter.Server.start (/usr/local/lib/node_modules/testem/lib/server.js:43:18)

Process finished with exit code 1

I should note that I also ran the first line in my project and it worked fine for the ci option (/usr/local/bin/node ../../../../usr/local/bin/testem ci), it just didn't work in my IDE.

from testem.

airportyh avatar airportyh commented on July 16, 2024

This is because Testem's dev mode UI requires a ANSI-capable terminal to render, which JetBrains is not. I am not sure there's anything that can be done about that. As @karagodin just pointed out, you can run testem ci to get around that, but then you don't get the same UI.

@jboesch I think that bug has been fixed. Try re-installing the latest version and see if it persists.

from testem.

jboesch avatar jboesch commented on July 16, 2024

I updated to the latest PhantomJS and latest Test'em, still errors. Are there plans to support this? A lot of people rely on these IDE's for CI

from testem.

jboesch avatar jboesch commented on July 16, 2024

Hmm, it works from the IDE when I change the launcher to "Chrome" or "Safari" or any browser - it outputs it in TAP format which it's supposed to do because I have the "ci" option set. It only errors when it's PhantomJS. So strange. I did some digging...
in lib/config.js

Config.prototype.getLaunchers = function(app, cb){
    var self = this
    this.getAvailableLaunchers(app, function(availableLaunchers){
console.log(availableLaunchers);   
        cb(self.getWantedLaunchers(availableLaunchers))
    })
}

PhantomJS isn't in the availableLaunchers.. Hrmmm.

from testem.

airportyh avatar airportyh commented on July 16, 2024

Doing testem launchers will also list the available browsers. For phantomjs, make sure it's in the path. For JetBrains, you might have to configure the path within their UI I am guessing.

from testem.

jboesch avatar jboesch commented on July 16, 2024

It shows PhantomJS as an available browser when i run testem launchers... but just won't pick it up in the JetBrains IDE.
I perform a "which phantomjs" and it returns the proper path, but for whatever reason, testem isn't finding it when I run it through the IDE.

from testem.

jboesch avatar jboesch commented on July 16, 2024

So I got closer to figuring it out... in lib/browser_launcher.js I added some console.log action

function findableByWhich(cb){
    var exe = this.exe;
    exec('which ' + this.exe, function(err, exePath){
        console.log('which ' + exe + ' | ' + err + ' | ' + exePath);
        cb(!!exePath);
    })
} 

Punching 'testem ci' In terminal outputs the correct info:

which phantomjs | null | /usr/local/bin/phantomjs

When I run it from my IDE, I get

which phantomjs |  { [Error: Command failed: ] killed: false, code: 1, signal: null } |

Any ideas?

from testem.

airportyh avatar airportyh commented on July 16, 2024

Try

console.log(process.env.PATH)

from testem.

airportyh avatar airportyh commented on July 16, 2024

Ahh, interesting. I guess which is not in the path.

from testem.

jboesch avatar jboesch commented on July 16, 2024

Hmm, weird. My IDE is outputting:

/usr/bin:/bin:/usr/sbin:/sbin

which is completely different than when i echo $PATH from terminal. I need to somehow hijack it to include

/usr/local/bin

which is where PhantomJS resides.

from testem.

jboesch avatar jboesch commented on July 16, 2024

Got it working! Added

/usr/local/bin:/usr/bin 

to my environment variables in the NodeJS runner plugin. Lovely! Thank you :)

from testem.

airportyh avatar airportyh commented on July 16, 2024

Oh nice! Would you mind writing this up somewhere? Maybe a gist or a screenshot. Also, let me know how well you like/dislike this setup once you start getting used to it.

from testem.

jboesch avatar jboesch commented on July 16, 2024

I will definitely do a gist with a screenshot. The unfortunate part about all this work we went through, is that it only does a single pass "testem ci" and isn't a "watcher" for changes. The watcher is the only thing that's useful in the IDE for this kind of thing (TDD). Although it's cool that we got the "teamem ci" working from the IDE :)

Unfortunately, running "testem" as a watcher from the IDE throws errors, because, as you mentioned above, it requires an ANSI-capable terminal.

Maybe there will be improvements down the road for a watcher that works with the JetBrains IDE's :)

from testem.

jboesch avatar jboesch commented on July 16, 2024

Here was my config to get this working with "testem ci"

GitHub Logo

Then here is me running the tests with the "testem ci" output

GitHub Logo

from testem.

airportyh avatar airportyh commented on July 16, 2024

Unfortunately, running "testem" as a watcher from the IDE throws errors, because, as you mentioned above, it requires an ANSI-capable terminal.

Yeah, that's what I figured. Meh, if you can manage, just tile a terminal next to your IDE. IDE's have a god complex: they try to bring everything inside of them, and for you to depend on them for your every need - I don't like that :)

I won't rule out a your suggestion: make a more basic version of a watcher process that just outputs to stdout and stderr, but that will never be as good as the full text-based UI.

from testem.

ryanflorence avatar ryanflorence commented on July 16, 2024

I'm trying to launch testem from within a script, dev mode is desired. I'm creating a runner on the fly (so you can run tests against only specific files) and then launching testem.

var testem = execFile(__dirname+'/../../node_modules/testem/testem.js', ['-f', jsPath+'/tests/support/testem.json']);
testem.stdout.on('data', function(data) {
  console.log(data.toString());
});
testem.stderr.on('data', function(data) {
  console.log(data.toString());
});
testem.on('close', function(code) {
  console.log('exited with code', code);
});

and I get

tty.setRawMode: Use `process.stdin.setRawMode()` instead.

Error: can't set raw mode on non-tty
    at Object.<anonymous> (tty.js:37:11)
    at Object.deprecated (util.js:75:15)
    at EventEmitter.exports.Charm (/Users/rpflo/Code/github/ember-tools/node_modules/testem/node_modules/charm/index.js:43:13)
    at module.exports (/Users/rpflo/Code/github/ember-tools/node_modules/testem/node_modules/charm/index.js:29:12)
    at initCharm (/Users/rpflo/Code/github/ember-tools/node_modules/testem/lib/ui/screen.js:33:21)
    at module.exports.View.extend.initialize (/Users/rpflo/Code/github/ember-tools/node_modules/testem/lib/ui/appview.js:36:26)
    at Backbone.Model (/Users/rpflo/Code/github/ember-tools/node_modules/testem/node_modules/backbone/backbone.js:258:21)
    at child (/Users/rpflo/Code/github/ember-tools/node_modules/testem/node_modules/backbone/backbone.js:1531:41)
    at new child (/Users/rpflo/Code/github/ember-tools/node_modules/testem/node_modules/backbone/backbone.js:1531:41)
    at EventEmitter.App.initView (/Users/rpflo/Code/github/ember-tools/node_modules/testem/lib/dev_mode_app.js:58:28)

exited with code 1

Anybody have any thoughts?

from testem.

davemo avatar davemo commented on July 16, 2024

You may have some luck checking out how we integrate Testem into Lineman @rpflorence, check out our "spec" grunt task to see how it's done.

Edit:** Also relevant is our testem-utils file.

from testem.

airportyh avatar airportyh commented on July 16, 2024

Thanks @davemo! I was wondering how you guys did it myself. @rpflorence exec or spawn do not work because dev mode requires an ANSI terminal.

from testem.

mistaecko avatar mistaecko commented on July 16, 2024

There is a new 'Terminal' plugin (at least in WebStorm 7 EAP) that has support for ANSI control characters. It basically launches a system terminal inside the IDE. I can run Testem in DEV mode there. But of course no hot-linking in stack-traces which I would really be interested in.

from testem.

airportyh avatar airportyh commented on July 16, 2024

@mistaecko that's neat!

from testem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.