Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
fix(hana): env var pointing to dbcapi
Browse files Browse the repository at this point in the history
hana-client + jest need to be persuaded
  • Loading branch information
vobu committed Aug 17, 2020
1 parent 50da439 commit b6b4921
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions __tests__/__assets__/hana-jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// taken straight from
// https://github.com/facebook/jest/issues/7480#issuecomment-492976544
// with some minor bugfixes added

const os = require('os')
const path = require('path')

module.exports = async () => {
const extensions = {
darwin: 'dylib',
linux: 'so',
win32: 'dll',
}

// Look for prebuilt binary and DBCAPI based on platform
let pb_subdir = null
if (process.platform === 'linux') {
if (process.arch === 'x64') {
pb_subdir = 'linuxx86_64-gcc48'
} else if (process.arch.toLowerCase().indexOf('ppc') != -1 && os.endianness() === 'LE') {
pb_subdir = 'linuxppc64le-gcc48'
} else {
pb_subdir = 'linuxppc64-gcc48'
}
} else if (process.platform === 'win32') {
pb_subdir = 'ntamd64-msvc2010'
} else if (process.platform === 'darwin') {
pb_subdir = 'darwinintel64-xcode7'
}

const modpath = path.dirname(require.resolve('@sap/hana-client/README.md'))
const pb_path = path.join(modpath, 'prebuilt', pb_subdir)
const dbcapi = process.env['DBCAPI_API_DLL'] || path.join(pb_path, 'libdbcapiHDB.' + extensions[process.platform])

process.env['DBCAPI_API_DLL'] = dbcapi
}

0 comments on commit b6b4921

Please sign in to comment.