mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
added support of tsnode to run tests
This commit is contained in:
parent
fff04f10ea
commit
1aadaa0781
15
gulpfile.ts
15
gulpfile.ts
@ -332,6 +332,21 @@ export class Gulpfile {
|
||||
.pipe(istanbul.writeReports());
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs tests the quick way.
|
||||
*/
|
||||
@Task("ts-node-tests")
|
||||
quickTests() {
|
||||
chai.should();
|
||||
chai.use(require("sinon-chai"));
|
||||
chai.use(require("chai-as-promised"));
|
||||
|
||||
return gulp.src(["./test/**/*.ts"])
|
||||
.pipe(mocha({
|
||||
timeout: 10000
|
||||
}));
|
||||
}
|
||||
|
||||
@Task()
|
||||
coverageRemap() {
|
||||
return gulp.src("./coverage/coverage-final.json")
|
||||
|
||||
@ -9,9 +9,17 @@ import {Category} from "./entity/Category";
|
||||
* So we run tests only for mysql.
|
||||
*/
|
||||
describe("lazy-relations", () => {
|
||||
const resourceDir = __dirname + "/../../../../../test/functional/lazy-relations/";
|
||||
const userSchema = require(resourceDir + "schema/user.json");
|
||||
const profileSchema = require(resourceDir + "schema/profile.json");
|
||||
|
||||
let userSchema: any, profileSchema: any;
|
||||
try {
|
||||
const resourceDir = __dirname + "/../../../../../test/functional/lazy-relations/";
|
||||
userSchema = require(resourceDir + "schema/user.json");
|
||||
profileSchema = require(resourceDir + "schema/profile.json");
|
||||
} catch (err) {
|
||||
const resourceDir = __dirname + "/";
|
||||
userSchema = require(resourceDir + "schema/user.json");
|
||||
profileSchema = require(resourceDir + "schema/profile.json");
|
||||
}
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
|
||||
@ -10,10 +10,16 @@ import {Blog} from "./entity/Blog";
|
||||
import {Category} from "./entity/Category";
|
||||
|
||||
describe("repository > basic methods", () => {
|
||||
const resourceDir = __dirname + "/../../../../../../test/functional/repository/basic-methods/";
|
||||
|
||||
const userSchema = require(resourceDir + "schema/user.json");
|
||||
|
||||
let userSchema: any;
|
||||
try {
|
||||
const resourceDir = __dirname + "/../../../../../../test/functional/repository/basic-methods/";
|
||||
userSchema = require(resourceDir + "schema/user.json");
|
||||
} catch (err) {
|
||||
const resourceDir = __dirname + "/";
|
||||
userSchema = require(resourceDir + "schema/user.json");
|
||||
}
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
entities: [Post, Blog, Category],
|
||||
|
||||
@ -7,9 +7,16 @@ import {FindOptions} from "../../../../src/find-options/FindOptions";
|
||||
import {User} from "./model/User";
|
||||
|
||||
describe("repository > find methods", () => {
|
||||
const resourceDir = __dirname + "/../../../../../../test/functional/repository/find-methods/";
|
||||
const userSchema = require(resourceDir + "schema/user.json");
|
||||
|
||||
|
||||
let userSchema: any;
|
||||
try {
|
||||
const resourceDir = __dirname + "/../../../../../../test/functional/repository/find-methods/";
|
||||
userSchema = require(resourceDir + "schema/user.json");
|
||||
} catch (err) {
|
||||
const resourceDir = __dirname + "/";
|
||||
userSchema = require(resourceDir + "schema/user.json");
|
||||
}
|
||||
|
||||
let connections: Connection[];
|
||||
before(async () => connections = await createTestingConnections({
|
||||
entities: [Post],
|
||||
|
||||
@ -81,7 +81,14 @@ export function setupTestingConnections(options?: TestingOptions) {
|
||||
let ormConfigConnectionOptionsArray: TestingConnectionOptions[] = [];
|
||||
|
||||
try {
|
||||
ormConfigConnectionOptionsArray = require(__dirname + "/../../../../ormconfig.json");
|
||||
|
||||
try {
|
||||
ormConfigConnectionOptionsArray = require(__dirname + "/../../../../ormconfig.json");
|
||||
|
||||
} catch (err) {
|
||||
ormConfigConnectionOptionsArray = require(__dirname + "/../../ormconfig.json");
|
||||
console.log(ormConfigConnectionOptionsArray);
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
throw new Error(`Cannot find ormconfig.json file in the root of the project. To run tests please create ormconfig.json file` +
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user