diff --git a/karma/jasmine/client-spec.js b/karma/jasmine/client-spec.js index e2a6b3cf0..9ad05e25b 100644 --- a/karma/jasmine/client-spec.js +++ b/karma/jasmine/client-spec.js @@ -8,8 +8,12 @@ beforeAll(function(done) { client = example.createClient('http://localhost:1234') provider = Pact({ consumer: 'Karma Jasmine', provider: 'Hello' }) + // required for slower Travis CI environment setTimeout(function () { done() }, 2000) + + // Required if run with `singleRun: false` + provider.removeInteractions() }) afterAll(function (done) { @@ -47,7 +51,14 @@ }) // verify with Pact, and reset expectations - it('successfully verifies', function() { provider.verify() }) + it('successfully verifies', function(done) { + provider.verify() + .then(function(a) { + done() + }, function(e) { + done.fail(e) + }) + }) }) describe("findFriendsByAgeAndChildren", function () { @@ -91,7 +102,15 @@ }) // verify with Pact, and reset expectations - it('successfully verifies', function() { provider.verify() }) + // verify with Pact, and reset expectations + it('successfully verifies', function(done) { + provider.verify() + .then(function(a) { + done() + }, function(e) { + done.fail(e) + }) + }) }) describe("unfriendMe", function () { @@ -132,7 +151,15 @@ }) }) - it('successfully verifies', function() { provider.verify() }) + // verify with Pact, and reset expectations + it('successfully verifies', function(done) { + provider.verify() + .then(function(a) { + done() + }, function(e) { + done.fail(e) + }) + }) }) // verify with Pact, and reset expectations @@ -167,7 +194,15 @@ }) // verify with Pact, and reset expectations - it('successfully verifies', function() { provider.verify() }) + // verify with Pact, and reset expectations + it('successfully verifies', function(done) { + provider.verify() + .then(function(a) { + done() + }, function(e) { + done.fail(e) + }) + }) }) }) diff --git a/karma/jasmine/karma.chrome.conf.js b/karma/jasmine/karma.chrome.conf.js new file mode 100644 index 000000000..f6f41ac6e --- /dev/null +++ b/karma/jasmine/karma.chrome.conf.js @@ -0,0 +1,65 @@ +// Karma configuration +// Generated on Thu Nov 20 2014 14:51:15 GMT+1100 (AEDT) + +module.exports = function (config) { + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '.', + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine', 'pact'], + + // list of files / patterns to load in the browser + files: [ + '../../dist/pact.web.js', + 'client.js', + 'client-spec.js' + ], + + // list of files to exclude + exclude: [], + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: {}, + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + // web server port + port: 9876, + + // enable / disable colors in the output (reporters and logs) + colors: true, + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_DEBUG, + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['Chrome_without_security'], + + customLaunchers: { + Chrome_without_security: { + base: 'Chrome', + flags: ['--disable-web-security'] + }, + PhantomJS_without_security: { + base: 'PhantomJS', + flags: ['--web-security=no'] + } + }, + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false + }) +}