Yuki Takei 4 лет назад
Родитель
Сommit
8e88390ff2

+ 7 - 0
packages/app/src/test/global-teardown.js

@@ -1,2 +1,9 @@
+/** **********************************************************
+ *                           Caution
+ *
+ * Module aliases by compilerOptions.paths in tsconfig.json
+ * are NOT available in setup scripts
+ *********************************************************** */
+
 module.exports = async() => {
 module.exports = async() => {
 };
 };

+ 1 - 1
packages/app/src/test/setup-crowi.js

@@ -1,4 +1,4 @@
-const Crowi = require('~/server/crowi');
+import Crowi from '~/server/crowi';
 
 
 let _instance = null;
 let _instance = null;
 
 

+ 10 - 5
packages/app/src/test/setup.js

@@ -1,19 +1,24 @@
-import { getMongoUri, mongoOptions } from '~/server/util/mongoose-utils';
+/** **********************************************************
+ *                           Caution
+ *
+ * Module aliases by compilerOptions.paths in tsconfig.json
+ * are NOT available in setup scripts
+ *********************************************************** */
 
 
 const mongoose = require('mongoose');
 const mongoose = require('mongoose');
 
 
+const { getMongoUri, mongoOptions } = require('~/server/util/mongoose-utils');
+
 mongoose.Promise = global.Promise;
 mongoose.Promise = global.Promise;
 
 
 jest.setTimeout(30000); // default 5000
 jest.setTimeout(30000); // default 5000
 
 
-beforeAll(async(done) => {
+beforeAll(async() => {
   await mongoose.connect(getMongoUri(), mongoOptions);
   await mongoose.connect(getMongoUri(), mongoOptions);
-  done();
 });
 });
 
 
-afterAll(async(done) => {
+afterAll(async() => {
   await mongoose.disconnect();
   await mongoose.disconnect();
-  done();
 });
 });
 
 
 module.exports = {};
 module.exports = {};