Git Product home page Git Product logo

karma's Introduction

Karma

js-standard-style npm version npm downloads

Code Climate PRs Welcome Dependency Status devDependency Status semantic-release

A simple tool that allows you to execute JavaScript code in multiple real browsers.

The main purpose of Karma is to make your test-driven development easy, fast, and fun.

Karma is deprecated and is not accepting new features or general bug fixes.

The web testing space has evolved significantly in the 10+ years since Karma's creation. The web landscape looks very different today and new patterns and tools have emerged in the ecosystem. New test runners offer more performant alternatives, and Karma no longer provides clear unique value.

Based on the current state of the web testing ecosystem, we have made the hard decision to deprecate Karma.

We know Karma is used particularly commonly in the Angular ecosystem, so Angular is adding Jest and Web Test Runner support to provide a migration path off of Karma. See the Angular blog for more details.

Critical security issues in Karma will still be triaged and fixed as necessary. This will continue until 12 months after Angular CLI's Web Test Runner support is marked stable.

For those outside Angular looking to migrate off Karma, both Web Test Runner and jasmine-browser-runner provide browser-based unit testing solutions which can be used as a direct alternative. Jest and Vitest also provide Node-based alternatives.

It has been incredible to see Karma's impact on the web testing ecosystem and we greatly appreciate the support of everyone who contributed to an awesome community. Keep testing. ✅

Help and Support

For questions and support please use the mailing list or Gitter. The issue tracker is for bug reports and feature discussions only.

When should I use Karma?

  • You want to test code in real browsers.
  • You want to test code in multiple browsers (desktop, mobile, tablets, etc.).
  • You want to execute your tests locally during development.
  • You want to execute your tests on a continuous integration server.
  • You want to execute your tests on every save.
  • You love your terminal.
  • You don't want your (testing) life to suck.
  • You want to use Istanbul to automagically generate coverage reports.
  • You want to use RequireJS for your source files.

But I still want to use _insert testing library_

Karma is not a testing framework, nor an assertion library. Karma just launches an HTTP server, and generates the test runner HTML file you probably already know from your favourite testing framework. So for testing purposes you can use pretty much anything you like. There are already plugins for most of the common testing frameworks:

If you can't find an adapter for your favourite framework, don't worry and write your own. It's not that hard and we are here to help.

Which Browsers can I use?

All the major browsers are supported, if you want to know more see the browsers page.

Troubleshooting

See FAQ.

I want to use it. Where do I sign?

You don't need to sign anything but here are some resources to help you to get started...

Obligatory Screencast.

Every serious project has a screencast, so here is ours. Just click here and let the show begin.

Installation.

See installation.

Using it.

See configuration.

This is so great. I want to help.

Please, see contributing.

Why did you create this?

Throughout the development of AngularJS, we've been using JSTD for testing. I really think that JSTD is a great idea. Unfortunately, we had many problems with JSTD, so we decided to write our own test runner based on the same idea. We wanted a simple tool just for executing JavaScript tests that is both stable and fast. That's why we use the awesome Socket.io library and Node.js.

My boss wants a license. So where is it?

MIT License

karma's People

Contributors

anthony-redfox avatar bitwiseman avatar budde377 avatar cironunes avatar danielcompton avatar deepak1556 avatar devoto13 avatar dignifiedquire avatar greenkeeperio-bot avatar iristyle avatar johnjbarton avatar karmarunnerbot avatar kimjoar avatar lusarz avatar maksimr avatar matz3 avatar mgol avatar moumi avatar pkozlowski-opensource avatar semantic-release-bot avatar shyamseshadri avatar sylvain-hamel avatar taichi avatar thorn0 avatar timbertson avatar twolfson avatar vivganes avatar vojtajina avatar wesleycho avatar zzo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

karma's Issues

Better documentation

I've started using testacular recently at work and for side projects and I really love using it. But the documentation isn't really in a great state. I would be willing to write some basic instructions for configuration and stuff but wanted to here first if there is anything planned or if you have some specifics in mind how you want the documentation to be written.

Windows support when running local copy under node_modules

I'm having two separate issues it would appear...Windows 7 x64, Node 0.8.11.

  • On 0.2.0, Chrome Canary launches process + UI just fine, but the appended ?id=1 doesn't serve up any content.
  • On 0.3..7, Chrome Canary launches the process, but it's running headless somehow. I verified this multiple times just to make sure I wasn't seeing things (including reboots, etc)

I can launch a new browser instance, and plug in the id for the url that it was launched with and I get nothing. No content is served.

Note that I've configured testacular to use both PhantomJS and Canary

So if I take the id that's supposed to be used by PhantomJS and I plug that into the browser -- everything loads up. I can see in my shell that Testacular starts serving everything properly (I'm running with LOG_DEBUG)

I'm not going to worry about 0.2.0 .. and I'll focus on 0.3.7. So to recap on those issues

  • It seems that the id that's generated for Canary isn't hooked up to what it needs to be in the serving process..
  • The UI is not firing up anymore.

I should hopefully be able to figure out why chrome.exe is spawnd without a UI ... was wondering if anyone had encountered the other issue with bad Ids?

Load external files into test runner

The following does not work in the configuration file:

...
files = [
  JASMINE,
  JASMINE_ADAPTER,
  'http://code.jquery.com/jquery-1.7.2.js',
  ...
];
...

The resolver tries to find the file relative to the base directory. Can we add in this external absolute format?

Testacular + jasmine : tests not executed

I have follow the video tutorial to set up testacular on my angularjs project, with jasmine.
My config file is

basePath = '../';

files = [
  JASMINE,
  JASMINE_ADAPTER,
  'app/lib/angular/angular.js',
  'app/lib/angular/angular-*.js',
  'test/lib/angular/angular-mocks.js',
  'app/js/**/*.js',
  'test/unit/controllersSpec.js'
];

colors = true;
autoWatch = true;

browsers = ['Chrome'];

junitReporter = {
  outputFile: 'test_out/unit.xml',
  suite: 'unit'
};

And the code in controllersSpec.js is:

'use strict';
/* jasmine specs for controllers go here */

describe('StatusBarCtrl', function(){
  it('should ....', function() {
      expect(false).toBe(true);

  });
});

I use 'testacular testacular.conf.js' in the command line. The server launch well.
When I modify a file, it is shown in the terminal, but the test are not executed : 'Executed 0 of 0 SUCCESS'.

Any idea ?

Testacular installation issue with npm

When I try to install testacular with the command: "npm -g install testacular", I get the following output:. I am runnning Windows 7 Professional and my Node version is 0.8.8

npm http GET https://registry.npmjs.org/testacular
npm http 304 https://registry.npmjs.org/testacular
npm http GET https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/chokidar
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/chokidar
npm http 304 https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/socket.io
npm http 304 https://registry.npmjs.org/glob

> [email protected] postinstall C:\Users\clewis\AppData\Roaming\npm\node_modules\testacular\node_modules\chokidar
> node setup.js postinstall

The system cannot find the path specified.
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/graceful-fs
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/socket.io-client/0.9.10
npm http GET https://registry.npmjs.org/policyfile/0.0.4
npm http GET https://registry.npmjs.org/redis/0.7.2
npm ERR! [email protected] postinstall: `node setup.js postinstall`
npm ERR! `cmd "/c" "node setup.js postinstall"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is most likely a problem with the chokidar package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node setup.js postinstall
npm ERR! You can get their info via:
npm ERR!     npm owner ls chokidar
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "-g" "install" "testacul
ar"
npm ERR! cwd C:\Users\clewis
npm ERR! node -v v0.8.8
npm ERR! npm -v 1.1.59
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/policyfile/0.0.4
npm http 304 https://registry.npmjs.org/socket.io-client/0.9.10
npm http 304 https://registry.npmjs.org/redis/0.7.2
npm http GET https://registry.npmjs.org/hiredis
npm http GET https://registry.npmjs.org/uglify-js/1.2.5
npm http GET https://registry.npmjs.org/xmlhttprequest/1.4.2
npm http GET https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 304 https://registry.npmjs.org/hiredis
npm WARN package.json [email protected] No README.md file found!

> [email protected] preinstall C:\Users\clewis\AppData\Roaming\npm\node_modules\testacular\node_modules\socket.io\node_modules\redis\node_modules\hi
redis
> make || gmake

The system cannot find the path specified.
'make' is not recognized as an internal or external command,
operable program or batch file.
'gmake' is not recognized as an internal or external command,
operable program or batch file.
npm WARN optional dep failed, continuing [email protected]
npm http 304 https://registry.npmjs.org/uglify-js/1.2.5
npm http 304 https://registry.npmjs.org/xmlhttprequest/1.4.2
npm http 304 https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 304 https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/zeparser/0.0.5
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/tinycolor
npm http GET https://registry.npmjs.org/options
npm http 304 https://registry.npmjs.org/zeparser/0.0.5
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/tinycolor
npm http 304 https://registry.npmjs.org/options

> [email protected] install C:\Users\clewis\AppData\Roaming\npm\node_modules\testacular\node_modules\socket.io\node_modules\socket.io-client\node_modules
\ws
> node install.js

The system cannot find the path specified.
[ws v0.4.21] Attempting to compile blazing fast native extensions.
[ws v0.4.21] Native code compile failed (but the module will still work):
[ws v0.4.21] The native extensions are faster, but not required.
[ws v0.4.21] On Windows, native extensions require Visual Studio and Python.
[ws v0.4.21] On Unix, native extensions require Python, make and a C++ compiler.
[ws v0.4.21] Start npm with --ws:verbose to show compilation output (if any).
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\clewis\npm-debug.log
npm ERR! not ok code 0

Code Coverage

Pretty much all the current tools instrument JS code, by adding statements like visitLine(1,5);. We might use one of them to preprocess files (using Testacular's preprocessor) and report the coverage.

We need to be able to run the code in browser.

Note, that "line" coverage is nice, but it would better to do at least decision coverage (see http://en.wikipedia.org/wiki/Code_coverage#Coverage_criteria). Might be interesting to compute coverage of all permutations (of decisions and values) as well.

https://github.com/piuccio/node-coverage
https://github.com/coveraje/coveraje

init is not working

On a fresh install from npm

$ testacular init
error (config): Config file does not exist!

The init command create a sample config file? or I need to create first from scratch?

Browser doesn't close itself after a singleRun test.

If we configure testacular to launch Chrome automatically and set to singleRun to true, the browser doesn't closes itself. The same for Firefox. Is this intentionally? Could you add some kind of a flag for this behavior?

Because we want to execute testacular on a CI server and we need to have it closed after a build.

Thanks and regards,

Guy

proxy for external file

is possible to proxy external file like json.
jstetdriver do it with

gateway:

or buster.js do

var config = module.exports;

config["My tests"] = {

resources: {
    "/app": "http://192.168.1.200:3030"
}

}

Error: ENOENT, stat '/etc/blkid.tab'

Hi...I'm receiving this error..I'm using linux mint, the latest npm and node version...what can I do??..thanks!!!!

info (watcher): Watching "/"
info: Web server started at http://localhost:8080/
info (launcher): Starting  browser "Firefox"

events.js:66
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: ENOENT, stat '/etc/blkid.tab'

Deeply-nested file glob patterns

Are the supported glob patterns for config's files variable documented?

I'm trying some relatively common patterns to get arbitrarily-deep wildcards and they aren't working.

For instance, if my config is in config/test.js, I'd expect '../spec/**/*.js' to match ../spec/foo/bar.js, but instead warn (config): Pattern "<project_root>/spec/**/*.js" does not match any file.

I can't get any other patterns to match files in unnamed nested directories, either. Is it currently not possible?

Exactly what files are needed for running angular framework?

This isn't so much bug report as a question. I have followed the video tutorial to the letter for setting up my environment using WebStorm, I then downloaded testacular from github and saw that you have some tests in there to kinda make sure that everything is working fine.
Now that I have the tests working and the server running I changed the config file to test my own jasmine test. and that works. My config looks like this
files = [
JASMINE,
JASMINE_ADAPTER,
'test/client/example.spec.js'
];

as you can see I created one test file and the test runs but as a way to reverse engineer the situation so that i can isolate the truly required files I get errors when I delete a few of the other folders.

can you tell me what the bare minimum files and directories are needed to run unit tests with testacular and angular.
Which of the following directories are needed?

adapter (I am guessing this is needed and is auto loaded)
lib
NaN
static

and do I need the /tests/e2e?

thank you for your time. I am eager to work with testacular and angular.js

Don't assume default browser install locations - Windows

The config option

browsers = ['Chrome', 'Firefox'];

failed to auto-open Firefox. This is because the script launcher.js assumes the default installation of Firefox which, in my case, is not so.

I verified this by manually setting the Firefox exe location in the launcher.js script in a horrible way, but now Firefox opens.

I am sorry for two things:

  1. .. that I use Windows at all.
  2. .. that I do not know of a way to reliably detect the installed location of any particular program.

But I don't think an assumption of the default installation location is robust.

Race-condition during browser timeout

based on http://ci.angularjs.org/job/angular.js-igor-testacular/584/console

this is my interpretation of what happened:

If a browser launched by Testacular is taking a long time to start and a startup timeout is reached, Testacular will kill it. If however, between the kill command is issued and the browser is actually killed the browser connects, Testacular will hang.

  • T starts
  • T launches a browser B
  • B is taking a long time to start and doesn't get captured before startup time is reached
  • T issues a process kill command (kill might not be immediate - e.g. when relayed via a shell script like we do with ie.sh)
  • B gets finally captured
  • B gets finally killed by the kill command
  • T sees that browser disconnect and process exit and it then just waits and waits

JASMINE and JASMINE_ADAPTER not defined

I'd like to point out that I'm getting the same issue when I run it under Fedora Linux. The startup is fine, when it comes time to run, it throws the exceptions:

ReferenceError: Can't find variable: JASMINE
ReferenceError: Can't find variable: JASMINE_ADAPTER

Both the Linux and Windows environments consist of: Node 0.8.8, Testacular latest release installed via npm, phantomjs latest release.

CI testing more documentation

I can't see how testaculat integrates with jenkins.

We can put singleRun = true in config, right?

And then testacular can just say if all tests pass or not through exit status?

I mean, you can't really see in jenkins which tests failed right?

Because, it would need to have some kind of xml output which jenkins can parse.

detect page reloads in context.html

if a test accidentally reloads the context.html testacular should detect it and fail the test run + recover. right now it gets into a state where I have to manually refresh the testacular window.

Launch profile for Opera should set collections of stats settings

When started Opera occasionally prompts the user to opt into collection of usage statistics. This prompt window currently causes Testacular to stall and wait indefinitely. If the prompt dialog is not manually closed, test run will never make a progress.

There doesn't seem to be a command line switch to suppress this behavior, but I'm guessing that if the setting is explicitly set to either yes or no (likely no is a better option since we don't really use the browser in a normal way), the dialog will not show up. To set this option, we'll have to generate or edit the opera profile ini file when creating a profile for the run.

Ignore .#* Emacs lock files

When using the auto-watch: true I get the following error

$ Error: ENOENT, stat '/Users/dignifiedquire/play/github/yaas/test/unit/directives/.#version.spec.coffee'

This is caused because Emacs creates these lock files while editing. Adding these to the exclude list doesn't work.
I've created an issue here and already got an answer. So maybe this could be used for fixing this.

Test runner failure when trying to get exception name.

I'm not sure if I'm doing something wrong, when I run the following spec (using the angular scenario adapter), no error is ever displayed.

describe("the home page", function() {
  beforeEach(function() {
    return browser().navigateTo('/');
  });
  it("should redirect to /#/", function() {
     expect(false).toBe(true)
  });
});

If I throw a breakpoint on this line I see that spec.name === "should redirect to /#/" and spec.steps is an empty array, so failedStep is null and accessing failedStep.name causes the runner to error out.

This seems like a bug to me, but the entire set up is new to me so if I'm doing something wrong let me know.

PhantomJS not connecting?

$ testacular start
info: Web server started at http://localhost:8080/
info (launcher): Starting browser "PhantomJS"
info (watcher): Watching "/usr/local/share/npm/lib/node_modules/testacular/adapter/lib/jasmine.js"
info (watcher): Watching "/usr/local/share/npm/lib/node_modules/testacular/adapter/jasmine.js"
info (watcher): Watching "/Users/marknadig/Code/kona/test/lib/angular-mocks.js"
info (watcher): Watching "/Users/marknadig/Code/kona/app/scripts"
info (watcher): Watching "/Users/marknadig/Code/kona/test/spec"
warn (cfJp1JaDS3Aqb71TSllo): Disconnected

node installed w/ brew on OSx 10.7.4

$node -v
v0.8.9

$npm -v
1.1.61

$phantomjs --version
1.7.0

$testacular --version
Testacular version: 0.2.0

I never see "info (PhantomJS 1.7): Connnected on socket id ……" as my teammate sees as it runs the tests.

any help appreciated

Note: In one shell I ran 'testacular start' and then opened another and ran it again and it runs fine...seems it is falling back to another port:
nadig-mbpro:kona[master*]$ testacular start
warn: Port 8080 in use
warn: Port 9100 in use
info (watcher): Watching "/usr/local/share/npm/lib/node_modules/testacular/adapter/lib/jasmine.js"
info (watcher): Watching "/usr/local/share/npm/lib/node_modules/testacular/adapter/jasmine.js"
info (watcher): Watching "/Users/marknadig/Code/kona/test/lib/angular-mocks.js"
info (watcher): Watching "/Users/marknadig/Code/kona/app/scripts"
info (watcher): Watching "/Users/marknadig/Code/kona/test/spec"
info: Web server started at http://localhost:8081/
info (launcher): Starting browser "PhantomJS"
info: To run via this server, use "testacular run --runner-port 9101"
info (PhantomJS 1.7): Connected on socket id Tp26dgSP5f94WNxWVKj4

So, I confirmed if I change my testacular.conf.js to use port 8081, it works. Not seems a conflict on 8080 but... not seeing what that could be.

Exotic Proxy support

Proxy support currently only works for the most basic URL renaming situations. Anything more exotic, like

proxies = [
  '/': 'http://other.host.example.local'
]

will generally fail, because the underlying HTTP Proxy isn't correctly configured to change origin, etc. I propose an extended syntax for proxies:

proxies = [
  '/path': '/rewrite/local/path',
  '/remote': {
    server: 'other.host.example.local',
    port: 80,
    path: '/app/dir'
  }
]

with path being the minimum required; with no other options, 'url' and {path:'url'} would be equivalent.

e2e tests?

As I understand from some recent commits it is possible to use testacular for e2e testing. If I understand correctly, please could you provide some example or documentation to configure this on a angular-seed project?

Also, is the source code used in the youtube tutorial available anywhere?

thanks.

Create TAP adapter

If a testing library outputs TAP it should be trivial to pipe that TAP output into your framework.

execvp(): No such file or directory

I am trying to figure out why I'm getting this error when I try to run grunt test on the angular-ui project. It seems to be narrowed down to one mac but not the other, and no one online seems to have more info.

Does this error make any sense to you? I only get it when I try to run tests. I was hoping it was referenced in this code or if I should try looking inside jasmine? It's completely halted all testing for me and is quite frustrating.

Race condition when running as subprocess in Windows

When running Testacular as a Node subprocess in Windows XP, Testacular sometimes exits before it's done writing its output. Here's code to reproduce the issue:

function monitorEvent(name, emitter, event) {
    emitter.on(event, function(arg) {
        arg = arg ? ": " + arg : "";
        console.log("> " + name + " " + event + arg);
    });
}

function monitorStream(name, stream, out) {
    stream.on("data", function(chunk) {
        out.write(chunk);
    });
    monitorEvent(name, stream, "end");
    monitorEvent(name, stream, "error");
    monitorEvent(name, stream, "close");
}

function sh(command, args, callback) {
    console.log("> " + command + " " + args.join(" "));

    var child = require("child_process").spawn(command, args, { stdio: "pipe" });

    monitorStream("child.STDOUT", child.stdout, process.stdout);
    monitorStream("child.STDERR", child.stderr, process.stderr);

    monitorEvent("CHILD", child, "exit");
    monitorEvent("CHILD", child, "close");
    monitorEvent("CHILD", child, "disconnect");
    monitorEvent("CHILD", child, "message");
    child.on("close", function() {
        callback();
    });
}

sh("node", ["node_modules/testacular/bin/testacular", "run"], function() {
    console.log("> Testacular complete.");
});

The output of four runs of this code is:

C:\projects\testacular_windows_stdout>node parent.js
> node node_modules/testacular/bin/testacular run
> child.STDERR end
> child.STDERR close
> child.STDOUT end
> child.STDOUT close
> CHILD exit
> CHILD close
> Testacular complete.

C:\projects\testacular_windows_stdout>node parent.js
> node node_modules/testacular/bin/testacular run
IE 8.0: Executed 1 of 1
> child.STDERR end
> child.STDERR close
> child.STDOUT end
> child.STDOUT close
> CHILD exit
> CHILD close
> Testacular complete.

C:\projects\testacular_windows_stdout>node parent.js
> node node_modules/testacular/bin/testacular run
> child.STDERR end
> child.STDERR close
> child.STDOUT end
> child.STDOUT close
> CHILD exit
> CHILD close
> Testacular complete.

C:\projects\testacular_windows_stdout>node parent.js
> node node_modules/testacular/bin/testacular run
IE 8.0: Executed 1 of 1
> child.STDERR end
> child.STDERR close
> child.STDOUT end
> child.STDOUT close
> CHILD exit
> CHILD close
> Testacular complete.

Note that Testacular's output only appears in half of these runs, and it's truncated when it does.

Here's the expected output:

C:\projects\testacular_windows_stdout>node node_modules/testacular/bin/testacular run
IE 8.0: Executed 1 of 1 SUCCESS (0.047 secs / 0 secs)

Testacular version: 0.2.1
Reproduced on Node versions: 0.8.10, 0.8.11

(Why am I doing this? I'm running Testacular from a Jake build script. The script parses Testacular's output to see if all of my supported browsers were tested. If not, the build fails.)

Testacular with travis

Would be great to have some doc on this :

Tried this .travis.yml

language: node_js
node_js:
  - 0.8
  - 0.6

before_script:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - sleep 3 # give xvfb some time to start

script:
  - testacular start ./testacular.conf.js --single-run --browsers PhantomJS

with no luck, i get :

error (config): Config file does not exist!

You can check the job there : http://travis-ci.org/#!/mgcrea/angular-strap/jobs/2375506

I tried without the file, without the ./, etc.

Any idea on how I could fix this?

no error when a browser fails to start

latest canay 0.3.8 does abort a run if a browser fails to start, but there is no indication as to which browser failed and with what error:

info: Testacular server started at http://localhost:9876/
info (launcher): Starting  browser "Chrome"
info (launcher): Starting  browser "Firefox"
info (launcher): Starting  browser "Opera"
info (launcher): Starting  browser "/Users/jenkins/bin/safari.sh"
info (launcher): Starting  browser "/Users/jenkins/bin/ie8.sh"
info (launcher): Starting  browser "/Users/jenkins/bin/ie9.sh"
info: Disconnecting all browsers

ideally, I'd like to see an error log statying that e.g. ie9.sh exited before a browser was captured and that the exit code was 12. or maybe even print the actual error message from stderr if there is anything there.

Ability to override config properties via command line arguments

Hi,

we have a CI environment where we run multiple projects and each one has e webapp running for the tests. Now we have some kind of logic which searches a free port to start the server and tell the application on which port the server is running. Now i just found out that I could override the port setting in the config by starting testacular with this command line argument:

--port=1234

But I can't create objects in the command line to use for example for the proxies property. Is there a possibility to add them via command line arguments or system properties ?

Thanks and regards,

Guy

Sublime console

wouldn't it be possible to run it within the sublime console?

incorrect warning about file not found

If a file is explicitly listed in the includes and excludes list Testacular prints a falsy warning:

warn (watcher): Pattern "/Users/iminar/Development/angular/angular.js/test/jquery_alias.js" does not match any file.

test errors appear twice

using 0.1.2 when a test fails, I'm getting the error message twice... can anybody else confirm this?

Don't synchronize test runs across multiple browsers

When using testacular to launch browsers (via browsers option), testacular should start a test run as soon as individual browsers connect – currently testacular waits for all browsers to connect and only then it starts test runs in all the browsers.

Similarly, when singleRun option is used, testacular should shut down browsers as they complete running tests. This will release OS resources speeding up the remaining browsers.

Firefox should open up a new instance

When Firefox is not running, testacular appears to create a new profile and open up the browser with that. However, when Firefox is running, the profile creation fails and testacular opens up in the profile that's already open.

Adding the "--new-instance" parameter to the firefox command line when the profile is created will make it possible to create the new profile even if firefox is already running (unless, I suppose, it's running with that profile). Adding it to the command line when the browser is actually opened will also ensure that it runs in a separate process from the already running instance, and that it will open up in the expected profile.

(The above tested by running command lines against Firefox 15.0.1 on Ubuntu, but to my knowledge this is the way it's been for years -- on Linux and Windows -- at least).

--no-auto-watch and --auto-watch=false should be have the same

right now the second prints logs "watching ..." but it doesn't actually watch anything. the second doesn't print the log.

while it is useful to see which files are being loaded, the logging should be printed at lower log level for all cases (or there should be a flag --log-file-list).

"watching" should be logged when files are being watched. "loading" should be used in case when we don't autowatch.

Connects to previous browser runs, even when browser is not specified

Relevant output.. basically I'm replicating on my dev machine a build server style launch, where only PhantomJS is used and the test run output is written using the junit reporter.

To my surprise, it started establishing socket IO connections to browsers from previous watch modes. (These are all the hidden Chrome Canary windows)

Running "spec:once" (spec) task
3 Oct 10:24:40 - Starting testacular with arguments:'{"basePath":"..","files":["C:\\\\source\\\\AngularCoffeeLessDemo\\\\generated\\\\lib\\\\chai.js","C:\\\\source\\\\AngularCoffeeLessDemo\\\\generated\\\\test\\\\chai-adapter.js","C:\\\\source\\\\AngularCoffeeLessDemo\\\\generated\\\\lib\\\\mocha.js","C:\\\\source\\\\AngularCoffeeLessDemo\\\\generated\\\\lib\\\\mocha-adapter.js","generated/lib/require.js","generated/app.js","generated/specs.js"],"reporters":["junit"],"browsers":["PhantomJS"],"autoWatch":false,"singleRun":true,"configFile":"C:\\\\source\\\\AngularCoffeeLessDemo\\\\config\\\\testacular.conf.js","assertionLib":"chai","adapter":"mocha","junitReporter":{"outputFile":"../dist/test-results.xml","suite":""},"logLevel":4,"reportSlowerThan":500}'
info: Testacular server started at http://localhost:9876/
debug (launcher): Creating temp dir at C:\Users\EPS\AppData\Local\Temp\testacular-59961876
info (launcher): Starting  browser "PhantomJS"
debug (launcher): C:\Program Files (x86)\PhantomJS\phantomjs.exe C:\Users\EPS\AppData\Local\Temp\testacular-59961876/capture.js
debug (watcher): Resolved files:
        C:/source/AngularCoffeeLessDemo/generated/lib/chai.js
        C:/source/AngularCoffeeLessDemo/generated/test/chai-adapter.js
        C:/source/AngularCoffeeLessDemo/generated/lib/mocha.js
        C:/source/AngularCoffeeLessDemo/generated/lib/mocha-adapter.js
        C:/source/AngularCoffeeLessDemo/generated/lib/require.js
        C:/source/AngularCoffeeLessDemo/generated/app.js
        C:/source/AngularCoffeeLessDemo/generated/specs.js
debug: New browser has connected on socket GUWK6Yc8hryEiwEtA6Sm
info (Chrome 24.0): Connected on socket id GUWK6Yc8hryEiwEtA6Sm
debug: New browser has connected on socket 6D8bE-OoqQkaNWIkA6Sn
info (Chrome 24.0): Connected on socket id 6D8bE-OoqQkaNWIkA6Sn
debug: New browser has connected on socket WXJ4EtE6fbZL3xWrA6Sp
info (Chrome 24.0): Connected on socket id WXJ4EtE6fbZL3xWrA6Sp
debug: New browser has connected on socket dgS8cXbDYBftbCZeA6So
info (Chrome 24.0): Connected on socket id dgS8cXbDYBftbCZeA6So
debug: New browser has connected on socket I5Eqn9Zpju5ka4KJA6Si
info (Chrome 24.0): Connected on socket id I5Eqn9Zpju5ka4KJA6Si
debug: New browser has connected on socket 475cqd4WYR5-uiRRA6Sk
info (Chrome 24.0): Connected on socket id 475cqd4WYR5-uiRRA6Sk
debug: New browser has connected on socket sTIKRsyHJ2iDfyR8A6Sh
info (Chrome 24.0): Connected on socket id sTIKRsyHJ2iDfyR8A6Sh

Later on there is some output

info: Disconnecting all browsers
debug: Waiting for child processes to finish

So I'm not sure if it's doing what it's supposed to be doing... but it doesn't seem that it is.

Run tests on start

When testacular starts (without single-run mode, with file watching enabled), wait for capturing browsers and execute without file changing.

Wildcard pattern not recognized on Windows.

When using testacular on Windows the wildcard patterns are not being recognized:

warn (config): Pattern "C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\test\unit\app\*.js" does not match any file

Here's the config settings:

files = [
  JASMINE,
  JASMINE_ADAPTER,
  '_public/js/vendor.js',
  '_public/js/app.js',
  'test/vendor/angular/angular-mocks.js',
  'test/unit/app/*.js'
];

Full trace:

Kyle Finley@WIN-EKJFQUMNRPN /cygdrive/c/Users/Kyle Finley/Downloads/scotch-angular-brunch-seed
$ ./scripts/test.sh
info: Web server started at http://localhost:3334
info: To run via this server, use "testacular-run --runner-port 3335"
warn (config): Pattern "C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\test\unit\app\*.js" does not match any file
debug (config): Resolved file C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\node_modules\testacular\adapter\lib\jasmine.js
debug (config): Resolved file C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\node_modules\testacular\adapter\jasmine.js
debug (config): Resolved file C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\_public\js\vendor.js
debug (config): Resolved file C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\_public\js\app.js
debug (config): Resolved file C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\test\vendor\angular\angular-mocks.js
debug (config): Watching  C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\node_modules\testacular\adapter\lib\jasmine.js
debug (config): Watching  C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\node_modules\testacular\adapter\jasmine.js
debug (config): Watching  C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\_public\js\vendor.js
debug (config): Watching  C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\_public\js\app.js
debug (config): Watching  C:\Users\Kyle Finley\Downloads\scotch-angular-brunch-seed\test\vendor\angular\angular-mocks.js
debug: New browser has connected on socket 17415615711820254411
info (Chrome 20.0): Connected on socket id 17415615711820254411

Here's the complete app angular-brunch-seed

The same code works perfectly on OS X, so I'm wondering if Windows does not recognize the wildcard. Any ideas on how to resolve this?

Thanks,

-Kyle

test codes doesn't work on windows

Hi, i try to run testacular tests on windows7 64bit.
But any test tasks doesn't work on windows.

I works on master branch.

At first

npm install which

and modify tasks/test.js like the below

  grunt.registerMultiTask('test', 'Run tests.', function() {
    var specDone = this.async();
    var which = require('which').sync;
 ....SNIP...
    // UNIT tests
    else if (this.target === 'unit') {
      exec(which('jasmine-node'), ['--coffee', this.data], 'Unit tests failed.');
    }


    // CLIENT unit tests
    else if (this.target === 'client') {
      exec(which('testacular'), ['start', this.data, '--single-run', '--no-auto-watch', '--reporters=dots',
          '--browsers=' + BROWSERS], 'Client unit tests failed.');
    }
  • client tests are works well. all client tests are passed.
  • many of unit tests are not pass. errors are here
  • e2e test are not work.

i want to hack testacular on windows7.

any suggestions ?

AMD Support?

This looks super promising. Have you guys put in any thought into supporting AMD? Like RequireJS?

Nice work!

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.