Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-79-npm / kerberos / kerberos.js
979 bytesRaw
1 | ; |
2 | |
3 | function isModuleNotFoundError (error) { |
4 | return ((error.code === 'MODULE_NOT_FOUND') && |
5 | (error.message.indexOf('build/Release/kerberos') >= 0)); |
6 | } |
7 | |
8 | var kerberos; |
9 | |
10 | function hideTryBlockFromBundleDetectorIgnoreFlag () { |
11 | kerberos = require('kerberos'); |
12 | } |
13 | |
14 | try { |
15 | hideTryBlockFromBundleDetectorIgnoreFlag(); |
16 | } catch (error) { |
17 | if (!isModuleNotFoundError(error)) { |
18 | console.log('bad1', error); |
19 | return; |
20 | } |
21 | } |
22 | |
23 | var sspi; |
24 | |
25 | function hideTryBlockFromBundleDetectorIgnoreFlag2 () { |
26 | sspi = require('kerberos/lib/sspi'); |
27 | } |
28 | |
29 | try { |
30 | if (process.platform === 'win32') { |
31 | hideTryBlockFromBundleDetectorIgnoreFlag2(); |
32 | } |
33 | } catch (error) { |
34 | if (!isModuleNotFoundError(error)) { |
35 | console.log('bad2', error); |
36 | return; |
37 | } |
38 | } |
39 | |
40 | if (kerberos) { |
41 | if (typeof kerberos.Kerberos !== 'function') { |
42 | console.log('bad'); |
43 | return; |
44 | } |
45 | } |
46 | |
47 | if (sspi) { |
48 | if (typeof sspi.SSPI !== 'function') { |
49 | console.log('bad'); |
50 | return; |
51 | } |
52 | } |
53 | |
54 | console.log('ok'); |
55 |
Built with git-ssb-web