Permalink
Browse files

Enable ES2015 for Chimp code

  • Loading branch information...
Sanjo committed Jan 27, 2016
1 parent dd5cb05 commit 748861292b852f4ec56982e51a0d2f6edeec5854
Showing with 479 additions and 406 deletions.
  1. +4 −0 .babelrc
  2. +1 −0 .eslintignore
  3. +11 −0 .eslintrc
  4. +7 −4 .gitignore
  5. +8 −0 .npmignore
  6. +3 −3 circle.yml
  7. +1 −0 index.js
  8. +24 −4 package.json
  9. 0 {.scripts → scripts}/download-chrome.sh
  10. 0 {.scripts → scripts}/download-meteor.sh
  11. +1 −1 {.scripts → scripts}/prepend-history.sh
  12. +5 −0 scripts/prepublish.sh
  13. 0 {.scripts → scripts}/publish.sh
  14. 0 {.scripts → scripts}/release-notes.ejs
  15. 0 {.scripts → scripts}/run-tests.sh
  16. 0 { → src}/__mocks__/bluebird.js
  17. 0 { → src}/__mocks__/chokidar.js
  18. 0 { → src}/__mocks__/colors.js
  19. 0 { → src}/__mocks__/ddp.js
  20. 0 { → src}/__mocks__/freeport.js
  21. 0 { → src}/__mocks__/hapi.js
  22. 0 { → src}/__mocks__/request.js
  23. 0 { → src}/__mocks__/selenium-standalone.js
  24. 0 { → src}/__mocks__/webdriverio.js
  25. 0 { → src}/__mocks__/xolvio-sync-webdriverio.js
  26. +20 −20 { → src}/__tests__/browserstack-manager-spec.js
  27. 0 { → src}/__tests__/chimp-spec.js
  28. 0 { → src}/__tests__/ddp-spec.js
  29. +3 −3 { → src}/__tests__/phantom-spec.js
  30. 0 { → src}/__tests__/process-helper-spec.js
  31. +19 −19 { → src}/__tests__/saucelabs-manager-spec.js
  32. 0 { → src}/__tests__/selenium-spec.js
  33. +54 −54 { → src}/__tests__/session-factory-spec.js
  34. +3 −2 { → src}/__tests__/session-manager-spec.js
  35. 0 { → src}/__tests__/simian-reporter-spec.js
  36. 0 { → src}/__tests__/world-spec.js
  37. 0 { → src}/bin/chimp
  38. +124 −124 { → src}/lib/browserstack-manager.js
  39. 0 { → src}/lib/chimp-helper.js
  40. 0 { → src}/lib/chimp.js
  41. 0 { → src}/lib/consoler.js
  42. 0 { → src}/lib/cucumberjs/cucumber-wrapper.js
  43. 0 { → src}/lib/cucumberjs/cucumber.js
  44. 0 { → src}/lib/cucumberjs/hooks.js
  45. 0 { → src}/lib/cucumberjs/world.js
  46. 0 { → src}/lib/ddp-watcher.js
  47. 0 { → src}/lib/ddp.js
  48. 0 { → src}/lib/log.js
  49. 0 { → src}/lib/mocha/mocha-fiberized-ui.js
  50. 0 { → src}/lib/mocha/mocha-helper.js
  51. 0 { → src}/lib/mocha/mocha-wrapper.js
  52. 0 { → src}/lib/mocha/mocha.js
  53. 0 { → src}/lib/phantom.js
  54. 0 { → src}/lib/process-helper.js
  55. +116 −116 { → src}/lib/saucelabs-manager.js
  56. 0 { → src}/lib/selenium.js
  57. +48 −48 { → src}/lib/session-factory.js
  58. 0 { → src}/lib/session-manager.js
  59. 0 { → src}/lib/simian-reporter.js
  60. +27 −8 wallaby.js
View
@@ -0,0 +1,4 @@
+{
+ "plugins": ["transform-runtime"],
+ "presets": ["es2015", "stage-2"]
+}
View
@@ -0,0 +1 @@
+node_modules
View
@@ -0,0 +1,11 @@
+{
+ "extends": "airbnb/base",
+ "env": {
+ "node": true,
+ "es6": true
+ },
+ "rules": {
+ "object-curly-spacing": 0,
+ "no-use-before-define": [2, "nofunc"]
+ }
+}
View
@@ -1,6 +1,9 @@
+*.swp
+*~
+*.iml
+.*.haste_cache.*
+.DS_Store
.idea
-tmp
-node_modules
npm-debug.log
-.build*
-meteor/test-app/tests/cucumber/.screenshots
+node_modules
+dist
View
@@ -0,0 +1,8 @@
+*.swp
+*~
+*.iml
+.*.haste_cache.*
+.DS_Store
+.idea
+npm-debug.log
+src
View
@@ -18,10 +18,10 @@ dependencies:
override:
# Cache Chrome
- - ./.scripts/download-chrome.sh
+ - ./scripts/download-chrome.sh
# Cache Metoer
- - ./.scripts/download-meteor.sh
+ - ./scripts/download-meteor.sh
# Cache npm deps
- npm install
@@ -31,4 +31,4 @@ dependencies:
test:
override:
- - npm test
+ - npm testonly
View
@@ -0,0 +1 @@
+module.exports = require('./dist/index');
View
@@ -26,21 +26,31 @@
"url": "https://github.com/xolvio/chimp/issues"
},
"scripts": {
- "test": "./.scripts/run-tests.sh"
+ "prepublish": ". ./scripts/prepublish.sh",
+ "lint": "eslint ./src",
+ "lintfix": "eslint ./src --fix",
+ "testonly": ". ./scripts/run-tests.sh",
+ "test": "npm run lint && npm run testonly"
},
- "main": "lib/chimp.js",
+ "main": "index.js",
"bin": {
- "chimp": "./bin/chimp"
+ "chimp": "./src/bin/chimp"
},
"jest": {
+ "scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"moduleFileExtensions": [
"js",
"json",
"node"
+ ],
+ "unmockedModulePathPatterns": [
+ "core-js/.*",
+ "babel-runtime/.*"
]
},
"dependencies": {
"async": "~0.9.0",
+ "babel-runtime": "6.x.x",
"bluebird": "^2.9.33",
"chai": "~3.0.0",
"chai-as-promised": "~5.1.0",
@@ -71,6 +81,16 @@
"xolvio-sync-webdriverio": "^4.0.5"
},
"devDependencies": {
- "jest-cli": "^0.5.7"
+ "babel-cli": "6.x.x",
+ "babel-core": "6.x.x",
+ "babel-jest": "^6.0.1",
+ "babel-plugin-transform-runtime": "6.x.x",
+ "babel-polyfill": "^6.3.14",
+ "babel-preset-es2015": "6.x.x",
+ "babel-preset-stage-2": "6.x.x",
+ "eslint": "^1.10.3",
+ "eslint-config-airbnb": "^2.1.1",
+ "eslint-plugin-babel": "^3.0.0",
+ "jest-cli": "Sanjo/jest#cd70a26d"
}
}
File renamed without changes.
File renamed without changes.
@@ -4,7 +4,7 @@
# npm install -g git-release-notes
echo "# vNext" > tempHistory.md
-git-release-notes $1..master ./.scripts/release-notes.ejs >> ./tempHistory.md
+git-release-notes $1..master ./scripts/release-notes.ejs >> ./tempHistory.md
cat ./HISTORY.md >> ./tempHistory.md
cat ./tempHistory.md > ./HISTORY.md
rm ./tempHistory.md
View
@@ -0,0 +1,5 @@
+echo "> Start transpiling ES2015"
+echo ""
+./node_modules/.bin/babel src --ignore spec --out-dir ./dist
+echo ""
+echo "> Complete transpiling ES2015"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,20 +1,20 @@
-jest.dontMock('../lib/browserstack-manager');
-
-describe('BrowserStack Session Manager', function () {
-
- describe('Constructor', function () {
-
- it('sets the browserStackUrl', function () {
- var BrowserStackManager = require('../lib/browserstack-manager');
- var options = {port: 1234, browser: 'something', user: 'testus3r', key: '12345678', host: 'browserstack.com'};
-
- var browserStackBaseUrl = 'https://' + options.user + ':' + options.key + '@' + options.host;
-
- var session = new BrowserStackManager(options);
-
- expect(session.options.browserStackUrl).toBe(browserStackBaseUrl);
- });
-
- });
-
-});
+jest.dontMock('../lib/browserstack-manager');
+
+describe('BrowserStack Session Manager', function () {
+
+ describe('Constructor', function () {
+
+ it('sets the browserStackUrl', function () {
+ var BrowserStackManager = require('../lib/browserstack-manager');
+ var options = {port: 1234, browser: 'something', user: 'testus3r', key: '12345678', host: 'browserstack.com'};
+
+ var browserStackBaseUrl = 'https://' + options.user + ':' + options.key + '@' + options.host;
+
+ var session = new BrowserStackManager(options);
+
+ expect(session.options.browserStackUrl).toBe(browserStackBaseUrl);
+ });
+
+ });
+
+});
File renamed without changes.
File renamed without changes.
@@ -116,7 +116,7 @@ describe('Phantom', function () {
describe('stop', function () {
- describe('kills the phantom child when phantom is running and sets the child to null', function () {
+ it('kills the phantom child when phantom is running and sets the child to null', function () {
var processHelper = require('../lib/process-helper');
var Phantom = require('../lib/phantom');
@@ -138,7 +138,7 @@ describe('Phantom', function () {
});
- describe('calls the callback immediately when phantom is not running', function () {
+ it('calls the callback immediately when phantom is not running', function () {
var processHelper = require('../lib/process-helper');
var Phantom = require('../lib/phantom');
@@ -158,7 +158,7 @@ describe('Phantom', function () {
});
- describe('calls the callback with an error if an error is encountered', function () {
+ it('calls the callback with an error if an error is encountered', function () {
var processHelper = require('../lib/process-helper');
var Phantom = require('../lib/phantom');
@@ -1,20 +1,20 @@
-jest.dontMock('../lib/saucelabs-manager');
-
-describe('SauceLabs Session Manager', function () {
-
- describe('Constructor', function () {
-
- it('sets the SauceLabsUrl', function () {
- var SauceLabsManager = require('../lib/saucelabs-manager');
- var options = {port: 1234, browser: 'something', user: 'testus3r', key: '12345678', host: 'saucelabs.com'};
-
- var sauceLabsBaseUrl = 'https://' + options.user + ':' + options.key + '@' + options.host + '/rest/v1/' + options.user;
-
- var session = new SauceLabsManager(options);
-
- expect(session.options.sauceLabsUrl).toBe(sauceLabsBaseUrl);
- });
-
- });
-
+jest.dontMock('../lib/saucelabs-manager');
+
+describe('SauceLabs Session Manager', function () {
+
+ describe('Constructor', function () {
+
+ it('sets the SauceLabsUrl', function () {
+ var SauceLabsManager = require('../lib/saucelabs-manager');
+ var options = {port: 1234, browser: 'something', user: 'testus3r', key: '12345678', host: 'saucelabs.com'};
+
+ var sauceLabsBaseUrl = 'https://' + options.user + ':' + options.key + '@' + options.host + '/rest/v1/' + options.user;
+
+ var session = new SauceLabsManager(options);
+
+ expect(session.options.sauceLabsUrl).toBe(sauceLabsBaseUrl);
+ });
+
+ });
+
});
File renamed without changes.
@@ -1,54 +1,54 @@
-jest.dontMock('../lib/session-factory');
-jest.dontMock('../lib/session-manager');
-
-describe('Session Factory', function () {
-
- describe('Constructor', function () {
-
- it('sets the options on the instance when no exceptions are thrown', function () {
- var SessionFactory = require('../lib/session-factory');
- var options = {port: 1234, browser: 'something'};
-
- var session = new SessionFactory(options);
-
- expect(session.options).toBe(options);
- });
-
- it('throws when options is not passed', function () {
- var SessionFactory = require('../lib/session-factory');
- var session = function () {
- new SessionFactory();
- };
- expect(session).toThrow('options is required');
- });
-
- it('throws when options.port is not passed', function () {
- var SessionFactory = require('../lib/session-factory');
- var options = {};
- var session = function () {
- new SessionFactory({});
- };
- expect(session).toThrow('options.port is required');
- });
-
- it('throws when options.browser and options.device is not passed', function () {
- var SessionFactory = require('../lib/session-factory');
- var options = {port: 1234};
- var session = function () {
- new SessionFactory(options);
- };
- expect(session).toThrow('[chimp][session-manager-factory] options.browser or options.deviceName is required');
- });
-
- it('throws when options.user and options.key is not passed and not using localhost', function () {
- var SessionFactory = require('../lib/session-factory');
- var options = {port: 1234, browser: 'firefox', host: 'browserstack.com'};
- var session = function () {
- new SessionFactory(options);
- };
- expect(session).toThrow('[chimp][session-manager-factory] options.user and options.key are required');
- });
-
- });
-
-});
+jest.dontMock('../lib/session-factory');
+jest.dontMock('../lib/session-manager');
+
+describe('Session Factory', function () {
+
+ describe('Constructor', function () {
+
+ it('sets the options on the instance when no exceptions are thrown', function () {
+ var SessionFactory = require('../lib/session-factory');
+ var options = {port: 1234, browser: 'something'};
+
+ var session = new SessionFactory(options);
+
+ expect(session.options).toBe(options);
+ });
+
+ it('throws when options is not passed', function () {
+ var SessionFactory = require('../lib/session-factory');
+ var session = function () {
+ new SessionFactory();
+ };
+ expect(session).toThrow('options is required');
+ });
+
+ it('throws when options.port is not passed', function () {
+ var SessionFactory = require('../lib/session-factory');
+ var options = {};
+ var session = function () {
+ new SessionFactory({});
+ };
+ expect(session).toThrow('options.port is required');
+ });
+
+ it('throws when options.browser and options.device is not passed', function () {
+ var SessionFactory = require('../lib/session-factory');
+ var options = {port: 1234};
+ var session = function () {
+ new SessionFactory(options);
+ };
+ expect(session).toThrow('[chimp][session-manager-factory] options.browser or options.deviceName is required');
+ });
+
+ it('throws when options.user and options.key is not passed and not using localhost', function () {
+ var SessionFactory = require('../lib/session-factory');
+ var options = {port: 1234, browser: 'firefox', host: 'browserstack.com'};
+ var session = function () {
+ new SessionFactory(options);
+ };
+ expect(session).toThrow('[chimp][session-manager-factory] options.user and options.key are required');
+ });
+
+ });
+
+});
@@ -64,7 +64,8 @@ describe('Session Manager', function () {
var wd = require('xolvio-sync-webdriverio');
var SessionManager = require('../lib/session-manager');
- wd.remote = jest.genMockFn().mockReturnValue('return from remote');
+ var browser = {};
+ wd.remote = jest.genMockFn().mockReturnValue(browser);
var sessionManager = new SessionManager({port: 1234, browser: 'something'});
@@ -80,7 +81,7 @@ describe('Session Manager', function () {
var callback = jest.genMockFn();
sessionManager.remote(options, callback);
- expect(callback.mock.calls[0][1]).toBe('return from remote');
+ expect(callback.mock.calls[0][1]).toBe(browser);
expect(wd.remote.mock.calls.length).toBe(1);
expect(wd.remote.mock.calls[0][0]).toBe(options);
File renamed without changes.
File renamed without changes.
Oops, something went wrong.

0 comments on commit 7488612

Please sign in to comment.