|
| 1 | +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html |
| 2 | + |
| 3 | +exports[`Orchestrion JS Transformer > should transform CommonJS module correctly 1`] = ` |
| 4 | +{ |
| 5 | + "code": "const { tracingChannel: tr_ch_apm_tracingChannel } = require("diagnostics_channel"); |
| 6 | +const tr_ch_apm$up_fetch = tr_ch_apm_tracingChannel("orchestrion:one:up:fetch"); |
| 7 | +const tr_ch_apm$up_constructor = tr_ch_apm_tracingChannel("orchestrion:one:up:constructor"); |
| 8 | +module.exports = class Up { |
| 9 | + constructor(){ |
| 10 | + const tr_ch_apm_ctx$up_constructor = { |
| 11 | + arguments |
| 12 | + }; |
| 13 | + try { |
| 14 | + if (tr_ch_apm$up_constructor.hasSubscribers) { |
| 15 | + tr_ch_apm$up_constructor.start.publish(tr_ch_apm_ctx$up_constructor); |
| 16 | + } |
| 17 | + console.log('constructor'); |
| 18 | + } catch (tr_ch_err) { |
| 19 | + if (tr_ch_apm$up_constructor.hasSubscribers) { |
| 20 | + tr_ch_apm_ctx$up_constructor.error = tr_ch_err; |
| 21 | + try { |
| 22 | + tr_ch_apm_ctx$up_constructor.self = this; |
| 23 | + } catch (refErr) {} |
| 24 | + tr_ch_apm$up_constructor.error.publish(tr_ch_apm_ctx$up_constructor); |
| 25 | + } |
| 26 | + throw tr_ch_err; |
| 27 | + } finally{ |
| 28 | + if (tr_ch_apm$up_constructor.hasSubscribers) { |
| 29 | + tr_ch_apm_ctx$up_constructor.self = this; |
| 30 | + tr_ch_apm$up_constructor.end.publish(tr_ch_apm_ctx$up_constructor); |
| 31 | + } |
| 32 | + } |
| 33 | + } |
| 34 | + fetch() { |
| 35 | + const __apm$original_args = arguments; |
| 36 | + const __apm$traced = ()=>{ |
| 37 | + const __apm$wrapped = ()=>{ |
| 38 | + console.log('fetch'); |
| 39 | + }; |
| 40 | + return __apm$wrapped.apply(null, __apm$original_args); |
| 41 | + }; |
| 42 | + if (!tr_ch_apm$up_fetch.hasSubscribers) return __apm$traced(); |
| 43 | + return tr_ch_apm$up_fetch.traceSync(__apm$traced, { |
| 44 | + arguments, |
| 45 | + self: this |
| 46 | + }); |
| 47 | + } |
| 48 | +}; |
| 49 | +", |
| 50 | + "map": undefined, |
| 51 | +} |
| 52 | +`; |
| 53 | + |
| 54 | +exports[`Orchestrion JS Transformer > should transform ESM module correctly 1`] = ` |
| 55 | +{ |
| 56 | + "code": "import { tracingChannel as tr_ch_apm_tracingChannel } from "diagnostics_channel"; |
| 57 | +const tr_ch_apm$up_fetch = tr_ch_apm_tracingChannel("orchestrion:one:up:fetch"); |
| 58 | +const tr_ch_apm$up_constructor = tr_ch_apm_tracingChannel("orchestrion:one:up:constructor"); |
| 59 | +export class Up { |
| 60 | + constructor(){ |
| 61 | + const tr_ch_apm_ctx$up_constructor = { |
| 62 | + arguments |
| 63 | + }; |
| 64 | + try { |
| 65 | + if (tr_ch_apm$up_constructor.hasSubscribers) { |
| 66 | + tr_ch_apm$up_constructor.start.publish(tr_ch_apm_ctx$up_constructor); |
| 67 | + } |
| 68 | + console.log('constructor'); |
| 69 | + } catch (tr_ch_err) { |
| 70 | + if (tr_ch_apm$up_constructor.hasSubscribers) { |
| 71 | + tr_ch_apm_ctx$up_constructor.error = tr_ch_err; |
| 72 | + try { |
| 73 | + tr_ch_apm_ctx$up_constructor.self = this; |
| 74 | + } catch (refErr) {} |
| 75 | + tr_ch_apm$up_constructor.error.publish(tr_ch_apm_ctx$up_constructor); |
| 76 | + } |
| 77 | + throw tr_ch_err; |
| 78 | + } finally{ |
| 79 | + if (tr_ch_apm$up_constructor.hasSubscribers) { |
| 80 | + tr_ch_apm_ctx$up_constructor.self = this; |
| 81 | + tr_ch_apm$up_constructor.end.publish(tr_ch_apm_ctx$up_constructor); |
| 82 | + } |
| 83 | + } |
| 84 | + } |
| 85 | + fetch() { |
| 86 | + const __apm$original_args = arguments; |
| 87 | + const __apm$traced = ()=>{ |
| 88 | + const __apm$wrapped = ()=>{ |
| 89 | + console.log('fetch'); |
| 90 | + }; |
| 91 | + return __apm$wrapped.apply(null, __apm$original_args); |
| 92 | + }; |
| 93 | + if (!tr_ch_apm$up_fetch.hasSubscribers) return __apm$traced(); |
| 94 | + return tr_ch_apm$up_fetch.traceSync(__apm$traced, { |
| 95 | + arguments, |
| 96 | + self: this |
| 97 | + }); |
| 98 | + } |
| 99 | +} |
| 100 | +", |
| 101 | + "map": undefined, |
| 102 | +} |
| 103 | +`; |
| 104 | + |
| 105 | +exports[`Orchestrion JS Transformer > should transform TypeScript with source map correctly 1`] = ` |
| 106 | +{ |
| 107 | + "code": "import { tracingChannel as tr_ch_apm_tracingChannel } from "diagnostics_channel"; |
| 108 | +const tr_ch_apm$up_fetch = tr_ch_apm_tracingChannel("orchestrion:one:up:fetch"); |
| 109 | +const tr_ch_apm$up_constructor = tr_ch_apm_tracingChannel("orchestrion:one:up:constructor"); |
| 110 | +export class Up { |
| 111 | + constructor(){ |
| 112 | + const tr_ch_apm_ctx$up_constructor = { |
| 113 | + arguments |
| 114 | + }; |
| 115 | + try { |
| 116 | + if (tr_ch_apm$up_constructor.hasSubscribers) { |
| 117 | + tr_ch_apm$up_constructor.start.publish(tr_ch_apm_ctx$up_constructor); |
| 118 | + } |
| 119 | + console.log('constructor'); |
| 120 | + } catch (tr_ch_err) { |
| 121 | + if (tr_ch_apm$up_constructor.hasSubscribers) { |
| 122 | + tr_ch_apm_ctx$up_constructor.error = tr_ch_err; |
| 123 | + try { |
| 124 | + tr_ch_apm_ctx$up_constructor.self = this; |
| 125 | + } catch (refErr) {} |
| 126 | + tr_ch_apm$up_constructor.error.publish(tr_ch_apm_ctx$up_constructor); |
| 127 | + } |
| 128 | + throw tr_ch_err; |
| 129 | + } finally{ |
| 130 | + if (tr_ch_apm$up_constructor.hasSubscribers) { |
| 131 | + tr_ch_apm_ctx$up_constructor.self = this; |
| 132 | + tr_ch_apm$up_constructor.end.publish(tr_ch_apm_ctx$up_constructor); |
| 133 | + } |
| 134 | + } |
| 135 | + } |
| 136 | + fetch(url) { |
| 137 | + const __apm$original_args = arguments; |
| 138 | + const __apm$traced = ()=>{ |
| 139 | + const __apm$wrapped = (url)=>{ |
| 140 | + console.log('fetch'); |
| 141 | + }; |
| 142 | + return __apm$wrapped.apply(null, __apm$original_args); |
| 143 | + }; |
| 144 | + if (!tr_ch_apm$up_fetch.hasSubscribers) return __apm$traced(); |
| 145 | + return tr_ch_apm$up_fetch.traceSync(__apm$traced, { |
| 146 | + arguments, |
| 147 | + self: this |
| 148 | + }); |
| 149 | + } |
| 150 | +} |
| 151 | +", |
| 152 | + "map": "{"version":3,"file":"module.js","sources":["module.ts"],"sourceRoot":"","names":[],"mappings":";;;AAEA,MAAM,CAAA,MAAO,EAAE;IACX,aAAA;;;;;;;;YACI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;;;;;;;;;;;;;;;;IAC/B,CAAC;IACD,KAAK,IAAS,EAAA;;;mCAAR;gBACF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;;;;;;;;;IACzB,CAAC;CACJ"}", |
| 153 | +} |
| 154 | +`; |
0 commit comments