ObfuscatedCodeWriter.spec.ts 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  1. import { assert } from 'chai';
  2. import * as fs from 'fs';
  3. import * as mkdirp from 'mkdirp';
  4. import * as path from 'path';
  5. import * as rimraf from 'rimraf';
  6. import { ObfuscatedCodeWriter } from '../../../../src/cli/utils/ObfuscatedCodeWriter';
  7. describe('ObfuscatedCodeWriter', () => {
  8. const tmpDirectoryPath: string = 'test/tmp';
  9. describe('getOutputCodePath', () => {
  10. before(() => {
  11. mkdirp.sync(path.join(tmpDirectoryPath, 'input', 'nested',));
  12. fs.writeFileSync(
  13. path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js'),
  14. 'var foo = 1;'
  15. );
  16. });
  17. describe('Variant #1: raw input path is a file path, raw output path is a file path', () => {
  18. const inputPath: string = path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js');
  19. const rawInputPath: string = path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js');
  20. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  21. const expectedOutputCodePath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  22. let outputCodePath: string;
  23. before(() => {
  24. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  25. rawInputPath,
  26. {
  27. output: rawOutputPath
  28. }
  29. );
  30. outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
  31. });
  32. it('should return output path that equals to passed output file path', () => {
  33. assert.equal(outputCodePath, expectedOutputCodePath);
  34. });
  35. });
  36. describe('Variant #2: raw input path is a file path, raw output path is a directory path', () => {
  37. const inputPath: string = path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js');
  38. const rawInputPath: string = path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js');
  39. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output');
  40. const expectedOutputCodePath: string = path.join(tmpDirectoryPath, 'output', 'test-input.js');
  41. let outputCodePath: string;
  42. before(() => {
  43. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  44. rawInputPath,
  45. {
  46. output: rawOutputPath
  47. }
  48. );
  49. outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
  50. });
  51. it('should return output path that equals to passed output directory with file name from actual file path', () => {
  52. assert.equal(outputCodePath, expectedOutputCodePath);
  53. });
  54. });
  55. describe('Variant #3: raw input path is a directory path, raw output path is a file path', () => {
  56. const inputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  57. const rawInputPath: string = path.join(tmpDirectoryPath, 'input');
  58. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  59. let testFunc: () => string;
  60. before(() => {
  61. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  62. rawInputPath,
  63. {
  64. output: rawOutputPath
  65. }
  66. );
  67. testFunc = () => obfuscatedCodeWriter.getOutputCodePath(inputPath);
  68. });
  69. it('should throw an error if output path is a file path', () => {
  70. assert.throws(testFunc, Error);
  71. });
  72. });
  73. describe('Variant #4: raw input path is a directory path, raw output path is a directory path', () => {
  74. describe('Variant #1: base directory name', () => {
  75. const inputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  76. const rawInputPath: string = path.join(tmpDirectoryPath, 'input');
  77. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output');
  78. const expectedOutputCodePath: string = path.join(
  79. tmpDirectoryPath,
  80. 'output',
  81. 'test-input.js'
  82. );
  83. let outputCodePath: string;
  84. before(() => {
  85. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  86. rawInputPath,
  87. {
  88. output: rawOutputPath
  89. }
  90. );
  91. outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
  92. });
  93. it('should return output path that contains raw output path and actual file input path', () => {
  94. assert.equal(outputCodePath, expectedOutputCodePath);
  95. });
  96. });
  97. describe('Variant #2: base directory name with leading dot in output path', () => {
  98. const inputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  99. const rawInputPath: string = path.join(tmpDirectoryPath, 'input');
  100. const rawOutputPath: string = path.join('.', tmpDirectoryPath, 'output');
  101. const expectedOutputCodePath: string = path.join(
  102. tmpDirectoryPath,
  103. 'output',
  104. 'test-input.js'
  105. );
  106. let outputCodePath: string;
  107. before(() => {
  108. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  109. rawInputPath,
  110. {
  111. output: rawOutputPath
  112. }
  113. );
  114. outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
  115. });
  116. it('should return output path that contains raw output path and actual file input path', () => {
  117. assert.equal(outputCodePath, expectedOutputCodePath);
  118. });
  119. });
  120. describe('Variant #3: base nested directory name', () => {
  121. const inputPath: string = path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js');
  122. const rawInputPath: string = path.join(tmpDirectoryPath, 'input');
  123. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output');
  124. const expectedOutputCodePath: string = path.join(
  125. tmpDirectoryPath,
  126. 'output',
  127. 'nested',
  128. 'test-input.js'
  129. );
  130. let outputCodePath: string;
  131. before(() => {
  132. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  133. rawInputPath,
  134. {
  135. output: rawOutputPath
  136. }
  137. );
  138. outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
  139. });
  140. it('should return output path that contains raw output path and actual file input path', () => {
  141. assert.equal(outputCodePath, expectedOutputCodePath);
  142. });
  143. });
  144. describe('Variant #4: directory name with dot', () => {
  145. const inputPath: string = path.join(tmpDirectoryPath, 'input', 'nested', 'test-input.js');
  146. const rawInputPath: string = path.join(tmpDirectoryPath, 'input');
  147. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'foo.bar');
  148. const expectedOutputCodePath: string = path.join(
  149. tmpDirectoryPath,
  150. 'output',
  151. 'foo.bar',
  152. 'nested',
  153. 'test-input.js'
  154. );
  155. let outputCodePath: string;
  156. before(() => {
  157. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  158. rawInputPath,
  159. {
  160. output: rawOutputPath
  161. }
  162. );
  163. outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
  164. });
  165. it('should return output path that contains raw output path and actual file input path', () => {
  166. assert.equal(outputCodePath, expectedOutputCodePath);
  167. });
  168. });
  169. });
  170. describe('Variant #5: Win32 environment', () => {
  171. const baseDirnamePath: string = __dirname;
  172. before(() => {
  173. mkdirp.sync(path.join(baseDirnamePath, tmpDirectoryPath, 'input', 'nested'));
  174. fs.writeFileSync(
  175. path.join(baseDirnamePath, tmpDirectoryPath, 'input', 'nested', 'test-input.js'),
  176. 'var foo = 1;'
  177. );
  178. });
  179. describe('Variant #1: raw input absolute path is a directory path, raw output absolute path is a directory path', () => {
  180. describe('Variant #1: base directory name', () => {
  181. const inputPath: string = path.join(baseDirnamePath, tmpDirectoryPath, 'input', 'nested', 'test-input.js');
  182. const rawInputPath: string = path.join(baseDirnamePath, tmpDirectoryPath, 'input');
  183. const rawOutputPath: string = path.join(baseDirnamePath, tmpDirectoryPath, 'output');
  184. const expectedOutputCodePath: string = path.join(
  185. baseDirnamePath,
  186. tmpDirectoryPath,
  187. 'output',
  188. 'nested',
  189. 'test-input.js'
  190. );
  191. let outputCodePath: string;
  192. before(() => {
  193. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  194. rawInputPath,
  195. {
  196. output: rawOutputPath
  197. }
  198. );
  199. outputCodePath = obfuscatedCodeWriter.getOutputCodePath(inputPath);
  200. });
  201. it('should return output path that contains raw output path and actual file input path', () => {
  202. assert.equal(outputCodePath, expectedOutputCodePath);
  203. });
  204. });
  205. });
  206. after(() => {
  207. rimraf.sync(path.join(baseDirnamePath, tmpDirectoryPath));
  208. });
  209. });
  210. after(() => {
  211. rimraf.sync(tmpDirectoryPath);
  212. });
  213. });
  214. describe('getOutputSourceMapPath', () => {
  215. describe('Variant #1: output code path is a file path', () => {
  216. const rawInputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  217. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  218. const outputCodePath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  219. const expectedOutputSourceMapPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js.map');
  220. let outputSourceMapPath: string;
  221. before(() => {
  222. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  223. rawInputPath,
  224. {
  225. output: rawOutputPath
  226. }
  227. );
  228. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath);
  229. });
  230. it('should return output path for source map', () => {
  231. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  232. });
  233. });
  234. describe('Variant #2: output code path is a directory path and source map file name is not set', () => {
  235. const rawInputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  236. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  237. const outputCodePath: string = path.join(tmpDirectoryPath, 'output');
  238. let testFunc: () => string;
  239. before(() => {
  240. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  241. rawInputPath,
  242. {
  243. output: rawOutputPath
  244. }
  245. );
  246. testFunc = () => obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath);
  247. });
  248. it('should throw an error if output code path is a directory path and source map file name is not set', () => {
  249. assert.throws(testFunc, Error);
  250. });
  251. });
  252. describe('Variant #3: output code path with dot', () => {
  253. const rawInputPath: string = path.join(tmpDirectoryPath, 'input.with.dot', 'test-input.js');
  254. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output.with.dot', 'test-output.js');
  255. const outputCodePath: string = path.join(tmpDirectoryPath, 'output.with.dot', 'test-output.js');
  256. const expectedOutputSourceMapPath: string = path.join(tmpDirectoryPath, 'output.with.dot', 'test-output.js.map');
  257. let outputSourceMapPath: string;
  258. before(() => {
  259. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  260. rawInputPath,
  261. {
  262. output: rawOutputPath
  263. }
  264. );
  265. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath);
  266. });
  267. it('should return output path for source map', () => {
  268. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  269. });
  270. });
  271. describe('Variant #4: source map file name without extension is set', () => {
  272. const rawInputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  273. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  274. const outputCodePath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  275. const sourceMapFileName: string = 'foo';
  276. const expectedOutputSourceMapPath: string = path.join(tmpDirectoryPath, 'output', 'foo.js.map');
  277. let outputSourceMapPath: string;
  278. before(() => {
  279. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  280. rawInputPath,
  281. {
  282. output: rawOutputPath
  283. }
  284. );
  285. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath, sourceMapFileName);
  286. });
  287. it('should return output path for source map', () => {
  288. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  289. });
  290. });
  291. describe('Variant #5: output code path is a directory path and source map file name without extension is set', () => {
  292. const rawInputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  293. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  294. const outputCodePath: string = path.join(tmpDirectoryPath, 'output');
  295. const sourceMapFileName: string = 'foo';
  296. const expectedOutputSourceMapPath: string = path.join(tmpDirectoryPath, 'output', 'foo.js.map');
  297. let outputSourceMapPath: string;
  298. before(() => {
  299. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  300. rawInputPath,
  301. {
  302. output: rawOutputPath
  303. }
  304. );
  305. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath, sourceMapFileName);
  306. });
  307. it('should return output path for source map', () => {
  308. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  309. });
  310. });
  311. describe('Variant #6: source map file name with wrong extension is set', () => {
  312. const rawInputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  313. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  314. const outputCodePath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  315. const sourceMapFileName: string = 'foo.js';
  316. const expectedOutputSourceMapPath: string = path.join(tmpDirectoryPath, 'output', 'foo.js.map');
  317. let outputSourceMapPath: string;
  318. before(() => {
  319. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  320. rawInputPath,
  321. {
  322. output: rawOutputPath
  323. }
  324. );
  325. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath, sourceMapFileName);
  326. });
  327. it('should return output path for source map', () => {
  328. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  329. });
  330. });
  331. describe('Variant #7: source map file name with valid extension is set', () => {
  332. const rawInputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  333. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  334. const outputCodePath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  335. const sourceMapFileName: string = 'foo.js.map';
  336. const expectedOutputSourceMapPath: string = path.join(tmpDirectoryPath, 'output', 'foo.js.map');
  337. let outputSourceMapPath: string;
  338. before(() => {
  339. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  340. rawInputPath,
  341. {
  342. output: rawOutputPath
  343. }
  344. );
  345. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath, sourceMapFileName);
  346. });
  347. it('should return output path for source map', () => {
  348. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  349. });
  350. });
  351. describe('Variant #8: source map file name is a path', () => {
  352. const rawInputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  353. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  354. const outputCodePath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  355. const sourceMapFileName: string = path.join('parent', 'foo.js.map');
  356. const expectedOutputSourceMapPath: string = path.join(tmpDirectoryPath, 'output', 'parent', 'foo.js.map');
  357. let outputSourceMapPath: string;
  358. before(() => {
  359. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  360. rawInputPath,
  361. {
  362. output: rawOutputPath
  363. }
  364. );
  365. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath, sourceMapFileName);
  366. });
  367. it('should return output path for source map', () => {
  368. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  369. });
  370. });
  371. describe('Variant #9: Win32 environment', () => {
  372. describe('Variant #1: output code path is a directory path', () => {
  373. const rawInputPath: string = path.join('C:\\', tmpDirectoryPath, 'input', 'test-input.js');
  374. const rawOutputPath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'test-output.js');
  375. const outputCodePath: string = path.join('C:\\', tmpDirectoryPath, 'output');
  376. const sourceMapFileName: string = path.join('foo');
  377. const expectedOutputSourceMapPath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'foo.js.map');
  378. let outputSourceMapPath: string;
  379. before(() => {
  380. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  381. rawInputPath,
  382. {
  383. output: rawOutputPath
  384. }
  385. );
  386. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath, sourceMapFileName);
  387. });
  388. it('should return output path for source map', () => {
  389. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  390. });
  391. });
  392. describe('Variant #2: source map file name is a file name without extension', () => {
  393. const rawInputPath: string = path.join('C:\\', tmpDirectoryPath, 'input', 'test-input.js');
  394. const rawOutputPath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'test-output.js');
  395. const outputCodePath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'test-output.js');
  396. const sourceMapFileName: string = path.join('foo');
  397. const expectedOutputSourceMapPath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'foo.js.map');
  398. let outputSourceMapPath: string;
  399. before(() => {
  400. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  401. rawInputPath,
  402. {
  403. output: rawOutputPath
  404. }
  405. );
  406. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath, sourceMapFileName);
  407. });
  408. it('should return output path for source map', () => {
  409. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  410. });
  411. });
  412. describe('Variant #3: source map file name is a file name with an extension', () => {
  413. const rawInputPath: string = path.join('C:\\', tmpDirectoryPath, 'input', 'test-input.js');
  414. const rawOutputPath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'test-output.js');
  415. const outputCodePath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'test-output.js');
  416. const sourceMapFileName: string = path.join('foo.js.map');
  417. const expectedOutputSourceMapPath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'foo.js.map');
  418. let outputSourceMapPath: string;
  419. before(() => {
  420. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  421. rawInputPath,
  422. {
  423. output: rawOutputPath
  424. }
  425. );
  426. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath, sourceMapFileName);
  427. });
  428. it('should return output path for source map', () => {
  429. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  430. });
  431. });
  432. describe('Variant #4: output path and win32 path in source map file name', () => {
  433. const rawInputPath: string = path.join('C:\\', tmpDirectoryPath, 'input', 'test-input.js');
  434. const rawOutputPath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'test-output.js');
  435. const outputCodePath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'test-output.js');
  436. const sourceMapFileName: string = path.join('C:\\', 'parent', 'foo.js.map');
  437. const expectedOutputSourceMapPath: string = path.join('C:\\', tmpDirectoryPath, 'output', 'parent', 'foo.js.map');
  438. let outputSourceMapPath: string;
  439. before(() => {
  440. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  441. rawInputPath,
  442. {
  443. output: rawOutputPath
  444. }
  445. );
  446. outputSourceMapPath = obfuscatedCodeWriter.getOutputSourceMapPath(outputCodePath, sourceMapFileName);
  447. });
  448. it('should return output path for source map', () => {
  449. assert.equal(outputSourceMapPath, expectedOutputSourceMapPath);
  450. });
  451. });
  452. });
  453. describe('Variant #10: empty paths', () => {
  454. const rawInputPath: string = path.join(tmpDirectoryPath, 'input', 'test-input.js');
  455. const rawOutputPath: string = path.join(tmpDirectoryPath, 'output', 'test-output.js');
  456. let testFunc: () => string;
  457. before(() => {
  458. const obfuscatedCodeWriter: ObfuscatedCodeWriter = new ObfuscatedCodeWriter(
  459. rawInputPath,
  460. {
  461. output: rawOutputPath
  462. }
  463. );
  464. testFunc = () => obfuscatedCodeWriter.getOutputSourceMapPath('', '');
  465. });
  466. it('should throw an error if output code path is empty', () => {
  467. assert.throws(testFunc, Error);
  468. });
  469. });
  470. });
  471. });