feat: Use vitest instead of jest for ESM compatibility
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const testEnvFile = path.resolve(__dirname, '../../.env.test');
|
||||
|
||||
if (!fs.existsSync(testEnvFile)) {
|
@@ -1,6 +1,6 @@
|
||||
import { Model } from 'objection';
|
||||
import { client as knex } from '../../src/config/database';
|
||||
import logger from '../../src/helpers/logger';
|
||||
import { client as knex } from '../../src/config/database.js';
|
||||
import logger from '../../src/helpers/logger.js';
|
||||
|
||||
global.beforeAll(async () => {
|
||||
global.knex = null;
|
||||
@@ -22,8 +22,8 @@ global.afterEach(async () => {
|
||||
await global.knex.rollback();
|
||||
Model.knex(knex);
|
||||
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
// jest.restoreAllMocks();
|
||||
// jest.clearAllMocks();
|
||||
});
|
||||
|
||||
global.afterAll(async () => {
|
@@ -1,5 +0,0 @@
|
||||
const exitProcess = (): void => {
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
export default exitProcess;
|
@@ -1,8 +1,8 @@
|
||||
import './check-env-file';
|
||||
import { createDatabaseAndUser } from '../../bin/database/utils';
|
||||
import { client as knex } from '../../src/config/database';
|
||||
import logger from '../../src/helpers/logger';
|
||||
import appConfig from '../../src/config/app';
|
||||
import './check-env-file.js';
|
||||
import { createDatabaseAndUser } from '../../bin/database/utils.js';
|
||||
import { client as knex } from '../../src/config/database.js';
|
||||
import logger from '../../src/helpers/logger.js';
|
||||
import appConfig from '../../src/config/app.js';
|
||||
|
||||
const createAndMigrateDatabase = async () => {
|
||||
if (!appConfig.CI) {
|
Reference in New Issue
Block a user