Skip to content

Instantly share code, notes, and snippets.

@hedgerh
Last active April 6, 2017 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hedgerh/628457c95bb05bb56ab7550a659c5f41 to your computer and use it in GitHub Desktop.
Save hedgerh/628457c95bb05bb56ab7550a659c5f41 to your computer and use it in GitHub Desktop.
How to add easy cross-browser testing to your existing project

Here's an easy way to add easy cross-browser testing on your existing projects using browser-sync

1. install browser-sync

npm i browser-sync --save-dev

2. add an npm script to your package.json

"test:browser": "browser-sync start --config ./bs-config.js"

3. create a config bs-config.js in your project root

module.exports = {
    "proxy": "localhost:3000", // point to your app's address
    "port": 3002, // the port you'd like to use
    "browser": ["chrome", "firefox", "safari"] // specify what browsers you want to automatically open
};

Now when you run npm run test:browser, all of the specified browsers will open automatically, pointed to your site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment