{"id":15252902,"url":"https://github.com/gr2m/frontend-test-setup","last_synced_at":"2025-10-16T20:58:39.571Z","repository":{"id":57114067,"uuid":"46231501","full_name":"gr2m/frontend-test-setup","owner":"gr2m","description":"reusable test setup for mocha, chai, browserify, webdriver, saucelabs \u0026 travis","archived":false,"fork":false,"pushed_at":"2021-03-05T06:40:37.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-22T13:23:47.251Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gr2m.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-15T19:05:05.000Z","updated_at":"2024-03-21T18:29:25.000Z","dependencies_parsed_at":"2022-08-22T09:10:24.693Z","dependency_job_id":null,"html_url":"https://github.com/gr2m/frontend-test-setup","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Ffrontend-test-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Ffrontend-test-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Ffrontend-test-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gr2m%2Ffrontend-test-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gr2m","download_url":"https://codeload.github.com/gr2m/frontend-test-setup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199079,"owners_count":21063641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-29T20:06:41.171Z","updated_at":"2025-10-16T20:58:34.512Z","avatar_url":"https://github.com/gr2m.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# frontend-test-setup\n\n\u003e reusable test setup for mocha, chai, browserify, webdriver, saucelabs \u0026 travis\n\n[![Build Status](https://travis-ci.org/gr2m/frontend-test-setup.svg?branch=master)](https://travis-ci.org/gr2m/frontend-test-setup)\n[![Dependency Status](https://david-dm.org/gr2m/frontend-test-setup.svg)](https://david-dm.org/gr2m/frontend-test-setup)\n[![devDependency Status](https://david-dm.org/gr2m/frontend-test-setup/dev-status.svg)](https://david-dm.org/gr2m/frontend-test-setup#info=devDependencies)\n\n## Install\n\n```\nnpm install --save @gr2m/frontend-test-setup\n```\n\n## Usage\n\nAdd a `\"frontend-test-setup\"` key to your package.json\n\n```js\n  \"frontend-test-setup\": {\n    \"server\": {\n      // path to static files\n      \"cwd\": \"demo\",\n      // browserify: path: module\n      \"browserify\": {\n        \"/bundle.js\": \"demo/vendor.js\",\n        \"/smartdate-input.js\": \"index.js\"\n      }\n    }\n    // see more options below\n  }\n```\n\nSet your scripts to\n\n```js\n  \"scripts\": {\n    \"start\": \"frontend-test-server\",\n    \"test\": \"frontend-test-background mocha test/*.js\",\n  }\n```\n\nReplace `mocha test/*.js` in `\"test\"` with whatever your mocha test command.\n\nYou must require `'@gr2m/frontend-test-setup'` in your tests\n\n```js\nrequire('@gr2m/frontend-test-setup')\n\ndescribe('my demo page', function () {\n  this.timeout(90000)\n\n  it('loads successfully', function () {\n    return this.client\n      .url('/')\n      .getTitle().should.eventually.equal('foo')\n  })\n})\n```\n\n`frontend-test-setup` plays nicely with [Travis](http://travis-ci.org/). If\nyou want to test using selenium, make sure to only test in Firefox as it's the\nonly supported browser, and add the following lines:\n\n```\nbefore_install:\n  - export DISPLAY=:99.0\n  - sh -e /etc/init.d/xvfb start\n```\n\nSet `SAUCELABS_USERNAME` \u0026 `SAUCELABS_ACCESS_KEY` as env variables, and test\nas many different browser configurations using the `env.matrix` setting, e.g.\n\n```\nenv:\n  matrix:\n  - CLIENT=selenium:firefox\n  - CLIENT=saucelabs:chrome\n  - CLIENT=\"saucelabs:internet explorer:10:Windows 8\"\n  - CLIENT=\"saucelabs:iphone:8.4:OS X 10.11\"\n```\n\n## Options\n\n`frontend-test-setup` can be configured in your `package.json`, simply\nadd a `\"frontend-test-setup\"` with the options below. Options with a `.`\ndelimiter are nested, e.g. `log.level` means log: {level: '...'}.\n\nAll settings in package.json can be overwritten using ENV variables, listed\nbelow the option name.\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eSetting (ENV)\u003c/th\u003e\n      \u003cth\u003eDefault / Example\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eclient\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eCLIENT\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        (saucelabs|selenium):browserName:browserVerion:platform,\n        e.g. 'saucelabs:internet explorer:10:win10'\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e'selenium:chrome'\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003etimeout\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eTIMEOUT\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        mocha test timeout in milli seconds\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e180000\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003elog.level\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eLOG_LEVEL\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        one of the following: \u003ccode\u003eerror\u003c/code\u003e, \u003ccode\u003ewarn\u003c/code\u003e,\n        \u003ccode\u003einfo\u003c/code\u003e, \u003ccode\u003everbose\u003c/code\u003e, \u003ccode\u003esilly\u003c/code\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e'error'\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eserver.host\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eSERVER_HOST\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        hostname for test server\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e'0.0.0.0'\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eserver.port\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eSERVER_HOST\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        port number for test server\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e8080\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eserver.cwd\u003c/strong\u003e\u003cbr\u003e\u003cbr\u003e\n\n        path from where to server static assets. If \u003ccode\u003eserver.cmd\u003c/code\u003e is\n        set, it runs the command in the given path (relative to repository’s root)\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e'.'\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eserver.browserify\u003c/strong\u003e\u003cbr\u003e\u003cbr\u003e\n\n        Map of assets to be browserified. The example below will browserify\n        \u003ccode\u003eindex.js\u003c/code\u003e and at\n        \u003ccode\u003ehttp://\u0026lt;server.host\u0026gt;:\u0026lt;server.port\u0026gt;/my-lib.js\u0026lt;/server\u0026gt;\u003c/code\u003e\n\n\u003cpre\u003e\n\"browserify\": {\n  \"/my-lib.js\": \"index.js\"\n}\n\u003c/pre\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e{}\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eserver.cmd\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eSERVER_CMD\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        Command to start custom server\n      \u003c/td\u003e\n      \u003ctd\u003ee.g. \u003ccode\u003e'npm start'\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eselenium.hub\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eSELENIUM_HUB\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        Url to selenium hub\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e'http://localhost:4444/wd/hub/status'\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003esaucelabs.username\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eSAUCELABS_USERNAME\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        Saucelabs username for authentication\n      \u003c/td\u003e\n      \u003ctd\u003ee.g. \u003ccode\u003e'pat'\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003esaucelabs.accessKey\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eSAUCELABS_ACCESS_KEY\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        Saucelabs access key for authentication\n      \u003c/td\u003e\n      \u003ctd\u003ee.g. \u003ccode\u003e'abcd5678-1234-1234-1234-abcd5678abcd'\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003esaucelabs.desiredCapabilities.idle-timeout\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eSAUCELABS_IDLE_TIMEOUT\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        \u003ca href=\"https://docs.saucelabs.com/reference/test-configuration/#idle-test-timeout\"\u003eSauceLabs Idle Test Timeout\u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e90\u003c/code\u003e, allowed maximum is \u003ccode\u003e1000\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003esaucelabs.desiredCapabilities.max-duration\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eSAUCELABS_MAX_DURATION\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        \u003ca href=\"https://docs.saucelabs.com/reference/test-configuration/#maximum-test-duration\"\u003eSauceLabs Maximum Test Duration\u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e1800\u003c/code\u003e, allowed maximum is \u003ccode\u003e10800\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003esaucelabs.desiredCapabilities.max-duration\u003c/strong\u003e\u003cbr\u003e\n        (\u003ccode\u003eSAUCELABS_COMMAND_TIMEOUT\u003c/code\u003e)\u003cbr\u003e\u003cbr\u003e\n\n        \u003ca href=\"https://docs.saucelabs.com/reference/test-configuration/#command-timeout\"\u003eSauceLabs Command Timeout\u003c/a\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e300\u003c/code\u003e, allowed maximum is \u003ccode\u003e600\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgr2m%2Ffrontend-test-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgr2m%2Ffrontend-test-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgr2m%2Ffrontend-test-setup/lists"}