File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ function getMetadata (dir) {
4040 if ( exists ( json ) ) {
4141 opts = metadata . sync ( json )
4242 } else if ( exists ( js ) ) {
43- var req = require ( js )
43+ var req = require ( path . resolve ( js ) )
4444 if ( req !== Object ( req ) ) {
4545 throw new Error ( 'meta.js needs to expose an object' )
4646 }
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const metadata = require('../../lib/options')
1313
1414const MOCK_TEMPLATE_REPO_PATH = './test/e2e/mock-template-repo'
1515const MOCK_TEMPLATE_BUILD_PATH = path . resolve ( './test/e2e/mock-template-build' )
16+ const MOCK_METADATA_REPO_JS_PATH = './test/e2e/mock-metadata-repo-js'
1617
1718function monkeyPatchInquirer ( answers ) {
1819 // monkey patch inquirer
@@ -50,16 +51,15 @@ describe('vue-cli', () => {
5051 } )
5152
5253 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 )
5455 expect ( meta ) . to . be . an ( 'object' )
5556 expect ( meta . prompts ) . to . have . property ( 'description' )
5657 done ( )
5758 } )
5859
5960 it ( 'helpers' , done => {
6061 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 => {
6363 if ( err ) done ( err )
6464 const contents = fs . readFileSync ( `${ MOCK_TEMPLATE_BUILD_PATH } /readme.md` , 'utf-8' )
6565 expect ( contents ) . to . equal ( answers . name . toUpperCase ( ) )
You can’t perform that action at this time.
0 commit comments