File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ function getMetadata (dir) {
40
40
if ( exists ( json ) ) {
41
41
opts = metadata . sync ( json )
42
42
} else if ( exists ( js ) ) {
43
- var req = require ( js )
43
+ var req = require ( path . resolve ( js ) )
44
44
if ( req !== Object ( req ) ) {
45
45
throw new Error ( 'meta.js needs to expose an object' )
46
46
}
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const metadata = require('../../lib/options')
13
13
14
14
const MOCK_TEMPLATE_REPO_PATH = './test/e2e/mock-template-repo'
15
15
const MOCK_TEMPLATE_BUILD_PATH = path . resolve ( './test/e2e/mock-template-build' )
16
+ const MOCK_METADATA_REPO_JS_PATH = './test/e2e/mock-metadata-repo-js'
16
17
17
18
function monkeyPatchInquirer ( answers ) {
18
19
// monkey patch inquirer
@@ -50,16 +51,15 @@ describe('vue-cli', () => {
50
51
} )
51
52
52
53
it ( 'read metadata from js' , done => {
53
- const meta = metadata ( 'test-pkg' , path . join ( __dirname , '/mock-metadata-repo-js' ) )
54
+ const meta = metadata ( 'test-pkg' , MOCK_METADATA_REPO_JS_PATH )
54
55
expect ( meta ) . to . be . an ( 'object' )
55
56
expect ( meta . prompts ) . to . have . property ( 'description' )
56
57
done ( )
57
58
} )
58
59
59
60
it ( 'helpers' , done => {
60
61
monkeyPatchInquirer ( answers )
61
- const buildPath = path . join ( __dirname , '/mock-metadata-repo-js' )
62
- generate ( 'test' , buildPath , MOCK_TEMPLATE_BUILD_PATH , err => {
62
+ generate ( 'test' , MOCK_METADATA_REPO_JS_PATH , MOCK_TEMPLATE_BUILD_PATH , err => {
63
63
if ( err ) done ( err )
64
64
const contents = fs . readFileSync ( `${ MOCK_TEMPLATE_BUILD_PATH } /readme.md` , 'utf-8' )
65
65
expect ( contents ) . to . equal ( answers . name . toUpperCase ( ) )
You can’t perform that action at this time.
0 commit comments