This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from TrueCar/feature/SELA-301
SELA-301 Support Mocha without Karma as a test runner.
- Loading branch information
Showing
8 changed files
with
167 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"rules": { | ||
"comma-dangle": 0, | ||
"no-cond-assign": [2, "always"], | ||
"no-extra-boolean-cast": 0, | ||
|
||
"curly": 2, | ||
"default-case": 2, | ||
"eqeqeq": 2, | ||
"no-case-declarations": 2, | ||
"no-else-return": 2, | ||
"no-fallthrough": 2, | ||
"no-redeclare": 2, | ||
"no-warning-comments": [1, { "terms": ["todo"], "location": "start" }], | ||
|
||
"no-undef": 2, | ||
"no-undef-init": 2, | ||
"no-undefined": 2, | ||
"no-unused-vars": 2, | ||
|
||
"eol-last": 2, | ||
"indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": { "var": 2, "let": 2, "const": 3}}], | ||
"jsx-quotes": [2, "prefer-double"], | ||
"linebreak-style": [2, "unix"], | ||
"no-trailing-spaces": 1, | ||
"quotes": [2, "double"], | ||
"semi": [2, "always"], | ||
|
||
"no-var": 2, | ||
"prefer-const": 2, | ||
|
||
"react/display-name": 0 | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"browser": true | ||
}, | ||
"extends": ["eslint:recommended", "plugin:react/recommended"], | ||
"ecmaFeatures": { | ||
"jsx": true, | ||
"experimentalObjectRestSpread": true | ||
}, | ||
"plugins": [ | ||
"react" | ||
], | ||
"globals": { | ||
"document": true, | ||
"React": true, | ||
"ReactDOM": true, | ||
"window": true, | ||
"describe": true, | ||
"expect": true, | ||
"it": true, | ||
"TestUtils": true, | ||
"sinon": true, | ||
"beforeEach": true, | ||
"afterEach": true, | ||
"before": true, | ||
"after": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* global TEST_PATH */ | ||
/* global SRC_PATH */ | ||
require("./testHelperShared"); | ||
|
||
const context = require.context(TEST_PATH, true, /\.test\.js$/); | ||
context.keys().forEach(context); | ||
|
||
const srcContext = require.context(SRC_PATH, true, /\.js$/); | ||
srcContext.keys().forEach(srcContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* global global */ | ||
|
||
const CWD = process.cwd(); | ||
const IS_WINDOWS = process.platform === "win32"; | ||
|
||
// Because we have multiple resolves and an alias set up in Webpack, we need to modify require.main.paths at runtime to | ||
// deal with that without the use of a bundler. Unlike require.paths, this is documented and should be safe. However, | ||
// modifying it after anything has been require()d causes cache issues. | ||
// | ||
// Therefore: | ||
// **ACHTUNG** THIS SHOULD ALWAYS BE RUN BEFORE ANY OTHER REQUIRE()s. | ||
// | ||
// Cannot use path.join here since it would take a require()! | ||
require("app-module-path").addPath(CWD + (IS_WINDOWS ? "'" : "/") + "assets"); | ||
require("app-module-path").addPath(CWD + (IS_WINDOWS ? "'" : "/") + "src"); | ||
|
||
require("babel-register"); | ||
|
||
// Set up jsdom for component rendering through Enzyme. | ||
// This code is directly from Enzyme's docs. | ||
const jsdom = require("jsdom").jsdom; | ||
|
||
global.document = jsdom(""); | ||
global.window = document.defaultView; | ||
Object.keys(document.defaultView).forEach((property) => { | ||
if (typeof global[property] === "undefined") { | ||
global[property] = document.defaultView[property]; | ||
} | ||
}); | ||
|
||
global.navigator = { | ||
userAgent: "node.js" | ||
}; | ||
|
||
function noop() { | ||
return null; | ||
} | ||
|
||
// Note: require.extensions is deprecated, but is currently the only way to filter out require() of non-JS modules | ||
// without the expense and complication of a pre-compilation step. | ||
// | ||
// From the docs: | ||
// | ||
// "Since the Module system is locked, this feature will probably never go away. However, it may have subtle bugs | ||
// and complexities that are best left untouched." | ||
[".css", ".jpg", ".png", ".scss", ".svg"].forEach((extension) => { | ||
require.extensions[extension] = noop; | ||
}); | ||
|
||
require("./testHelperShared"); | ||
|
||
global.expect = require("chai").expect; | ||
global.sinon = require("sinon"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
/*global TEST_PATH*/ | ||
/*global SRC_PATH*/ | ||
require("babel-polyfill"); | ||
const React = require("react"); | ||
const ReactDOM = require("react-dom"); | ||
const ReactTestUtils = require("react-addons-test-utils"); | ||
global.React = React; | ||
global.ReactDOM = ReactDOM; | ||
global.TestUtils = ReactTestUtils; | ||
|
||
const context = require.context(TEST_PATH, true, /\.test\.js$/); | ||
context.keys().forEach(context); | ||
|
||
const srcContext = require.context(SRC_PATH, true, /\.js$/); | ||
srcContext.keys().forEach(srcContext); |