File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+ name : Node.js CI
5+
6+ on :
7+ push :
8+ branches :
9+ - main
10+ - master
11+ pull_request :
12+ branches :
13+ - main
14+ - master
15+ schedule :
16+ - cron : ' 0 2 * * *'
17+
18+ jobs :
19+ build :
20+ runs-on : ${{ matrix.os }}
21+
22+ strategy :
23+ fail-fast : false
24+ matrix :
25+ node-version : [10, 12, 14, 16]
26+ os : [ubuntu-latest]
27+
28+ steps :
29+ - name : Checkout Git Source
30+ uses : actions/checkout@v2
31+
32+ - name : Use Node.js ${{ matrix.node-version }}
33+ uses : actions/setup-node@v1
34+ with :
35+ node-version : ${{ matrix.node-version }}
36+
37+ - name : Install Dependencies
38+ run : npm i -g npminstall && npminstall
39+
40+ - name : Continuous Integration
41+ run : npm run ci
42+
43+ - name : Code Coverage
44+ uses : codecov/codecov-action@v1
45+ with :
46+ token : ${{ secrets.CODECOV_TOKEN }}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11This software is licensed under the MIT License.
22
3- Copyright(c) 2013 - 2018 node-modules and other contributors.
3+ Copyright(c) 2013 - present node-modules and other contributors.
44
55Permission is hereby granted, free of charge, to any person obtaining a copy
66of this software and associated documentation files (the "Software"), to deal
Original file line number Diff line number Diff line change @@ -2,15 +2,12 @@ parameter
22=======
33
44[ ![ NPM version] [ npm-image ]] [ npm-url ]
5- [ ![ build status ] [ travis-image ]] [ travis-url ]
5+ [ ![ Node.js CI ] ( https://github.com/node-modules/parameter/actions/workflows/nodejs.yml/badge.svg )] ( https://github.com/node-modules/parameter/actions/workflows/nodejs.yml )
66[ ![ Test coverage] [ codecov-image ]] [ codecov-url ]
77[ ![ npm download] [ download-image ]] [ download-url ]
8- [ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square )] ( https://github.com/semantic-release/semantic-release )
98
109[ npm-image ] : https://img.shields.io/npm/v/parameter.svg?style=flat-square
1110[ npm-url ] : https://npmjs.org/package/parameter
12- [ travis-image ] : https://img.shields.io/travis/node-modules/parameter.svg?style=flat-square
13- [ travis-url ] : https://travis-ci.org/node-modules/parameter
1411[ codecov-image ] : https://codecov.io/github/node-modules/parameter/coverage.svg?branch=master
1512[ codecov-url ] : https://codecov.io/github/node-modules/parameter?branch=master
1613[ download-image ] : https://img.shields.io/npm/dm/parameter.svg?style=flat-square
@@ -240,13 +237,6 @@ If type is `array`, there has four addition rule:
240237}
241238```
242239
243- ### Release process
244-
245- We're using [ semantic-release] ( https://github.com/semantic-release/semantic-release ) to run npm publish
246- after every commit on master.
247-
248- See [ Default Commit Message Format] ( https://github.com/semantic-release/semantic-release#default-commit-message-format ) for details.
249-
250240## License
251241
252242[ MIT] ( LICENSE.txt )
Original file line number Diff line number Diff line change 99 " index.es5.js"
1010 ],
1111 "scripts" : {
12- "test" : " mocha -R spec -t 1000 test/*.test.js " ,
13- "cov" : " istanbul cover _mocha -- -t 1000 test/*.test.js " ,
12+ "test" : " egg-bin test" ,
13+ "cov" : " egg-bin cov " ,
1414 "ci" : " npm run cov" ,
1515 "build:es5" : " babel index.js --presets babel-preset-es2015 -o index.es5.js" ,
16- "prepublish" : " npm run build:es5" ,
17- "semantic-release" : " semantic-release pre && npm publish && semantic-release post"
16+ "prepublish" : " npm run build:es5"
1817 },
1918 "devDependencies" : {
2019 "babel-cli" : " ^6.26.0" ,
2120 "babel-preset-es2015" : " ^6.24.1" ,
2221 "beautify-benchmark" : " 0" ,
2322 "benchmark" : " *" ,
24- "istanbul" : " *" ,
25- "mocha" : " ^5.2.0" ,
26- "semantic-release" : " ^6.3.6" ,
23+ "egg-bin" : " ^4.19.0" ,
24+ "egg-ci" : " ^1.19.0" ,
2725 "should" : " *"
2826 },
2927 "repository" : {
3634 " univ"
3735 ],
3836 "engines" : {
39- "node" : " >= 4.0.0"
37+ "node" : " >= 10.0.0"
38+ },
39+ "ci" : {
40+ "type" : " github" ,
41+ "os" : {
42+ "github" : " linux"
43+ },
44+ "version" : " 10, 12, 14, 16"
4045 },
4146 "author" : " fengmk2 <fengmk2@gmail.com>" ,
4247 "license" : " MIT"
Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ var assert = require ( 'assert' ) ;
34var should = require ( 'should' ) ;
45var util = require ( 'util' ) ;
56var Parameter = require ( '..' ) ;
@@ -61,15 +62,17 @@ describe('parameter', () => {
6162
6263 describe ( 'validate' , ( ) => {
6364 it ( 'should throw error when received a non object' , ( ) => {
64- var value = null ;
65- var rule = { int : { type : 'int1' , required : false } } ;
66- let err ;
67- try {
68- parameter . validate ( rule , undefined )
69- } catch ( e ) {
70- err = e ;
71- }
72- should ( err . message ) . equal ( 'Cannot read property \'int\' of undefined' ) ;
65+ var value = null ;
66+ var rule = { int : { type : 'int1' , required : false } } ;
67+ let err ;
68+ try {
69+ parameter . validate ( rule , undefined )
70+ } catch ( e ) {
71+ err = e ;
72+ }
73+
74+ assert ( err . message === 'Cannot read property \'int\' of undefined' ||
75+ err . message === 'Cannot read properties of undefined (reading \'int\')' ) ;
7376 } ) ;
7477
7578 it ( 'should invalid type throw' , ( ) => {
You can’t perform that action at this time.
0 commit comments