add test case 1

This commit is contained in:
Shigma
2019-04-03 16:39:54 +08:00
parent cb1247a48e
commit 1f45f17618
11 changed files with 42 additions and 2 deletions
@@ -0,0 +1 @@
dotfile
@@ -0,0 +1 @@
.dotfolder/foo.txt
@@ -0,0 +1 @@
bar/baz.txt
@@ -0,0 +1 @@
baz.txt
@@ -0,0 +1 @@
readme
@@ -0,0 +1,32 @@
/**
* @jest-environment node
*/
const { createApp } = require('@vuepress/core')
const { path: { resolve }, fs } = require('@vuepress/shared-utils')
describe('plugin-public-files: source dir', () => {
const app = createApp({
sourceDir: resolve(__dirname, 'docs-1')
})
beforeAll(async () => {
await app.process()
await app.build()
}, 60000)
function testForExistence (name, existence = true) {
test(`${existence ? '' : 'in'}existence: ${name}`, () => {
expect(fs.existsSync(resolve(app.outDir, name))).toBe(existence)
})
}
testForExistence('foo.txt')
testForExistence('baz.txt')
testForExistence('bar/foo.txt')
testForExistence('bar/baz.txt')
testForExistence('index.html')
testForExistence('readme.md', false)
testForExistence('.dotfile', false)
testForExistence('.dotfolder', false)
})
@@ -1,6 +1,6 @@
{
"name": "@vuepress/plugin-public-files",
"version": "1.0.0-alpha.44",
"version": "1.0.0-alpha.46",
"description": "register-global-components plugin for vuepress",
"main": "index.js",
"publishConfig": {
@@ -27,7 +27,8 @@
},
"homepage": "https://github.com/vuejs/vuepress/packages/@vuepress/plugin-public-files#readme",
"dependencies": {
"@vuepress/shared-utils": "^1.0.0-alpha.44",
"@vuepress/core": "^1.0.0-alpha.46",
"@vuepress/shared-utils": "^1.0.0-alpha.46",
"copy-webpack-plugin": "^5.0.2",
"vuepress-mergeable": "^1.0.1"
}