|
1 | 1 | import Docker from "dockerode" |
| 2 | +import massive from "massive" |
| 3 | +import * as path from "path" |
| 4 | +import { IDatabase } from "pg-promise" |
2 | 5 | import { Migration } from "./Migration" |
3 | 6 | import { MigrationRunner } from "./MigrationRunner" |
4 | 7 | import * as dockerUtils from "./testHelpers/docker" |
5 | | -import massive from "massive" |
6 | | -import {IDatabase} from "pg-promise" |
7 | 8 |
|
8 | 9 | const docker = new Docker() |
9 | 10 | const postgresImageName = "postgres:10.4" |
10 | 11 | const dbName = "migrationrunnertest" |
11 | 12 | const dbUser = "docker" |
12 | 13 | const dbPass = "docker" |
13 | 14 |
|
| 15 | +const baseDir = path.join(path.resolve("./"), "src") |
| 16 | + |
14 | 17 | class TestMigrationRunner extends MigrationRunner { |
15 | 18 | public async _checkOrCreateSchema() { await this.checkOrCreateSchema() } |
16 | 19 | public async _checkOrCreateTables() { await this.checkOrCreateTables() } |
@@ -137,9 +140,9 @@ describe("MigrationRunner", () => { |
137 | 140 | beforeEach(async (done) => { |
138 | 141 | schemaName = randomSchemaName() |
139 | 142 | migrations = [ |
140 | | - new Migration("createTodoTable", schemaName, "testHelpers/migration1.sql"), |
141 | | - new Migration("createTaskTable", schemaName, "testHelpers/migration2.sql"), |
142 | | - new Migration("createAssigneeTable", schemaName, "testHelpers/migration3.sql"), |
| 143 | + new Migration("createTodoTable", schemaName, path.join(baseDir, "testHelpers/migration1.sql")), |
| 144 | + new Migration("createTaskTable", schemaName, path.join(baseDir, "testHelpers/migration2.sql")), |
| 145 | + new Migration("createAssigneeTable", schemaName, path.join(baseDir, "testHelpers/migration3.sql")), |
143 | 146 | ] |
144 | 147 | runner = new TestMigrationRunner( |
145 | 148 | massiveInstance.instance, |
@@ -214,7 +217,7 @@ describe("MigrationRunner", () => { |
214 | 217 | new Migration( |
215 | 218 | "mymigration", |
216 | 219 | schemaName, |
217 | | - "testHelpers/migration1.sql", |
| 220 | + path.join(baseDir, "testHelpers/migration1.sql"), |
218 | 221 | ), |
219 | 222 | ) |
220 | 223 | const error = new Error( |
|
0 commit comments