File tree 3 files changed +23
-2
lines changed
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;
10
10
var path = require ( 'path' ) ;
11
11
12
12
var 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' ;
14
14
var port = 8378 ;
15
15
16
16
// Default server configuration for tests.
Original file line number Diff line number Diff line change @@ -175,6 +175,26 @@ describe('server', () => {
175
175
} )
176
176
} ) ;
177
177
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
+
178
198
it ( 'can create a parse-server' , done => {
179
199
var parseServer = new ParseServer . default ( {
180
200
appId : "aTestApp" ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ var batch = require('./batch'),
9
9
middlewares = require ( './middlewares' ) ,
10
10
multer = require ( 'multer' ) ,
11
11
Parse = require ( 'parse/node' ) . Parse ,
12
+ path = require ( 'path' ) ,
12
13
authDataManager = require ( './authDataManager' ) ;
13
14
14
15
import { logger ,
@@ -142,7 +143,7 @@ class ParseServer {
142
143
if ( typeof cloud === 'function' ) {
143
144
cloud ( Parse )
144
145
} else if ( typeof cloud === 'string' ) {
145
- require ( cloud ) ;
146
+ require ( path . resolve ( process . cwd ( ) , cloud ) ) ;
146
147
} else {
147
148
throw "argument 'cloud' must either be a string or a function" ;
148
149
}
You can’t perform that action at this time.
0 commit comments