File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ var ParseServer = require('../src/index').ParseServer;
1010var path = require ( 'path' ) ;
1111
1212var databaseURI = process . env . DATABASE_URI ;
13- var cloudMain = process . env . CLOUD_CODE_MAIN || '.. /spec/cloud/main.js' ;
13+ var cloudMain = process . env . CLOUD_CODE_MAIN || './spec/cloud/main.js' ;
1414var port = 8378 ;
1515
1616// Default server configuration for tests.
Original file line number Diff line number Diff line change @@ -175,6 +175,26 @@ describe('server', () => {
175175 } )
176176 } ) ;
177177
178+ it ( 'can load absolute cloud code file' , done => {
179+ setServerConfiguration ( {
180+ serverURL : 'http://localhost:8378/1' ,
181+ appId : 'test' ,
182+ masterKey : 'test' ,
183+ cloud : __dirname + '/cloud/main.js'
184+ } ) ;
185+ done ( ) ;
186+ } ) ;
187+
188+ it ( 'can load relative cloud code file' , done => {
189+ setServerConfiguration ( {
190+ serverURL : 'http://localhost:8378/1' ,
191+ appId : 'test' ,
192+ masterKey : 'test' ,
193+ cloud : './spec/cloud/main.js'
194+ } ) ;
195+ done ( ) ;
196+ } ) ;
197+
178198 it ( 'can create a parse-server' , done => {
179199 var parseServer = new ParseServer . default ( {
180200 appId : "aTestApp" ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ var batch = require('./batch'),
99 middlewares = require ( './middlewares' ) ,
1010 multer = require ( 'multer' ) ,
1111 Parse = require ( 'parse/node' ) . Parse ,
12+ path = require ( 'path' ) ,
1213 authDataManager = require ( './authDataManager' ) ;
1314
1415import { logger ,
@@ -142,7 +143,7 @@ class ParseServer {
142143 if ( typeof cloud === 'function' ) {
143144 cloud ( Parse )
144145 } else if ( typeof cloud === 'string' ) {
145- require ( cloud ) ;
146+ require ( path . resolve ( process . cwd ( ) , cloud ) ) ;
146147 } else {
147148 throw "argument 'cloud' must either be a string or a function" ;
148149 }
You can’t perform that action at this time.
0 commit comments