Skip to content

Commit

Permalink
chore(request): make Request class work across both Node and Browser …
Browse files Browse the repository at this point in the history
…using Popsicle

Includes a number of changes and tidying ups:

* Add 'exit' flag to mocha to exit properly after tests are done
* Update superagent dependency
* Update dependencies for karma-pact to fix issue with peer dependencies
* Update standard version, make sure the ignore glob is correct
* Fix Mocha registering ts-node twice
* Update nock to 9.1.x and fix tests
* Update lock file for e2e tests
* Adding union type for http methods to gradually change to the enum

See pact-foundation#134 and pact-foundation#10 for background.
  • Loading branch information
mboudreau authored and Josh Landi committed Mar 2, 2018
1 parent 753d948 commit 12f3622
Show file tree
Hide file tree
Showing 17 changed files with 524 additions and 563 deletions.
2 changes: 1 addition & 1 deletion config/webpack.web.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ module.exports = {
new webpack.NoEmitOnErrorsPlugin()
],
devtool: 'source-map'
}
};
104 changes: 104 additions & 0 deletions examples/e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions examples/typescript/test/get-dog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ describe("The Dog API", () => {

describe("get /dogs using object pattern", () => {
before(() => {
const interaction = {
return provider.addInteraction({
state: "i have a list of dogs",
uponReceiving: "a request for all dogs",
withRequest: {
method: "GET" as HTTPMethod,
method: "GET",
path: "/dogs",
headers: {
Accept: "application/json",
Expand All @@ -91,9 +91,7 @@ describe("The Dog API", () => {
},
body: EXPECTED_BODY,
},
};

return provider.addInteraction(interaction);
});
});

it("returns the correct response", (done) => {
Expand Down
82 changes: 44 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"main": "./pact.js",
"types": "./pact.d.ts",
"scripts": {
"build": "tsc",
"build": "npm run lint && npm run compile",
"compile": "tsc",
"clean": "rimraf docs dist dist-web coverage .nyc_output logs pacts jscpd.json",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"deploy:prepare": "./scripts/create_npmrc_file.sh",
"dist": "npm run build && webpack --config ./config/webpack.web.config.js",
"dist": "npm run compile && webpack --config ./config/webpack.web.config.js",
"jscpd": "jscpd -p src -r json -o jscpd.json",
"lint": "standard && tslint -c tslint.json 'src/**/*.ts'",
"postdist": "npm t",
"posttest": "npm run test:karma",
"predist": "npm run clean && npm run lint && npm run jscpd",
"prerelease": "npm i && rm package-lock.json",
"release": "standard-version",
"test": "nyc --check-coverage --reporter=html --reporter=text-summary mocha",
"test:examples": "npm run test:e2e-examples && npm run test:jest-examples && npm run test:mocha-examples && npm run test:ava-examples && npm run test:ts-examples",
Expand Down Expand Up @@ -46,22 +46,22 @@
"testing",
"consumer driven testing"
],
"author": "Beth Skurrie <beth@bethesque.com> (https://github.com/bethesque)",
"author": "Matt Fellows <m@onegeek.com.au> (http://twitter.com/matthewfellows)",
"contributors": [
{
"name": "Tarcio Saraiva",
"email": "tarcio@gmail.com",
"url": "http://twitter.com/tarciosaraiva"
},
{
"name": "Matt Fellows",
"email": "m@onegeek.com.au",
"url": "http://twitter.com/matthewfellows"
},
{
"name": "Michel Boudreau",
"email": "michelboudreau@gmail.com",
"url": "http://codinghitchhiker.com"
},
{
"name": "Beth Skurrie",
"email": "beth@bethesque.com",
"url": "https://github.com/bethesque"
}
],
"license": "MIT",
Expand All @@ -72,73 +72,79 @@
"standard": {
"parser": "babel-eslint",
"ignore": [
"config/**",
"test/**",
"dist/**",
"docs/**",
"examples/**"
"config/**/*",
"test/**/*",
"dist/**/*",
"docs/**/*",
"examples/**/*"
]
},
"dependencies": {
"@pact-foundation/pact-node": "^6.10.0",
"cli-color": "^1.1.0",
"es6-object-assign": "^1.1.0",
"es6-promise": "^4.1.1",
"lodash": "^4.17.4",
"lodash.isfunction": "3.0.8",
"lodash.isnil": "4.0.0",
"lodash.isundefined": "3.0.1",
"lodash.omitby": "4.6.0"
"lodash.omitby": "4.6.0",
"popsicle": "^9.2.0"
},
"devDependencies": {
"@pact-foundation/karma-pact": "2.x.x",
"@pact-foundation/karma-pact": "~2.1.5",
"@types/bluebird": "^3.5.20",
"@types/bunyan": "^1.8.3",
"@types/chai": "^4.0.3",
"@types/chai-as-promised": "0.0.31",
"@types/cli-color": "^0.3.29",
"@types/form-data": "^2.2.1",
"@types/lodash": "^4.14.73",
"@types/lodash.isnil": "^4.0.3",
"@types/mocha": "^2.2.41",
"@types/nock": "^9.1.2",
"@types/node": "^8.0.24",
"@types/proxyquire": "^1.3.27",
"@types/q": "^1.0.6",
"@types/request": "^2.0.8",
"@types/sinon": "^2.3.3",
"@types/sinon-chai": "^2.7.29",
"@types/superagent": "^3.5.7",
"@types/tough-cookie": "^2.3.2",
"@types/underscore": "^1.8.5",
"awesome-typescript-loader": "^3.2.3",
"babel-cli": "6.x",
"babel-eslint": "6.x",
"babel-cli": "~6.26.0",
"babel-eslint": "~8.2.1",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "6.x",
"bluebird": "3.x",
"chai": "3.x",
"chai-as-promised": "5.x",
"babel-preset-es2015": "^6.24.1",
"bluebird": "~3.5.1",
"chai": "~4.1.2",
"chai-as-promised": "^7.1.1",
"coveralls": "^2.13.3",
"enhanced-resolve": "^3.4.1",
"imports-loader": "0.x",
"istanbul": "0.4.x",
"jasmine-core": "2.x",
"imports-loader": "~0.7.1",
"istanbul": "~0.4.5",
"jasmine-core": "~2.9.1",
"jscpd": "0.6.10",
"json-loader": "0.5.x",
"karma": "1.x",
"karma-chai": "0.1.x",
"json-loader": "~0.5.7",
"karma": "~2.0.0",
"karma-chai": "~0.1.0",
"karma-jasmine": "^1.1.0",
"karma-mocha": "1.x",
"karma-phantomjs-launcher": "1.x",
"karma-mocha": "~1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"loader-utils": "^1.1.0",
"mocha": "3.x",
"mocha": "~5.0.0",
"mocha-lcov-reporter": "^1.3.0",
"nock": "8.x",
"nock": "^9.1.6",
"nyc": "^11.2.0",
"proxyquire": "1.x",
"rimraf": "2.x",
"proxyquire": "^1.8.0",
"rimraf": "^2.6.2",
"sinon": "^3.2.1",
"sinon-chai": "^2.13.0",
"source-map-loader": "^0.2.1",
"source-map-support": "^0.4.18",
"standard": "8.x",
"standard-version": "^4.2.0",
"superagent": "2.x",
"standard": "^11.0.0",
"standard-version": "^4.3.0",
"superagent": "^3.8.2",
"ts-node": "^3.3.0",
"tslint": "^5.8.0",
"typescript": "^2.4.2",
Expand Down
Loading

0 comments on commit 12f3622

Please sign in to comment.