Skip to content

Commit

Permalink
Merge pull request #409 from chimurai/refactor-e2e-tests
Browse files Browse the repository at this point in the history
refactor(e2e): improve e2e tests
  • Loading branch information
chimurai authored Feb 26, 2020
2 parents 7fc07a7 + 000d3b2 commit 47608aa
Show file tree
Hide file tree
Showing 8 changed files with 881 additions and 739 deletions.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"lint:fix": "prettier --write \"**/*.{js,ts,md}\"",
"build": "tsc",
"pretest": "yarn build",
"test": "jest --runInBand",
"test": "jest",
"precover": "yarn clean && yarn build",
"cover": "jest --runInBand --coverage",
"cover": "jest --coverage",
"precoveralls": "yarn clean && yarn build",
"coveralls": "jest --runInBand --coverage --coverageReporters=text-lcov | coveralls",
"coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls",
"postcoveralls": "yarn clean",
"prepare": "yarn clean && yarn build"
},
Expand Down Expand Up @@ -58,15 +58,18 @@
"@types/lodash": "^4.14.149",
"@types/micromatch": "^4.0.1",
"@types/node": "^13.7.4",
"@types/supertest": "^2.0.8",
"browser-sync": "^2.26.7",
"connect": "^3.7.0",
"coveralls": "^3.0.5",
"express": "^4.17.1",
"husky": "^4.2.3",
"jest": "^25.1.0",
"lint-staged": "^10.0.7",
"mockttp": "^0.19.3",
"open": "^7.0.2",
"prettier": "^1.19.1",
"supertest": "^4.0.2",
"ts-jest": "^25.2.0",
"tslint": "^6.0.0",
"tslint-config-prettier": "^1.18.0",
Expand Down
18 changes: 8 additions & 10 deletions test/e2e/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ import * as express from 'express';

export { createProxyMiddleware } from '../../dist/index';

export function createServer(portNumber, middleware, path?) {
export function createApp(middleware) {
const app = express();
app.use(middleware);
return app;
}

if (middleware && path) {
app.use(path, middleware);
} else if (middleware) {
app.use(middleware);
}

const server = app.listen(portNumber);

return server;
export function createAppWithPath(path, middleware) {
const app = express();
app.use(path, middleware);
return app;
}
Loading

0 comments on commit 47608aa

Please sign in to comment.