Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
BackstopJS testing can be performed on any port
Browse files Browse the repository at this point in the history
  • Loading branch information
kurone-kito committed Mar 11, 2019
1 parent 7113de8 commit 9b6b555
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 6 additions & 2 deletions backstop.config.js
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 9b6b555

Please sign in to comment.