Giter Club home page Giter Club logo

karma-pact's People

Contributors

bbarke avatar bendave avatar dependabot[bot] avatar fernanfs avatar gabrielalan avatar mboudreau avatar mefellows avatar rafaelhdr avatar tarciosaraiva avatar timothyjones avatar you54f avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

karma-pact's Issues

Pact is not creating log file

I have message in console See /Users/cakeinpanic/projects/myProject/logs/mockserver-integration.log for details. but there is no file created.
It was created once, then I deleted it and no more files were generated again.

upd: it started working normally after i had rebooted my laptop. not likely for npm packages)

node v8.9.4
mac os x el capitan
"@pact-foundation/karma-pact": "2.1.5",
"@pact-foundation/pact-node": "6.18.3",
"@pact-foundation/pact-web": "5.9.1",

One more thing: I have set specific folder for logs, but it seems to be ignoring it

config:

        frameworks: ['jasmine', 'pact'],
        plugins: [
            'karma-*',
            '@pact-foundation/karma-pact'
        ],
        pact: [{
            cors: true,
            port: 1234,
            dir: "pacts",
            spec: 2,
            log: path.resolve(process.cwd(), 'mimilog', 'pact.log'),
        }],

Chore: migrate away from TravisCI

TravisCI (org) is dropping support for OSS builds at the end of this month, meaning they must be transferred to travis-ci.com, which uses a credit system. Builds may fail (and already are) if the number of credits is exhausted within the month.

We are recommending switching to GH Actions, but the choice of CI provider is up to the project maintainer.

See also:

https://mailchi.mp/3d439eeb1098/travis-ciorg-is-moving-to-travis-cicom
https://travis-ci.community/t/org-com-migration-unexpectedly-comes-with-a-plan-change-for-oss-what-exactly-is-the-new-deal/10567/5

NPM Install fails when version of Node is > 10.0

As per abbr/deasync#97, if the version of Node installed locally is > V10.0 then npm install fails due to an issue within Deasync itself. Deasync has been updated to the latest version (0.1.13) which fixes this issue, but karma-pact still references the old broken version (0.1.12).

All of our build agents have just been updated to Node V10 so we now cannot run npm build without downgrading the version of Node.

To replicate the issue, update your local version of Node to > V10 and then run npm install on any project that uses karma-pact.

Error ENOENT when using pact_binary_location

Hi! I get this error when I try to use my own binary files.

Here is my configuration:

package.json

  "scripts": {
    "test": "karma start karma-pact.config.js"
  },
...
  "config": {
    "pact_do_not_track": true,
    "pact_binary_location": "/node_modules/npm-pact-binaries"
  },
...

karma.config.js copied from official example

module.exports = function (config) {
  config.set({
    basePath: '.',
    // in here we are simply telling to use Jasmine with Pact
    frameworks: ['pact'],
	// the Pact options will go here, you can start
    // as many providers as you need
    
    // list of files / patterns to load in the browser
    files: [
      // During development
      // '../../dist-web/pact-web.js',
      // Example Using NPM package
      require.resolve('@pact-foundation/pact-web/pact-web.js'),
    ],

    pact: [{
    	port: 1234,
    	consumer: "some-consumer",
    	provider: "some-provider",
		dir: "pact",
		log: "log"
	}],
	// ensure Pact and default karma plugins are loaded
    plugins: [ '@pact-foundation/karma-pact' ],
  });
};

node version 13.10.1

Script to install all dependencies:

PACT_SKIP_BINARY_INSTALL=true npm install --save-dev npm-pact-binaries @pact-foundation/karma-pact @pact-foundation/pact-node @pact-foundation/pact-web
[2021-01-11T22:18:27.643Z]  INFO: pact-node@10.11.1/2291 on XXXXXX: 
    Creating Pact Server with options: 
    {"port":1234,"consumer":"some-consumer","provider":"some-provider","dir":"/Users/XXXXXXX/demos/contract-testing/pact","log":"/Users/XXXXXXX/demos/contract-testing/log","pactFileWriteMode":"overwrite","ssl":false,"cors":false,"host":"localhost"}
[2021-01-11T22:18:27.705Z] ERROR: pact-node@10.11.1/2291 on XXXXXX: spawn standalone/darwin-1.88.3/pact/bin/pact-mock-service ENOENT
    Error: spawn standalone/darwin-1.88.3/pact/bin/pact-mock-service ENOENT
        at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
        at onErrorNT (internal/child_process.js:467:16)
        at processTicksAndRejections (internal/process/task_queues.js:84:21)
        at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:66:3)
        at Function.module.exports.loopWhile (/Users/XXXXXXX/node_modules/deasync/index.js:70:11)
        at runPactMockServer (/Users/XXXXXXX/node_modules/@pact-foundation/karma-pact/src/index.js:28:10)
        at Array.invoke (/Users/XXXXXXX/demos/contract-testing/node_modules/di/lib/injector.js:75:15)
        at Injector.get (/Users/XXXXXXX/demos/contract-testing/node_modules/di/lib/injector.js:48:43)
        at /Users/XXXXXXX/demos/contract-testing/node_modules/karma/lib/server.js:183:59
        at Array.map (<anonymous>)
        at Server._start (/Users/XXXXXXX/demos/contract-testing/node_modules/karma/lib/server.js:183:25)
        at Injector.invoke (/Users/XXXXXXX/demos/contract-testing/node_modules/di/lib/injector.js:75:15)

The thing is that if I use the common way, without using may own binaries (also without special config in my package.json=> pact_binary_location) everything works right.

Best regards.

On updating to version 2 tests are not running - possible issue with deasync

Migrating from:
"@pact-foundation/pact-node": "4.12.0",
"karma-pact": "0.0.7",
to:
"@pact-foundation/pact-node": "6.19.7",
"@pact-foundation/karma-pact": "2.1.5",

karma.conf.js:

// Karma configuration
// Generated on Mon Jul 07 2014 11:06:02 GMT+0100 (BST)

var path = require('path');

console.log('------------------ CONFIG STARTED');

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: ['mocha', 'pact', 'requirejs'],

        // browserNoActivityTimeout: 60000,
        plugins: [
            'karma-*',
            '@pact-foundation/karma-pact'
        ],

        pact: [
            {
                port: 8990,
                log: path.resolve(process.cwd(), 'logs', 'pact-tests.user-auth.log'),
                dir: path.resolve(process.cwd(), 'build/pacts/json'),
                logLevel: 'DEBUG',
                spec: 2
            }
        ],

        // list of files / patterns to load in the browser
        files: [
            {pattern: 'tests/specs/**/*.js', included: false},
            {pattern: 'node_modules/chai/chai.js', included: false},
            {pattern: 'node_modules/sinon/pkg/sinon.js', included: false},
            {pattern: 'node_modules/sweep.js/build/sweep.js', included: false},
            {pattern: 'node_modules/signals/dist/signals.js', included: false},
            {pattern: 'node_modules/infuse.js/src/infuse.js', included: false},
            {pattern: 'node_modules/q/q.js', included: false},
            {pattern: 'node_modules/reqwest/reqwest.js', included: false},
            {pattern: 'node_modules/@pact-foundation/pact/pact-web.js', included: false},
            {pattern: 'node_modules/axios/dist/axios.js', included: false},
            {pattern: 'node_modules/squirejs/src/Squire.js', included: false},
            {pattern: 'public/**/*.js', included: false, served: true},
            {pattern: 'public/js/app/modules/**/*.json', included: false, served: true},
            {pattern: 'tests/pact/interactions/**/*.js', included: false, served: true},
            'tests/assets/pact-test-helper.js',
            'tests/pact/karma/user-auth/runner.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: ['mocha'],


        // 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_ERROR,


        // enable / disable watching file and executing tests whenever any file chan ges
        autoWatch: true,


        // start these browsers
        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
        browsers: ['ChromeHeadless'],

        // Continuous Integration mode
        // if true, Karma captures browsers, runs the tests and exits
        singleRun: false
    });
};

Command run:
karma start tests/pact/karma/user-auth/karma.conf.js --single-run --no-browser --verbose

Console output:

------------------ CONFIG STARTED
[2018-07-25T13:59:23.378Z]  INFO: [email protected]/93392 on C02R84BCG8WP:
    Creating Pact Server with options:
    port = 8990,
    log = /Users/martcham/edna/logs/pact-tests.user-auth.log,
    dir = /Users/martcham/edna/build/pacts/json,
    logLevel = DEBUG,
    spec = 2,
    pactFileWriteMode = overwrite,
    ssl = false,
    cors = false,
    host = localhost
[2018-07-25T13:59:23.394Z]  INFO: [email protected]/93392 on C02R84BCG8WP: Created './standalone/darwin-1.52.2/bin/pact-mock-service service --port '8990' --log '/Users/martcham/edna/logs/pact-tests.user-auth.log' --pact_dir '/Users/martcham/edna/build/pacts/json' --log-level 'DEBUG' --pact_specification_version '2' --pact-file-write-mode 'overwrite' --host 'localhost'' process with PID: 93433
---------------- STARTED function
^C[2018-07-25T13:59:29.517Z]  INFO: [email protected]/93392 on C02R84BCG8WP: Removing all Pact servers.
[2018-07-25T13:59:29.518Z]  INFO: [email protected]/93392 on C02R84BCG8WP: Removing Pact with PID: 93433

The karma-pact/src/index.js:

var Promise = require("bluebird");
var deasync = require('deasync');

var runPactMockServer = function (pacts, logger) {
	var log = logger.create('pact');
	pacts = pacts || [];
	
	// If pact options is object, wrap in array
	if (!Array.isArray(pacts)) {
		pacts = [pacts];
	}
	
	var done = false;
	
	Promise.all(pacts.map(function (pact) {
		var server = wrapper.createServer(pact);
		return server.start().then(function () {
			log.info('Pact Mock Server running on port: ' + server.options.port);
			console.log('---------------- STARTED', typeof log.info);
		}, function (err) {
			console.log('---------------- NOT STARTED', err);
			log.error('Error while trying to run karma-pact: ' + err);
		});
	})).then(function() {
		console.log('------------ ALL DONE');
		done = true;
	});
	
	deasync.loopWhile(function(){return !done;});
};

runPactMockServer.$inject = ['config.pact', 'logger'];

module.exports = {
	'framework:pact': ['factory', runPactMockServer]
};

There appears to be an issue with deasync as when I edit the index to:

var Promise = require("bluebird");
var deasync = require('deasync');

var runPactMockServer = function (pacts, logger) {
	var log = logger.create('pact');
	pacts = pacts || [];
	
	// If pact options is object, wrap in array
	if (!Array.isArray(pacts)) {
		pacts = [pacts];
	}
	
	var done = false;
	

	var server = wrapper.createServer(pacts[0])
	server.start().then(function () {
		console.log('---------------- STARTED');
		log.info('Pact Mock Server running on port: ' + server.options.port);
	}, function (err) {
		console.log('---------------- NOT STARTED', err);
		log.error('Error while trying to run karma-pact: ' + err);
	})
	
};

runPactMockServer.$inject = ['config.pact', 'logger'];

module.exports = {
	'framework:pact': ['factory', runPactMockServer]
};

The runner is started and the console output is:

------------------ CONFIG STARTED
[2018-07-25T16:25:07.359Z]  INFO: [email protected]/94711 on C02R84BCG8WP:
    Creating Pact Server with options:
    port = 8990,
    log = /Users/martcham/edna/logs/pact-tests.user-auth.log,
    dir = /Users/martcham/edna/build/pacts/json,
    logLevel = DEBUG,
    spec = 2,
    pactFileWriteMode = overwrite,
    ssl = false,
    cors = false,
    host = localhost
[2018-07-25T16:25:07.367Z]  INFO: [email protected]/94711 on C02R84BCG8WP: Created './standalone/darwin-1.52.2/bin/pact-mock-service service --port '8990' --log '/Users/martcham/edna/logs/pact-tests.user-auth.log' --pact_dir '/Users/martcham/edna/build/pacts/json' --log-level 'DEBUG' --pact_specification_version '2' --pact-file-write-mode 'overwrite' --host 'localhost'' process with PID: 94713

START:
---------------- STARTED
HeadlessChrome 0.0.0 (Mac OS X 10.12.6) LOG: '--------------- RUNNER STARTED'
HeadlessChrome 0.0.0 (Mac OS X 10.12.6) ERROR
  {
    "message": "Uncaught Error: Script error for \"Pact\", needed by: tests/specs/modules/sign-in/services/user-auth.js, tests/specs/modules/sign-in/services/user-token.js, tests/specs/modules/sign-in/services/user-pairing-code.js\nhttp://requirejs.org/docs/errors.html#scripterror\nat node_modules/requirejs/require.js:143:9\n\nError: Script error for \"Pact\", needed by: tests/specs/modules/sign-in/services/user-auth.js, tests/specs/modules/sign-in/services/user-token.js, tests/specs/modules/sign-in/services/user-pairing-code.js\nhttp://requirejs.org/docs/errors.html#scripterror\n    at makeError (node_modules/requirejs/require.js:168:17)\n    at HTMLScriptElement.onScriptError (node_modules/requirejs/require.js:1738:36)",
    "str": "Uncaught Error: Script error for \"Pact\", needed by: tests/specs/modules/sign-in/services/user-auth.js, tests/specs/modules/sign-in/services/user-token.js, tests/specs/modules/sign-in/services/user-pairing-code.js\nhttp://requirejs.org/docs/errors.html#scripterror\nat node_modules/requirejs/require.js:143:9\n\nError: Script error for \"Pact\", needed by: tests/specs/modules/sign-in/services/user-auth.js, tests/specs/modules/sign-in/services/user-token.js, tests/specs/modules/sign-in/services/user-pairing-code.js\nhttp://requirejs.org/docs/errors.html#scripterror\n    at makeError (node_modules/requirejs/require.js:168:17)\n    at HTMLScriptElement.onScriptError (node_modules/requirejs/require.js:1738:36)"
  }

Finished in 0.138 secs / 0 secs @ 17:25:08 GMT+0100 (BST)

Any help would be greatly appreciated!

TypeError: process._tickDomainCallback is not a function

The relevant versions of the packages you are using.

  • linux
  • node v9.4.0
  • npm 5.6.0
  • pact (from package.json):
    "@pact-foundation/pact-node": "6.5.0",
    "@pact-foundation/karma-pact": "2.1.3",
    "@pact-foundation/pact-web": "5.3.0",

The steps to recreate your issue and An executable code example where possible. You can fork this repository and use one of the test cases to quickly recreate your issue

I am testing with a code example: https://github.com/thombergs/code-examples/tree/master/pact/pact-angular

Commands that I am running and raise error:

$ git clone https://github.com/thombergs/code-examples
$ cd code-examples/pact/pact-angular/
$ npm install
$ npm test
...
TypeError: process._tickDomainCallback is not a function
...

I see that there is the same issue at abbr/deasync. An update of karma-pact/package.json is OK?

Thanks

Unexplained race condition

Hi, I'm looking for an explanation about the ugly setTimeout-based workaround featured in the official example usage of karma-pact.

Obviously, you want your tests deterministic and hence this kind of arbitrary waits must be eliminated. I dug around and found that the hack was introduced by @tarciosaraiva in 2016 when he included the karma test in the build pipeline. However, the commit doesn't explain exactly why this workaround was needed in the first place.

The source of karma-pact seems to handle initialization just fine. As in: if the promise provided by pact-node in the return from start() only resolves after the server has been started, then karma-pact should be free from race conditions. So, is it that pact-node resolves the promise early, leaving a small window open for code to run before the server is actually up?
Here again, I looked at the source of pact-node and it looks like it does the right thing and probes the server with HTTP requests until success before resolving the promise.

After some more investigation, there was a commit in karma-pact in 2017 which changed from returning a promise to synchronously waiting for the completion of said promise.
Maybe this is what the above mentioned workaround was working around. But now that it has been fixed, there should be no reason to have this timeout anymore, should there?

Pact Mock Server startup hanging since NodeJS v12.11

Hello,

I am facing the issue, that with the latest version of karma-pact and nodejs the process hangs right after starting the Pact Server. I get the success Logging information, but then nothing happens.

$ ng test --watch false
10% building 3/3 modules 0 active[2019-11-22T11:37:26.506Z]  INFO: [email protected]/13260 on PCNAME:
    Creating Pact Server with options:
    {"cors":true,"port":9570,"consumer":"ui","provider":"service","dir":"Z:\\schurz\\ui\\pacts","pactFileWriteMode":"overwrite","ssl":false,"host":"localhost"}
10% building 6/6 modules 0 active22 11 2019 12:37:30.042:INFO [pact]: Pact Mock Server running on port: 9570

The last nodejs it works with is v12.10 . Not really knowing what I do, I had a closer noob look at the Promise, since I read, that nodejs changed some fundamental stuff to boost performance for await and all functionality of promises.
When I go into the index.js file and change the following:

var promise = Promise || require("bluebird");
to
var promise = require("bluebird");

it all works fine again.

Do you know why it behaves like this? What changed in nodejs 12.10 to 12.11 according to promises to have this impact?

Best, Jonas

Make plugin async

karma-pact uses deasync to wait for the spun up binary. Unfortunately, this leads to issues when using node versions later than 10 (see this issue). Since node 10 has passed EOL, this is a fairly important issue for karma-pact.

Karma supports async plugins since 4.3.0, so we should remove the deasync dependency and make karma-pact async.

Not finding latest pact-node

Karma-pact seems to break since the last updates (not sure which one precisely).

Here is a package.json that breaks:

  "devDependencies": {
    "@pact-foundation/pact-node": "4.12.0",
    "karma-pact": "0.0.7",

On a centos 7 linux machine I get:

17:22:16 11 08 2017 17:22:16.429:ERROR [plugin]: Error during loading "/home/jenkins-slave/workspace/node_modules/karma-pact" plugin:
17:22:16   Cannot find module '@pact-foundation/pact-provider-verifier-linux-x64'
17:22:16 Warning: No provider for "framework:pact"! (Resolving: framework:pact)� Use --force to continue.
17:22:16 
17:22:16 Aborted due to warnings.

Here is one that works:

  "devDependencies": {
    "@pact-foundation/pact-node": "4.8.1",
    "karma-pact": "0.0.7",

I noticed a file change in the @pact-foundation/pact-node lib: dist/pact.web.js to dist/pact-web.js, it could be related?

Note: The pact-node dependency is present as I'm using it for other tasks.

Failed to Remove Pact Server after update to Angular 14

Hello,
we have an Angular application which we updated from ver. 13 to 14.
It looks like after running 'npm run test' the mock server is not beeing killed and the prozess cannot be finished.

We have the following console logs at the end:

Chrome Headless 101.0.4951.64 (Windows 10): Executed 158 of 158 SUCCESS (0 secs / 10.189 secs)
Chrome Headless 101.0.4951.64 (Windows 10): Executed 158 of 158 SUCCESS (51.854 secs / 10.189 secs)
21 06 2022 16:00:23.174:DEBUG [launcher]: CAPTURED -> BEING_KILLED
21 06 2022 16:00:23.175:DEBUG [launcher]: BEING_KILLED -> BEING_FORCE_KILLED
21 06 2022 16:00:23.175:DEBUG [Chrome Headless 101.0.4951.64 (Windows 10)]: CONNECTED -> DISCONNECTED
TOTAL: 158 SUCCESS
TOTAL: 158 SUCCESS
21 06 2022 16:00:23.179:DEBUG [karma-server]: Run complete, exiting.
21 06 2022 16:00:23.180:DEBUG [launcher]: Disconnecting all browsers
21 06 2022 16:00:23.181:DEBUG [launcher]: BEING_FORCE_KILLED -> BEING_FORCE_KILLED
21 06 2022 16:00:23.184:DEBUG [proxy]: Destroying proxy agents
21 06 2022 16:00:23.202:DEBUG [launcher]: Process ChromeHeadless exited with code null and signal SIGTERM
21 06 2022 16:00:23.203:DEBUG [temp-dir]: Cleaning temp dir C:\Soft\VSCode-win32-x64-1.66.2\data\tmp\karma-7291136
[2022-06-21 14:00:23.205 +0000] DEBUG: [email protected]: ERROR Errno::ECONNRESET: Eine vorhandene Verbindung wurde vom Remotehost geschlossen. @ io_fillbuf - fd:5
C:/app/node_modules/@pact-foundation/pact-node/standalone/win32-1.88.81/pact/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:80:in eof?' C:/app/node_modules/@pact-foundation/pact-node/standalone/win32-1.88.81/pact/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/httpserver.rb:80:in run'
C:/app/node_modules/@pact-foundation/pact-node/standalone/win32-1.88.81/pact/lib/vendor/ruby/2.2.0/gems/webrick-1.3.1/lib/webrick/server.rb:191:in `block in start_thread'

21 06 2022 16:00:23.240:DEBUG [launcher]: Finished all browsers
21 06 2022 16:00:23.241:DEBUG [launcher]: BEING_FORCE_KILLED -> FINISHED
21 06 2022 16:00:23.241:DEBUG [launcher]: FINISHED -> FINISHED
21 06 2022 16:00:23.245:DEBUG [karma-server]: Received stop event, exiting.
21 06 2022 16:00:23.245:DEBUG [launcher]: Disconnecting all browsers
21 06 2022 16:00:23.245:DEBUG [launcher]: FINISHED -> BEING_FORCE_KILLED
21 06 2022 16:00:23.246:DEBUG [proxy]: Destroying proxy agents

Our package.json:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^14.0.2",
"@angular/cdk": "^14.0.2",
"@angular/common": "^14.0.2",
"@angular/compiler": "^14.0.2",
"@angular/core": "^14.0.2",
"@angular/forms": "^14.0.2",
"@angular/material": "^14.0.2",
"@angular/platform-browser": "^14.0.2",
"@angular/platform-browser-dynamic": "^14.0.2",
"@angular/router": "^14.0.2",
"concurrently": "~7.2.2",
"rxjs": "~7.5.5",
"tslib": "~2.4.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.0.2",
"@angular/cli": "^14.0.2",
"@angular/compiler-cli": "^14.0.2",
"@pact-foundation/karma-pact": "3.1.0",
"@pact-foundation/pact-node": "10.17.1",
"@pact-foundation/pact-web": "9.17.2",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~14.14.31",
"codelyzer": "~6.0.0",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"protractor": "~7.0.0",
"schematics-scss-migrate": "1.3.14",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.6.4"
},
"config": {
"pact_do_not_track": true
}

If you give me instruction how to debug the karma-pact or see some logs I can look for the reason of the bug.

error when starting mock server

Currently, when I'm trying to start a mock server in a karma test run, I get the following error:

Unhandled rejection TypeError: Cannot read property 'port' of undefined
    at C:\daten\workspaces\code-examples\angular-pact\node_modules\@pact-foundation\karma-pact\src\index.js:19:66

Looking into the issue, I found that the following line in index.js is the culprit:

log.info('Pact Mock Server running on port: ' + server.options.port);

I found out that the server object does not have an attribute named options but rather one named _options. If I change it to _options everything works fine.

I don't know where the error now comes from, since it worked a couple weeks ago.

I use these versions:

pact-node: 5.1.2
karma-pact: 2.1.0

Feature: Publishing Pacts

I think for testing frontend application it shouldn't be necessary to use grunt or gulp or something like that. Wouldn't it be great to automatically publish the pacts after the tests to the pact broker or any other kind of repository? Maybe this is possible by adding a karma reporter.

What do you think of this?

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.