Skip to content

Commit

Permalink
jest: fix setup for typeorm to be importable in tests
Browse files Browse the repository at this point in the history
It needs to be transpiled, but also the global window variable was
breaking this code:
https://github.com/typeorm/typeorm/blob/e4de0403e1f666639c0198e216409f997121c1e8/src/platform/BrowserPlatformTools.template#L20

Also add ConnectionOptions type back to the config object
  • Loading branch information
mnzaki committed Aug 20, 2019
1 parent 7d3cca5 commit 3dd3258
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ module.exports = {
"enzyme-to-json/serializer"
],
transformIgnorePatterns: [
"node_modules/(?!react-native|native-base|@?react-navigation|react-native-fabric)"
"node_modules/(?!react-native|native-base|@?react-navigation|react-native-fabric|typeorm)"
],
globals: {
window: true,
"ts-jest": {
babelConfig: true
}
Expand Down
5 changes: 4 additions & 1 deletion ormconfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { entityList } from './src/lib/storage/entities'
import { Initial1565886000404 } from './src/lib/storage/migration/1565886000404-initial'
import { ConnectionOptions } from 'typeorm/browser'

export default {
const typeOrmConfig: ConnectionOptions = {
type: 'react-native',
database: 'LocalSmartWalletData',
location: 'default',
Expand All @@ -14,3 +15,5 @@ export default {
migrationsDir: 'src/lib/storage/migration',
},
}

export default typeOrmConfig

0 comments on commit 3dd3258

Please sign in to comment.