File tree Expand file tree Collapse file tree 10 files changed +63
-11
lines changed Expand file tree Collapse file tree 10 files changed +63
-11
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "extends": ["airbnb-base", "prettier"]
2
+ "extends": ["airbnb-base", "prettier"],
3
+ "env": {
4
+ "browser": true,
5
+ "es6": true,
6
+ "node": true,
7
+ "jest": true
8
+ },
9
+ "rules": {
10
+ "import/prefer-default-export": "off"
11
+ }
3
12
}
Original file line number Diff line number Diff line change 4
4
"description" : " [![License][license-badge]][license-url]" ,
5
5
"main" : " lib/index.js" ,
6
6
"scripts" : {
7
- "clean" : " rimraf lib dist" ,
8
- "build" : " babel src --out-dir lib" ,
9
- "build:umd" : " NODE_ENV=production webpack src/index.js" ,
10
- "lint" : " eslint src" ,
11
- "test" : " jest" ,
12
- "prepublish" : " yarn lint && yarn test && yarn clean && yarn build && yarn build:umd"
7
+ "clean" : " rimraf dist" ,
8
+ "dev" : " NODE_ENV=dev webpack --progress --colors --watch" ,
9
+ "build" : " NODE_ENV=production webpack" ,
10
+ "lint" : " eslint src tests" ,
11
+ "test" : " jest --coverage --expand" ,
12
+ "test:watch" : " jest --watch" ,
13
+ "prepublish" : " yarn lint && yarn test && yarn clean && yarn build" ,
14
+ "coveralls" : " cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
13
15
},
14
16
"repository" : {
15
17
"type" : " git" ,
28
30
"@babel/preset-env" : " ^7.6.3" ,
29
31
"babel-jest" : " ^24.9.0" ,
30
32
"babel-loader" : " ^8.0.6" ,
33
+ "coveralls" : " ^3.0.7" ,
31
34
"eslint" : " ^6.5.1" ,
32
35
"eslint-config-airbnb-base" : " ^14.0.0" ,
33
36
"eslint-config-prettier" : " ^6.4.0" ,
Original file line number Diff line number Diff line change
1
+ export { default as isCreated } from './is-created' ;
2
+ export { default as isOk } from './is-ok' ;
Original file line number Diff line number Diff line change
1
+ function isCreated ( status ) {
2
+ return status === 201 ;
3
+ }
4
+
5
+ export default isCreated ;
Original file line number Diff line number Diff line change
1
+ function isOk ( status ) {
2
+ return status === 200 ;
3
+ }
4
+
5
+ export default isOk ;
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ import { isCreated } from '../src' ;
2
+
3
+ describe ( 'isCreated' , ( ) => {
4
+ test ( 'it should test isCreated status equal 201' , ( ) => {
5
+ expect ( isCreated ( 201 ) ) . toBeTruthy ( ) ;
6
+ } ) ;
7
+
8
+ test ( 'it should test isCreated status different then 200' , ( ) => {
9
+ expect ( isCreated ( 200 ) ) . toBeFalsy ( ) ;
10
+ } ) ;
11
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { isOk } from '../src' ;
2
+
3
+ describe ( 'isOk' , ( ) => {
4
+ test ( 'it should test isOk status equal 200' , ( ) => {
5
+ expect ( isOk ( 200 ) ) . toBeTruthy ( ) ;
6
+ } ) ;
7
+
8
+ test ( 'it should test isOk status different then 201' , ( ) => {
9
+ expect ( isOk ( 201 ) ) . toBeFalsy ( ) ;
10
+ } ) ;
11
+ } ) ;
Original file line number Diff line number Diff line change @@ -6,29 +6,35 @@ const mode = isProduction ? 'production' : 'development';
6
6
7
7
module . exports = {
8
8
mode,
9
+ devtool : 'source-map' ,
9
10
entry : {
10
- main : path . resolve ( __dirname , 'src/index.js' ) ,
11
+ app : path . resolve ( __dirname , 'src/index.js' )
11
12
} ,
12
13
output : {
13
14
path : path . resolve ( __dirname , 'dist' ) ,
14
15
filename : isProduction ? 'http-status.min.js' : 'http-status.js' ,
15
16
library : 'HttpStatus' ,
16
17
libraryTarget : 'umd' ,
18
+ umdNamedDefine : true
17
19
} ,
18
20
module : {
19
21
rules : [
20
22
{
21
23
test : / \. j s $ / ,
22
24
loader : 'babel-loader' ,
23
- exclude : / n o d e _ m o d u l e s / ,
25
+ exclude : / n o d e _ m o d u l e s /
24
26
}
25
27
]
26
28
} ,
27
29
optimization : {
28
30
minimize : isProduction ,
29
- minimizer : [ new UglifyJsPlugin ( ) ]
31
+ minimizer : [
32
+ new UglifyJsPlugin ( {
33
+ include : / \. m i n \. j s $ /
34
+ } )
35
+ ]
30
36
} ,
31
37
resolve : {
32
- extensions : [ " .js" ]
38
+ extensions : [ ' .js' ]
33
39
}
34
40
} ;
You can’t perform that action at this time.
0 commit comments