Skip to content

Commit

Permalink
fix: 更新依赖,更新测试断言工具
Browse files Browse the repository at this point in the history
  • Loading branch information
TabSpace committed Jul 23, 2020
1 parent d1a0e57 commit c0d2965
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ root = true
[*]
charset = utf-8
indent_style = tab
indent_size = 4
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
Expand Down
7 changes: 4 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
sourceType: 'module'
},
env: {
mocha: true,
es6: true,
browser: true,
node: true,
Expand Down Expand Up @@ -38,9 +39,9 @@ module.exports = {
'no-console': 0,
// 不在 else 中 return
'no-else-return': 0,
// 用什么来缩进,规定使用tab 来进行缩进,switch中case也需要一个tab .
'indent': [2, 'tab', { 'SwitchCase': 1 }],
// 对于回调类型函数,不必坚持 return
// 用什么来缩进,规定使用tab 来进行缩进,switch中case也需要一个tab .
'indent': [2, 'tab', { 'SwitchCase': 1 }],
// 对于回调类型函数,不必坚持 return
'consistent-return': 0,
// 不推荐解构赋值
'prefer-destructuring': 0,
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js

node_js:
- 8
- 12

cache:
yarn: true
Expand Down
8 changes: 3 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const $fs = require('fs');
const $path = require('path');
const $gulp = require('gulp');
const $gulpMocha = require('gulp-mocha');
const $runSequence = require('run-sequence');

const $upload = require('./index');
const $config = require('./test/config');
Expand Down Expand Up @@ -50,14 +49,13 @@ $gulp.task(
.pipe($gulpMocha())
);

$gulp.task('test', () => $runSequence(
$gulp.task('test', $gulp.series(
'prepare',
'upload',
'upload-withBase',
'mocha'
));

$gulp.task('default', [
$gulp.task('default', $gulp.series(
'test'
]);

));
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ const requestParam = {
const upload = options => {
options = options || {};

let conf = Object.assign({
let conf = {
prefix: '',
debug: false,
log: true,
overwrite: false
}, requestParam, options);
overwrite: false,
...requestParam,
...options
};

let nTotal = 0;
let nSkip = 0;
Expand Down Expand Up @@ -74,7 +76,7 @@ const upload = options => {

nTotal++;

let spec = Object.assign({}, conf);
let spec = { ...conf };
spec.FilePath = file.path;
spec.Key = uploadPath;

Expand Down Expand Up @@ -111,4 +113,3 @@ const upload = options => {
};

module.exports = upload;

45 changes: 20 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,31 @@
},
"homepage": "https://github.com/TabSpace/gulp-qcloud-cos-upload#readme",
"devDependencies": {
"@commitlint/cli": "^7.5.2",
"@commitlint/config-conventional": "^7.5.0",
"babel-eslint": "8.0.2",
"chai": "4.1.2",
"commitizen": "^3.0.5",
"cz-conventional-changelog": "^2.1.0",
"eslint": "4.10.0",
"eslint-config-airbnb-base": "12.1.0",
"eslint-friendly-formatter": "3.0.0",
"eslint-plugin-import": "2.8.0",
"gulp": "3.9.1",
"gulp-mocha": "4.3.1",
"husky": "^1.3.1",
"lint-staged": "^8.1.4",
"mocha": "4.0.1",
"request-promise": "4.2.2",
"run-sequence": "2.2.0",
"semantic-release": "^15.13.3"
"@commitlint/cli": "^9.1.1",
"@commitlint/config-conventional": "^9.1.1",
"babel-eslint": "^10.1.0",
"commitizen": "^4.1.2",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^7.5.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-plugin-import": "^2.22.0",
"gulp": "^4.0.2",
"gulp-mocha": "^7.0.2",
"husky": "^4.2.5",
"lint-staged": "^10.2.11",
"mocha": "^8.0.1",
"power-assert": "^1.6.1",
"request-promise": "^4.2.6",
"semantic-release": "^17.1.1"
},
"dependencies": {
"chalk": "^2.4.2",
"fancy-log": "^1.3.3",
"plugin-error": "^1.0.1",
"qcloud-cos-upload": "^1.2.8",
"through2": "2.0.3",
"url-join": "2.0.2"
},
"engines": {
"node": ">= 8.0.0",
"npm": ">= 5.0.0"
"qcloud-cos-upload": "^1.3.1",
"through2": "^4.0.2",
"url-join": "^4.0.1"
},
"husky": {
"hooks": {
Expand Down
21 changes: 7 additions & 14 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
const $fs = require('fs');
const $path = require('path');
const $rp = require('request-promise');
const $chai = require('chai');
const $mocha = require('mocha');
const $assert = require('power-assert');
const $config = require('./config');

const {
describe,
it,
before
} = $mocha;

const domain = `${$config.Bucket}-${$config.AppId}.coscd.myqcloud.com`;
const perfix = $config.prefix;
const base = 'base';
Expand Down Expand Up @@ -43,13 +36,13 @@ describe('check-upload', function () {
});

it('File 1 exists', () => {
$chai.expect(test1cosRs).to.be.a('string');
$chai.expect(test1cosRs).to.include(tsContent);
$assert(typeof test1cosRs === 'string');
$assert(test1cosRs.indexOf(tsContent) >= 0);
});

it('File 2 exists', () => {
$chai.expect(test2cosRs).to.be.a('string');
$chai.expect(test2cosRs).to.include(tsContent);
$assert(typeof test2cosRs === 'string');
$assert(test2cosRs.indexOf(tsContent) >= 0);
});
});

Expand All @@ -71,7 +64,7 @@ describe('check-uploadBase', function () {
});

it('File 1 exists', () => {
$chai.expect(test1cosRs).to.be.a('string');
$chai.expect(test1cosRs).to.include(tsContent);
$assert(typeof test1cosRs === 'string');
$assert(test1cosRs.indexOf(tsContent) >= 0);
});
});

0 comments on commit c0d2965

Please sign in to comment.