Skip to content

Commit a60cb45

Browse files
committed
Add babel-cli babel-preset-env jest supertest superagent
As development dependencies for testing
1 parent 0ce52aa commit a60cb45

File tree

5 files changed

+2860
-70
lines changed

5 files changed

+2860
-70
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ node_js:
44
before_script:
55
- yarn
66
- yarn migrate:test
7-
script: yarn start
7+
script: yarn test
88
cache:
99
yarn: true
1010
directories:

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/g1/360__j9s4t1fghg_zlv8fq1c0000gn/T/jest_dx",
16+
17+
// Automatically clear mock calls and instances between every test
18+
clearMocks: true,
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: "about:blank",
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+
};

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"seed:undo": "sequelize db:migrate:undo:all",
1515
"start": "node index",
1616
"dev": "node-dev index",
17-
"test": "node test",
17+
"test": "jest",
1818
"lint": "eslint *.js",
1919
"precommit": "pretty-quick --staged",
2020
"migrate:production": "sequelize db:migrate --env production && sequelize db:seed:all --env production",
@@ -37,16 +37,19 @@
3737
"mysql2": "^1.6.1",
3838
"prettier": "^1.14.2",
3939
"pretty-quick": "^1.6.0",
40-
"sequelize": "^4.38.0",
41-
"supertest": "3.1.0"
40+
"sequelize": "^4.38.0"
4241
},
4342
"devDependencies": {
43+
"babel-cli": "6.26.0",
44+
"babel-preset-env": "1.7.0",
4445
"eslint": "^5.3.0",
4546
"eslint-config-prettier": "^2.9.0",
4647
"eslint-plugin-prettier": "^2.6.2",
4748
"heroku": "^7.7.8",
49+
"jest": "23.4.2",
4850
"node-dev": "^3.1.3",
4951
"prettier-eslint": "^8.8.2",
50-
"sequelize-cli": "^4.0.0"
52+
"sequelize-cli": "^4.0.0",
53+
"superagent": "3.8.3"
5154
}
5255
}
File renamed without changes.

0 commit comments

Comments
 (0)