-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* dev-deps: jest, jscodeshift, jest-codemods * jest configuration * Example jest test * Remove mocha and istanbul in favour of jest
- Loading branch information
Showing
6 changed files
with
1,666 additions
and
328 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,87 @@ | ||
module.exports = { | ||
// Modules can be explicitly auto-mocked using jest.mock(moduleName). | ||
// https://facebook.github.io/jest/docs/en/configuration.html#automock-boolean | ||
automock: false, // [boolean] | ||
|
||
// Respect Browserify's "browser" field in package.json when resolving modules. | ||
// https://facebook.github.io/jest/docs/en/configuration.html#browser-boolean | ||
browser: false, // [boolean] | ||
|
||
// This config option can be used here to have Jest stop running tests after the first failure. | ||
// https://facebook.github.io/jest/docs/en/configuration.html#bail-boolean | ||
bail: false, // [boolean] | ||
|
||
// The directory where Jest should store its cached dependency information. | ||
// https://facebook.github.io/jest/docs/en/configuration.html#cachedirectory-string | ||
// cacheDirectory: '/tmp/<path>', // [string] | ||
|
||
// Indicates whether the coverage information should be collected while executing the test. | ||
// Because this retrofits all executed files with coverage collection statements, | ||
// it may significantly slow down your tests. | ||
// https://facebook.github.io/jest/docs/en/configuration.html#collectcoverage-boolean | ||
// collectCoverage: false, // [boolean] | ||
|
||
// https://facebook.github.io/jest/docs/en/configuration.html#collectcoveragefrom-array | ||
collectCoverageFrom: ['src/**/*.{js,jsx}', '!**/node_modules/**', '!**/vendor/**'], | ||
|
||
// https://facebook.github.io/jest/docs/en/configuration.html#coveragedirectory-string | ||
coverageDirectory: '<rootDir>/coverage', // [string] | ||
|
||
// coveragePathIgnorePatterns: // [array<string>] | ||
// coverageReporters: [], // [array<string>] | ||
// coverageThreshold: {}, // [object] | ||
|
||
globals: { | ||
__DEV__: true, | ||
}, | ||
|
||
// https://facebook.github.io/jest/docs/en/configuration.html#mapcoverage-boolean | ||
// mapCoverage: false, // [boolean] | ||
|
||
// The default extensions Jest will look for. | ||
// https://facebook.github.io/jest/docs/en/configuration.html#modulefileextensions-array-string | ||
moduleFileExtensions: ['js', 'json', 'jsx', 'node'], | ||
|
||
// moduleDirectories: // [array<string>] | ||
|
||
// A map from regular expressions to module names that allow to stub out resources, | ||
// like images or styles with a single module. | ||
moduleNameMapper: { | ||
'\\.(css|less|scss|sss)$': 'identity-obj-proxy', | ||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'GlobalImageStub', | ||
}, | ||
|
||
// modulePathIgnorePatterns: // [array<string>] | ||
// modulePaths: // [array<string>] | ||
// notify: false, // [boolean] | ||
// preset: // [string] | ||
// projects: // [array<string>] | ||
// clearMocks: // [boolean] | ||
// reporters: // [array<moduleName | [moduleName, options]>] | ||
// resetMocks: // [boolean] | ||
// resetModules: // [boolean] | ||
// resolver: // [string] | ||
// rootDir: // [string] | ||
// roots: // [array<string>] | ||
// setupFiles: // [array] | ||
// setupTestFrameworkScriptFile: // [string] | ||
// snapshotSerializers: // [array<string>] | ||
// testEnvironment: // [string] | ||
// testMatch: // [array<string>] | ||
// testPathIgnorePatterns: // [array<string>] | ||
// testRegex: // [string] | ||
// testResultsProcessor: // [string] | ||
// testRunner: // [string] | ||
// testURL: // [string] | ||
// timers: // [string] | ||
|
||
transform: { | ||
'\\.jsx?$': 'babel-jest', | ||
'\\.(jpe?g|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/jest/fileTransformer.js', | ||
}, | ||
|
||
// transformIgnorePatterns: // [array<string>] | ||
// unmockedModulePathPatterns: // [array<string>] | ||
|
||
verbose: true, // [boolean] | ||
}; |
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,7 @@ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
process(src, filename) { | ||
return `module.exports = ${JSON.stringify(path.basename(filename))};`; | ||
}, | ||
}; |
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
178 changes: 178 additions & 0 deletions
178
src/components/Layout/__snapshots__/Layout.test.js.snap
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,178 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Layout renders children correctly 1`] = ` | ||
<div> | ||
<div | ||
className="root" | ||
> | ||
<div | ||
className="container" | ||
> | ||
<div | ||
className="root" | ||
role="navigation" | ||
> | ||
<a | ||
className="link" | ||
href="/about" | ||
onClick={[Function]} | ||
> | ||
About | ||
</a> | ||
<a | ||
className="link" | ||
href="/contact" | ||
onClick={[Function]} | ||
> | ||
Contact | ||
</a> | ||
<span | ||
className="spacer" | ||
> | ||
| | ||
</span> | ||
<a | ||
className="link" | ||
href="/login" | ||
onClick={[Function]} | ||
> | ||
Log in | ||
</a> | ||
<span | ||
className="spacer" | ||
> | ||
or | ||
</span> | ||
<a | ||
className="link highlight" | ||
href="/register" | ||
onClick={[Function]} | ||
> | ||
Sign up | ||
</a> | ||
</div> | ||
<a | ||
className="brand" | ||
href="/" | ||
onClick={[Function]} | ||
> | ||
<img | ||
alt="React" | ||
height="38" | ||
src="logo-small.png" | ||
srcSet="[email protected] 2x" | ||
width="38" | ||
/> | ||
<span | ||
className="brandTxt" | ||
> | ||
Your Company | ||
</span> | ||
</a> | ||
<div | ||
className="banner" | ||
> | ||
<h1 | ||
className="bannerTitle" | ||
> | ||
React | ||
</h1> | ||
<p | ||
className="bannerDesc" | ||
> | ||
Complex web apps made easy | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div | ||
className="child" | ||
/> | ||
<div | ||
className="root" | ||
> | ||
<div | ||
className="container" | ||
> | ||
<a | ||
className="link" | ||
href="https://gitter.im/kriasoft/react-starter-kit" | ||
> | ||
Ask a question | ||
</a> | ||
<span | ||
className="spacer" | ||
> | ||
| | ||
</span> | ||
<a | ||
className="link" | ||
href="https://github.com/kriasoft/react-starter-kit/issues/new" | ||
> | ||
Report an issue | ||
</a> | ||
</div> | ||
</div> | ||
<div | ||
className="root" | ||
> | ||
<div | ||
className="container" | ||
> | ||
<span | ||
className="text" | ||
> | ||
© Your Company | ||
</span> | ||
<span | ||
className="spacer" | ||
> | ||
· | ||
</span> | ||
<a | ||
className="link" | ||
href="/" | ||
onClick={[Function]} | ||
> | ||
Home | ||
</a> | ||
<span | ||
className="spacer" | ||
> | ||
· | ||
</span> | ||
<a | ||
className="link" | ||
href="/admin" | ||
onClick={[Function]} | ||
> | ||
Admin | ||
</a> | ||
<span | ||
className="spacer" | ||
> | ||
· | ||
</span> | ||
<a | ||
className="link" | ||
href="/privacy" | ||
onClick={[Function]} | ||
> | ||
Privacy | ||
</a> | ||
<span | ||
className="spacer" | ||
> | ||
· | ||
</span> | ||
<a | ||
className="link" | ||
href="/not-found" | ||
onClick={[Function]} | ||
> | ||
Not Found | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
`; |
Oops, something went wrong.