-
-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): validate version mismatch in ORM packages
Can be disabled via `MIKRO_ORM_ALLOW_VERSION_MISMATCH` env var.
- Loading branch information
Showing
24 changed files
with
549 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { Config } from '@jest/types'; | ||
|
||
// Sync object | ||
const config: Config.InitialOptions = { | ||
testTimeout: 30000, | ||
preset: 'ts-jest', | ||
collectCoverage: false, | ||
collectCoverageFrom: [ | ||
'<rootDir>/packages/*/src/**/*.ts', | ||
], | ||
moduleNameMapper: { | ||
'@mikro-orm/mongo-highlighter': '<rootDir>/node_modules/@mikro-orm/mongo-highlighter', | ||
'@mikro-orm/sql-highlighter': '<rootDir>/node_modules/@mikro-orm/sql-highlighter', | ||
'@mikro-orm/(.*)/package.json': '<rootDir>/packages/$1/package.json', | ||
'@mikro-orm/(.*)': '<rootDir>/packages/$1/src', | ||
}, | ||
modulePathIgnorePatterns: [ | ||
'dist/package.json', | ||
'<rootDir>/package.json', | ||
], | ||
coveragePathIgnorePatterns: [ | ||
'<rootDir>/packages/cli/src/cli.ts', | ||
], | ||
setupFiles: [ | ||
'<rootDir>/tests/setup.ts', | ||
], | ||
globals: { | ||
'ts-jest': { | ||
tsconfig: 'tests/tsconfig.json', | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ jest.mock('knex', () => ({ knex })); | |
|
||
(global as any).process.env.FORCE_COLOR = 0; | ||
|
||
import { Configuration, EntityManager, MikroORM, NullCacheAdapter } from '@mikro-orm/core'; | ||
import { Configuration, EntityManager, MikroORM, NullCacheAdapter, Utils } from '@mikro-orm/core'; | ||
import fs from 'fs-extra'; | ||
import { BASE_DIR } from './helpers'; | ||
import { Author, Test } from './entities'; | ||
|
@@ -198,7 +198,8 @@ describe('MikroORM', () => { | |
debug: ['info'], | ||
logger, | ||
}); | ||
expect(logger.mock.calls[0][0]).toEqual('[info] MikroORM failed to connect to database not-found on mysql://[email protected]:3306'); | ||
expect(logger.mock.calls[0][0]).toEqual(`[info] MikroORM version: ${await Utils.getORMVersion()}`); | ||
expect(logger.mock.calls[1][0]).toEqual('[info] MikroORM failed to connect to database not-found on mysql://[email protected]:3306'); | ||
}); | ||
|
||
test('orm.close() calls CacheAdapter.close()', async () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.