Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
144 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "eslint-config-egg", | ||
"parserOptions": { | ||
"ecmaVersion": 2017 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- '8' | ||
- '9' | ||
- '10' | ||
install: | ||
- npm i npminstall && npminstall | ||
script: | ||
- npm run ci | ||
after_script: | ||
- npminstall codecov && codecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
environment: | ||
matrix: | ||
- nodejs_version: '6' | ||
|
||
install: | ||
- ps: Install-Product node $env:nodejs_version | ||
- npm i npminstall && node_modules\.bin\npminstall | ||
|
||
test_script: | ||
- node --version | ||
- npm --version | ||
- npm run test | ||
|
||
build: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "your-hexo-project", | ||
"yuqueConfig": { | ||
"baseUrl": "https://www.yuque.com/api/v2", | ||
"login": "yinzhi", | ||
"repo": "blog" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const coffee = require('coffee'); | ||
const assert = require('assert'); | ||
|
||
describe('test/my-git.test.js', () => { | ||
const myBin = require.resolve('../bin/yuque-hexo'); | ||
const cwd = path.join(__dirname, 'hexo-project'); | ||
|
||
describe('global options', () => { | ||
it('yuque-hexo --help', async () => { | ||
const { stdout, code } = await coffee | ||
.fork(myBin, [ '--help' ], { cwd }) | ||
.end(); | ||
assert(stdout.includes('Usage: yuque-hexo <command>')); | ||
assert(code === 0); | ||
}); | ||
|
||
it('yuque-hexo clean with warning', async () => { | ||
const { stdout, code } = await coffee | ||
.fork(myBin, [ 'clean' ], { cwd }) | ||
.end(); | ||
assert(stdout.includes('yuque-hexo clean start.')); | ||
assert(stdout.includes('yuque-hexo clean finished.')); | ||
assert(stdout.includes('WARNING')); | ||
assert(code === 0); | ||
}); | ||
|
||
it('yuque-hexo without cache', async () => { | ||
const { stdout, code } = await coffee | ||
.fork(myBin, [ 'sync' ], { cwd }) | ||
.end(); | ||
assert(stdout.includes('yuque-hexo sync start.')); | ||
assert(stdout.includes('download article body')); | ||
assert(stdout.includes('yuque-hexo sync finished.')); | ||
assert(code === 0); | ||
}); | ||
|
||
it('yuque-hexo sync use cache', async () => { | ||
const { stdout, code } = await coffee | ||
.fork(myBin, [ 'sync' ], { cwd }) | ||
.end(); | ||
assert(stdout.includes('yuque-hexo sync start.')); | ||
assert(!stdout.includes('download article body')); | ||
assert(stdout.includes('yuque-hexo sync finished.')); | ||
assert(code === 0); | ||
}); | ||
|
||
it('yuque-hexo clean', async () => { | ||
const { stdout, code } = await coffee | ||
.fork(myBin, [ 'clean' ], { cwd }) | ||
.end(); | ||
assert(stdout.includes('yuque-hexo clean start.')); | ||
assert(stdout.includes('yuque-hexo clean finished.')); | ||
assert(!stdout.includes('WARNING')); | ||
assert(code === 0); | ||
}); | ||
}); | ||
}); |