Skip to content

Commit 432be86

Browse files
committed
Add test & linting rules
1 parent 21c5b74 commit 432be86

File tree

11 files changed

+7622
-338
lines changed

11 files changed

+7622
-338
lines changed

.eslintrc

Lines changed: 0 additions & 12 deletions
This file was deleted.

.eslintrc.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
parser: 'babel-eslint',
3+
extends: ['prettier/react', 'airbnb'],
4+
plugins: ['prettier', 'import'],
5+
env: {
6+
jest: true,
7+
},
8+
rules: {
9+
'arrow-parens': 0,
10+
'comma-dangle': 0,
11+
'function-paren-newline': 0, // let Prettier handle it
12+
'implicit-arrow-linebreak': 0, // let Prettier handle it
13+
'import/no-extraneous-dependencies': 0,
14+
'object-curly-newline': 0, // let Prettier handle it
15+
'no-underscore-dangle': 0,
16+
'react/jsx-filename-extension': 0,
17+
'react/destructuring-assignment': 0,
18+
},
19+
};

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: node_js
2+
node_js:
3+
- 11.6.0
4+
jobs:
5+
include:
6+
- stage: test
7+
name: 'Run Linters'
8+
script: npm run lint:js
9+
- stage: test
10+
name: 'Run tests'
11+
script: npm run test

jest.config.js

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
module.exports = {
5+
// All imported modules in your tests should be mocked automatically
6+
// automock: false,
7+
8+
// Stop running tests after the first failure
9+
// bail: false,
10+
11+
// Respect "browser" field in package.json when resolving modules
12+
// browser: false,
13+
14+
// The directory where Jest should store its cached dependency information
15+
// cacheDirectory: "/var/folders/cb/jmpdtwj56mj1fyyct_6rxqb00000gn/T/jest_dx",
16+
17+
// Automatically clear mock calls and instances between every test
18+
// clearMocks: false,
19+
20+
// Indicates whether the coverage information should be collected while executing the test
21+
// collectCoverage: false,
22+
23+
// An array of glob patterns indicating a set of files for which coverage information should be collected
24+
// collectCoverageFrom: null,
25+
26+
// The directory where Jest should output its coverage files
27+
// coverageDirectory: null,
28+
29+
// An array of regexp pattern strings used to skip coverage collection
30+
// coveragePathIgnorePatterns: [
31+
// "/node_modules/"
32+
// ],
33+
34+
// A list of reporter names that Jest uses when writing coverage reports
35+
// coverageReporters: [
36+
// "json",
37+
// "text",
38+
// "lcov",
39+
// "clover"
40+
// ],
41+
42+
// An object that configures minimum threshold enforcement for coverage results
43+
// coverageThreshold: null,
44+
45+
// Make calling deprecated APIs throw helpful error messages
46+
// errorOnDeprecated: false,
47+
48+
// Force coverage collection from ignored files usin a array of glob patterns
49+
// forceCoverageMatch: [],
50+
51+
// A path to a module which exports an async function that is triggered once before all test suites
52+
// globalSetup: null,
53+
54+
// A path to a module which exports an async function that is triggered once after all test suites
55+
// globalTeardown: null,
56+
57+
// A set of global variables that need to be available in all test environments
58+
// globals: {},
59+
60+
// An array of directory names to be searched recursively up from the requiring module's location
61+
// moduleDirectories: [
62+
// "node_modules"
63+
// ],
64+
65+
// An array of file extensions your modules use
66+
// moduleFileExtensions: [
67+
// "js",
68+
// "json",
69+
// "jsx",
70+
// "node"
71+
// ],
72+
73+
// A map from regular expressions to module names that allow to stub out resources with a single module
74+
// moduleNameMapper: {},
75+
76+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
77+
// modulePathIgnorePatterns: [],
78+
79+
// Activates notifications for test results
80+
// notify: false,
81+
82+
// An enum that specifies notification mode. Requires { notify: true }
83+
// notifyMode: "always",
84+
85+
// A preset that is used as a base for Jest's configuration
86+
// preset: null,
87+
88+
// Run tests from one or more projects
89+
// projects: null,
90+
91+
// Use this configuration option to add custom reporters to Jest
92+
// reporters: undefined,
93+
94+
// Automatically reset mock state between every test
95+
// resetMocks: false,
96+
97+
// Reset the module registry before running each individual test
98+
// resetModules: false,
99+
100+
// A path to a custom resolver
101+
// resolver: null,
102+
103+
// Automatically restore mock state between every test
104+
// restoreMocks: false,
105+
106+
// The root directory that Jest should scan for tests and modules within
107+
// rootDir: null,
108+
109+
// A list of paths to directories that Jest should use to search for files in
110+
// roots: [
111+
// "<rootDir>"
112+
// ],
113+
114+
// Allows you to use a custom runner instead of Jest's default test runner
115+
// runner: "jest-runner",
116+
117+
// The paths to modules that run some code to configure or set up the testing environment before each test
118+
// setupFiles: [],
119+
120+
// The path to a module that runs some code to configure or set up the testing framework before each test
121+
// setupTestFrameworkScriptFile: null,
122+
123+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
124+
// snapshotSerializers: [],
125+
126+
// The test environment that will be used for testing
127+
testEnvironment: "node",
128+
129+
// Options that will be passed to the testEnvironment
130+
// testEnvironmentOptions: {},
131+
132+
// Adds a location field to test results
133+
// testLocationInResults: false,
134+
135+
// The glob patterns Jest uses to detect test files
136+
// testMatch: [
137+
// "**/__tests__/**/*.js?(x)",
138+
// "**/?(*.)+(spec|test).js?(x)"
139+
// ],
140+
141+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
142+
// testPathIgnorePatterns: [
143+
// "/node_modules/"
144+
// ],
145+
146+
// The regexp pattern Jest uses to detect test files
147+
// testRegex: "",
148+
149+
// This option allows the use of a custom results processor
150+
// testResultsProcessor: null,
151+
152+
// This option allows use of a custom test runner
153+
// testRunner: "jasmine2",
154+
155+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
156+
// testURL: "http://localhost",
157+
158+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
159+
// timers: "real",
160+
161+
// A map from regular expressions to paths to transformers
162+
// transform: null,
163+
164+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
165+
// transformIgnorePatterns: [
166+
// "/node_modules/"
167+
// ],
168+
169+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
170+
// unmockedModulePathPatterns: undefined,
171+
172+
// Indicates whether each individual test should be reported during the run
173+
// verbose: null,
174+
175+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
176+
// watchPathIgnorePatterns: [],
177+
178+
// Whether to use watchman for file crawling
179+
// watchman: true,
180+
};

0 commit comments

Comments
 (0)