diff --git a/backstop.config.js b/backstop.config.js index aba2902..c15a464 100644 --- a/backstop.config.js +++ b/backstop.config.js @@ -1,5 +1,9 @@ const request = require('sync-request'); const queryString = require('query-string'); +const minimist = require('minimist'); + +const args = minimist(process.argv); +const port = args.port || 6006; /** * Create URL to stories. @@ -10,10 +14,10 @@ const queryString = require('query-string'); const createUrl = ({ kind: selectedKind, name: selectedStory }) => { const query = queryString.stringify({ selectedKind, selectedStory }); - return `http://localhost:6006/iframe.html?${query}`; + return `http://localhost:${port}/iframe.html?${query}`; }; // @ts-ignore -const body = request('GET', 'http://localhost:6006/toc.json').getBody(); +const body = request('GET', `http://localhost:${port}/toc.json`).getBody(); const scenarios = [...JSON.parse(body)].map(row => ({ label: JSON.stringify(row), misMatchThreshold: 0.01, diff --git a/package-lock.json b/package-lock.json index 7040aa5..feaf1c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1883,6 +1883,12 @@ "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", "dev": true }, + "@types/minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=", + "dev": true + }, "@types/mkdirp": { "version": "0.3.29", "resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.3.29.tgz", diff --git a/package.json b/package.json index 67bcebb..bd5096a 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@types/enzyme-adapter-react-16": "^1.0.5", "@types/eslint": "^4.16.6", "@types/jest": "^24.0.9", + "@types/minimist": "^1.2.0", "@types/node-fetch": "^2.1.6", "@types/react": "^16.8.3", "@types/react-dom": "^16.8.2", @@ -80,6 +81,7 @@ "husky": "^1.3.1", "jest": "^24.1.0", "lint-staged": "^8.1.5", + "minimist": "^1.2.0", "node-fetch": "^2.3.0", "npm-run-all": "^4.1.5", "prettier": "^1.16.4",