process-file.spec.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. 'use strict';
  2. /**
  3. * Dependencies
  4. */
  5. import transform, {sync, processFile, processFileSync} from './process-file';
  6. const fs = require('fs');
  7. const writeFile = Promise.promisify(fs.writeFile);
  8. const deleteFile = Promise.promisify(fs.unlink);
  9. /**
  10. * Specifications
  11. */
  12. describe('Process a file', () => {
  13. //Test JSON
  14. const testData = 'a re place c';
  15. /**
  16. * Prepare test files
  17. */
  18. beforeEach(() => Promise.all([
  19. writeFile('test1', testData, 'utf8'),
  20. writeFile('test2', testData, 'utf8'),
  21. writeFile('test3', 'nope', 'utf8'),
  22. ]));
  23. /**
  24. * Clean up test files
  25. */
  26. afterEach(() => Promise.all([
  27. deleteFile('test1'),
  28. deleteFile('test2'),
  29. deleteFile('test3'),
  30. ]));
  31. function fromToToProcessor(config) {
  32. const from = config.from;
  33. const to = config.to;
  34. delete config.from;
  35. delete config.to;
  36. config.processor = (content) => {
  37. return content.replace(from, to);
  38. };
  39. return config;
  40. }
  41. /**
  42. * Async with promises
  43. */
  44. describe('Async with promises', () => {
  45. it('should run processor', done => {
  46. transform({
  47. files: 'test1',
  48. processor: (input) => {
  49. return input.replace(/re\splace/g, 'b');
  50. },
  51. }).then(() => {
  52. const test1 = fs.readFileSync('test1', 'utf8');
  53. const test2 = fs.readFileSync('test2', 'utf8');
  54. console.log(test1);
  55. expect(test1).to.equal('a b c');
  56. expect(test2).to.equal(testData);
  57. done();
  58. });
  59. });
  60. it('should throw an error when no config provided', () => {
  61. return expect(transform()).to.eventually.be.rejectedWith(Error);
  62. });
  63. it('should throw an error when invalid config provided', () => {
  64. return expect(transform(42)).to.eventually.be.rejectedWith(Error);
  65. });
  66. it('should throw an error when no `files` defined', () => {
  67. return expect(transform(fromToToProcessor({
  68. from: /re\splace/g,
  69. to: 'b',
  70. }))).to.eventually.be.rejectedWith(Error);
  71. });
  72. it('should replace contents in a single file with regex', done => {
  73. transform(fromToToProcessor({
  74. files: 'test1',
  75. from: /re\splace/g,
  76. to: 'b',
  77. })).then(() => {
  78. const test1 = fs.readFileSync('test1', 'utf8');
  79. const test2 = fs.readFileSync('test2', 'utf8');
  80. expect(test1).to.equal('a b c');
  81. expect(test2).to.equal(testData);
  82. done();
  83. });
  84. });
  85. it('should replace contents with a string replacement', done => {
  86. transform(fromToToProcessor({
  87. files: 'test1',
  88. from: 're place',
  89. to: 'b',
  90. })).then(() => {
  91. const test1 = fs.readFileSync('test1', 'utf8');
  92. expect(test1).to.equal('a b c');
  93. done();
  94. });
  95. });
  96. it('should replace contents in a an array of files', done => {
  97. transform(fromToToProcessor({
  98. files: ['test1', 'test2'],
  99. from: /re\splace/g,
  100. to: 'b',
  101. })).then(() => {
  102. const test1 = fs.readFileSync('test1', 'utf8');
  103. const test2 = fs.readFileSync('test2', 'utf8');
  104. expect(test1).to.equal('a b c');
  105. expect(test2).to.equal('a b c');
  106. done();
  107. });
  108. });
  109. it('should expand globs', done => {
  110. transform(fromToToProcessor({
  111. files: 'test*',
  112. from: /re\splace/g,
  113. to: 'b',
  114. })).then(() => {
  115. const test1 = fs.readFileSync('test1', 'utf8');
  116. const test2 = fs.readFileSync('test2', 'utf8');
  117. expect(test1).to.equal('a b c');
  118. expect(test2).to.equal('a b c');
  119. done();
  120. });
  121. });
  122. it('should expand globs while excluding ignored files', done => {
  123. transform(fromToToProcessor({
  124. files: 'test*',
  125. ignore: 'test1',
  126. from: /re\splace/g,
  127. to: 'b',
  128. })).then(() => {
  129. const test1 = fs.readFileSync('test1', 'utf8');
  130. const test2 = fs.readFileSync('test2', 'utf8');
  131. expect(test1).to.equal('a re place c');
  132. expect(test2).to.equal('a b c');
  133. done();
  134. });
  135. });
  136. it('should replace substrings', done => {
  137. transform(fromToToProcessor({
  138. files: 'test1',
  139. from: /(re)\s(place)/g,
  140. to: '$2 $1',
  141. })).then(() => {
  142. const test1 = fs.readFileSync('test1', 'utf8');
  143. expect(test1).to.equal('a place re c');
  144. done();
  145. });
  146. });
  147. it('should fulfill the promise on success', () => {
  148. return transform(fromToToProcessor({
  149. files: 'test1',
  150. from: /re\splace/g,
  151. to: 'b',
  152. })).should.be.fulfilled;
  153. });
  154. it('should reject the promise with an error on failure', () => {
  155. return expect(transform(fromToToProcessor({
  156. files: 'nope',
  157. from: /re\splace/g,
  158. to: 'b',
  159. }))).to.eventually.be.rejectedWith(Error);
  160. });
  161. it('should not reject the promise if allowEmptyPaths is true', () => {
  162. return transform(fromToToProcessor({
  163. files: 'nope',
  164. allowEmptyPaths: true,
  165. from: /re\splace/g,
  166. to: 'b',
  167. })).should.be.fulfilled;
  168. });
  169. it('should return a results array', done => {
  170. transform(fromToToProcessor({
  171. files: 'test1',
  172. from: /re\splace/g,
  173. to: 'b',
  174. })).then(results => {
  175. expect(results).to.be.instanceof(Array);
  176. expect(results).to.have.length(1);
  177. expect(results[0].file).to.equal('test1');
  178. done();
  179. });
  180. });
  181. it('should mark if something was replaced', done => {
  182. transform(fromToToProcessor({
  183. files: 'test1',
  184. from: /re\splace/g,
  185. to: 'b',
  186. })).then(results => {
  187. expect(results[0].hasChanged).to.equal(true);
  188. done();
  189. });
  190. });
  191. it('should not mark if nothing was replaced', done => {
  192. transform(fromToToProcessor({
  193. files: 'test1',
  194. from: 'nope',
  195. to: 'b',
  196. })).then(results => {
  197. expect(results[0].hasChanged).to.equal(false);
  198. done();
  199. });
  200. });
  201. it('should return correct results for multiple files', done => {
  202. transform(fromToToProcessor({
  203. files: ['test1', 'test2', 'test3'],
  204. from: /re\splace/g,
  205. to: 'b',
  206. })).then(results => {
  207. expect(results).to.have.length(3);
  208. expect(results[0].file).to.equal('test1');
  209. expect(results[0].hasChanged).to.equal(true);
  210. expect(results[1].file).to.equal('test2');
  211. expect(results[1].hasChanged).to.equal(true);
  212. expect(results[2].file).to.equal('test3');
  213. expect(results[2].hasChanged).to.equal(false);
  214. done();
  215. });
  216. });
  217. it('should not replace in a dry run', done => {
  218. transform(fromToToProcessor({
  219. files: ['test1', 'test2'],
  220. from: /re\splace/g,
  221. to: 'b',
  222. dry: true,
  223. })).then(() => {
  224. const test1 = fs.readFileSync('test1', 'utf8');
  225. const test2 = fs.readFileSync('test2', 'utf8');
  226. expect(test1).to.equal('a re place c');
  227. expect(test2).to.equal('a re place c');
  228. done();
  229. });
  230. });
  231. it('should return changed files for a dry run', done => {
  232. transform(fromToToProcessor({
  233. files: ['test1', 'test2', 'test3'],
  234. from: /re\splace/g,
  235. to: 'b',
  236. dry: true,
  237. })).then(results => {
  238. expect(results).to.have.length(3);
  239. expect(results[0].file).to.equal('test1');
  240. expect(results[0].hasChanged).to.equal(true);
  241. expect(results[1].file).to.equal('test2');
  242. expect(results[1].hasChanged).to.equal(true);
  243. expect(results[2].file).to.equal('test3');
  244. expect(results[2].hasChanged).to.equal(false);
  245. done();
  246. });
  247. });
  248. it('should accept glob configuration', done => {
  249. transform(fromToToProcessor({
  250. files: 'test1',
  251. from: /re\splace/g,
  252. to: 'b',
  253. allowEmptyPaths: true,
  254. glob: {
  255. ignore: ['test1'],
  256. },
  257. })).then(() => {
  258. const test1 = fs.readFileSync('test1', 'utf8');
  259. expect(test1).to.equal('a re place c');
  260. done();
  261. });
  262. });
  263. it('should ignore empty glob configuration', done => {
  264. transform(fromToToProcessor({
  265. files: 'test1',
  266. from: /re\splace/g,
  267. to: 'b',
  268. glob: null,
  269. })).then(() => {
  270. const test1 = fs.readFileSync('test1', 'utf8');
  271. expect(test1).to.equal('a b c');
  272. done();
  273. });
  274. });
  275. });
  276. /**
  277. * Async with callback
  278. */
  279. describe('Async with callback', () => {
  280. it('should throw an error when no config provided', done => {
  281. transform(null, (error) => {
  282. expect(error).to.be.instanceof(Error);
  283. done();
  284. });
  285. });
  286. it('should throw an error when invalid config provided', done => {
  287. transform(42, (error) => {
  288. expect(error).to.be.instanceof(Error);
  289. done();
  290. });
  291. });
  292. it('should throw an error when no `files` defined', done => {
  293. transform(fromToToProcessor({
  294. from: /re\splace/g,
  295. to: 'b',
  296. }), (error) => {
  297. expect(error).to.be.instanceof(Error);
  298. done();
  299. });
  300. });
  301. it('should replace contents in a single file with regex', done => {
  302. transform(fromToToProcessor({
  303. files: 'test1',
  304. from: /re\splace/g,
  305. to: 'b',
  306. }), () => {
  307. const test1 = fs.readFileSync('test1', 'utf8');
  308. const test2 = fs.readFileSync('test2', 'utf8');
  309. expect(test1).to.equal('a b c');
  310. expect(test2).to.equal(testData);
  311. done();
  312. });
  313. });
  314. it('should replace contents with a string replacement', done => {
  315. transform(fromToToProcessor({
  316. files: 'test1',
  317. from: 're place',
  318. to: 'b',
  319. }), () => {
  320. const test1 = fs.readFileSync('test1', 'utf8');
  321. expect(test1).to.equal('a b c');
  322. done();
  323. });
  324. });
  325. it('should replace contents in a an array of files', done => {
  326. transform(fromToToProcessor({
  327. files: ['test1', 'test2'],
  328. from: /re\splace/g,
  329. to: 'b',
  330. }), () => {
  331. const test1 = fs.readFileSync('test1', 'utf8');
  332. const test2 = fs.readFileSync('test2', 'utf8');
  333. expect(test1).to.equal('a b c');
  334. expect(test2).to.equal('a b c');
  335. done();
  336. });
  337. });
  338. it('should expand globs', done => {
  339. transform(fromToToProcessor({
  340. files: 'test*',
  341. from: /re\splace/g,
  342. to: 'b',
  343. }), () => {
  344. const test1 = fs.readFileSync('test1', 'utf8');
  345. const test2 = fs.readFileSync('test2', 'utf8');
  346. expect(test1).to.equal('a b c');
  347. expect(test2).to.equal('a b c');
  348. done();
  349. });
  350. });
  351. it('should expand globs while excluding ignored files', done => {
  352. transform(fromToToProcessor({
  353. files: 'test*',
  354. ignore: 'test1',
  355. from: /re\splace/g,
  356. to: 'b',
  357. }), () => {
  358. const test1 = fs.readFileSync('test1', 'utf8');
  359. const test2 = fs.readFileSync('test2', 'utf8');
  360. expect(test1).to.equal('a re place c');
  361. expect(test2).to.equal('a b c');
  362. done();
  363. });
  364. });
  365. it('should not return an error on success', done => {
  366. transform(fromToToProcessor({
  367. files: 'test1',
  368. from: /re\splace/g,
  369. to: 'b',
  370. }), (error) => {
  371. expect(error).to.equal(null);
  372. done();
  373. });
  374. });
  375. it('should return an error on failure', done => {
  376. transform(fromToToProcessor({
  377. files: 'nope',
  378. from: /re\splace/g,
  379. to: 'b',
  380. }), (error) => {
  381. expect(error).to.be.instanceof(Error);
  382. done();
  383. });
  384. });
  385. it('should not return an error if allowEmptyPaths is true', done => {
  386. transform(fromToToProcessor({
  387. files: 'nope',
  388. allowEmptyPaths: true,
  389. from: /re\splace/g,
  390. to: 'b',
  391. }), (error) => {
  392. expect(error).to.equal(null);
  393. done();
  394. });
  395. });
  396. it('should return a results array', done => {
  397. transform(fromToToProcessor({
  398. files: 'test1',
  399. from: /re\splace/g,
  400. to: 'b',
  401. }), (error, results) => {
  402. expect(results).to.be.instanceof(Array);
  403. expect(results).to.have.length(1);
  404. expect(results[0].file).to.equal('test1');
  405. done();
  406. });
  407. });
  408. it('should mark if something was replaced', done => {
  409. transform(fromToToProcessor({
  410. files: 'test1',
  411. from: /re\splace/g,
  412. to: 'b',
  413. }), (error, results) => {
  414. expect(results[0].hasChanged).to.equal(true);
  415. done();
  416. });
  417. });
  418. it('should not mark if nothing was replaced', done => {
  419. transform(fromToToProcessor({
  420. files: 'test1',
  421. from: 'nope',
  422. to: 'b',
  423. }), (error, results) => {
  424. expect(results[0].hasChanged).to.equal(false);
  425. done();
  426. });
  427. });
  428. it('should return correct results for multiple files', done => {
  429. transform(fromToToProcessor({
  430. files: ['test1', 'test2', 'test3'],
  431. from: /re\splace/g,
  432. to: 'b',
  433. }), (error, results) => {
  434. expect(results).to.have.length(3);
  435. expect(results[0].file).to.equal('test1');
  436. expect(results[0].hasChanged).to.equal(true);
  437. expect(results[1].file).to.equal('test2');
  438. expect(results[1].hasChanged).to.equal(true);
  439. expect(results[2].file).to.equal('test3');
  440. expect(results[2].hasChanged).to.equal(false);
  441. done();
  442. });
  443. });
  444. it('should work without expanding globs if disabled', done => {
  445. transform(fromToToProcessor({
  446. files: ['test1', 'test2'],
  447. from: /re\splace/g,
  448. to: 'b',
  449. disableGlobs: true,
  450. }), () => {
  451. const test1 = fs.readFileSync('test1', 'utf8');
  452. const test2 = fs.readFileSync('test2', 'utf8');
  453. expect(test1).to.equal('a b c');
  454. expect(test2).to.equal('a b c');
  455. done();
  456. });
  457. });
  458. });
  459. /**
  460. * Sync
  461. */
  462. describe('Sync', () => {
  463. it('should throw an error when no config provided', () => {
  464. expect(function() {
  465. transform.sync();
  466. }).to.throw(Error);
  467. });
  468. it('should throw an error when invalid config provided', () => {
  469. expect(function() {
  470. transform.sync(42);
  471. }).to.throw(Error);
  472. });
  473. it('should throw an error when no `files` defined', () => {
  474. expect(function() {
  475. transform.sync(fromToToProcessor({
  476. from: /re\splace/g,
  477. to: 'b',
  478. }));
  479. }).to.throw(Error);
  480. });
  481. it('should support the encoding parameter', () => {
  482. expect(function() {
  483. transform.sync(fromToToProcessor({
  484. files: 'test1',
  485. from: /re\splace/g,
  486. to: 'b',
  487. encoding: 'utf-8',
  488. }));
  489. }).to.not.throw(Error);
  490. });
  491. it('should fall back to utf-8 encoding with invalid configuration', () => {
  492. expect(function() {
  493. transform.sync(fromToToProcessor({
  494. files: 'test1',
  495. from: /re\splace/g,
  496. to: 'b',
  497. encoding: '',
  498. }));
  499. }).to.not.throw(Error);
  500. expect(function() {
  501. transform.sync(fromToToProcessor({
  502. files: 'test1',
  503. from: /re\splace/g,
  504. to: 'b',
  505. encoding: null,
  506. }));
  507. }).to.not.throw(Error);
  508. });
  509. it('should replace contents in a single file with regex', function() {
  510. transform.sync(fromToToProcessor({
  511. files: 'test1',
  512. from: /re\splace/g,
  513. to: 'b',
  514. }));
  515. const test1 = fs.readFileSync('test1', 'utf8');
  516. const test2 = fs.readFileSync('test2', 'utf8');
  517. expect(test1).to.equal('a b c');
  518. expect(test2).to.equal(testData);
  519. });
  520. it('should replace contents with a string replacement', function() {
  521. transform.sync(fromToToProcessor({
  522. files: 'test1',
  523. from: 're place',
  524. to: 'b',
  525. }));
  526. const test1 = fs.readFileSync('test1', 'utf8');
  527. expect(test1).to.equal('a b c');
  528. });
  529. it('should replace contents in a an array of files', function() {
  530. transform.sync(fromToToProcessor({
  531. files: ['test1', 'test2'],
  532. from: /re\splace/g,
  533. to: 'b',
  534. }));
  535. const test1 = fs.readFileSync('test1', 'utf8');
  536. const test2 = fs.readFileSync('test2', 'utf8');
  537. expect(test1).to.equal('a b c');
  538. expect(test2).to.equal('a b c');
  539. });
  540. it('should expand globs', function() {
  541. transform.sync(fromToToProcessor({
  542. files: 'test*',
  543. from: /re\splace/g,
  544. to: 'b',
  545. }));
  546. const test1 = fs.readFileSync('test1', 'utf8');
  547. const test2 = fs.readFileSync('test2', 'utf8');
  548. expect(test1).to.equal('a b c');
  549. expect(test2).to.equal('a b c');
  550. });
  551. it('should return a results array', function() {
  552. const results = transform.sync(fromToToProcessor({
  553. files: 'test1',
  554. from: /re\splace/g,
  555. to: 'b',
  556. }));
  557. expect(results).to.be.instanceof(Array);
  558. expect(results).to.have.length(1);
  559. expect(results[0].file).to.equal('test1');
  560. });
  561. it('should mark if something was replaced', function() {
  562. const results = transform.sync(fromToToProcessor({
  563. files: 'test1',
  564. from: /re\splace/g,
  565. to: 'b',
  566. }));
  567. expect(results[0].hasChanged).to.equal(true);
  568. });
  569. it('should not mark if nothing was replaced', function() {
  570. const results = transform.sync(fromToToProcessor({
  571. files: 'test1',
  572. from: 'nope',
  573. to: 'b',
  574. }));
  575. expect(results[0].hasChanged).to.equal(false);
  576. });
  577. it('should return corret results for multiple files', function() {
  578. const results = transform.sync(fromToToProcessor({
  579. files: ['test1', 'test2', 'test3'],
  580. from: /re\splace/g,
  581. to: 'b',
  582. }));
  583. expect(results).to.have.length(3);
  584. expect(results[0].file).to.equal('test1');
  585. expect(results[0].hasChanged).to.equal(true);
  586. expect(results[1].file).to.equal('test2');
  587. expect(results[1].hasChanged).to.equal(true);
  588. expect(results[2].file).to.equal('test3');
  589. expect(results[2].hasChanged).to.equal(false);
  590. });
  591. it('should expand globs while excluding ignored files', () => {
  592. transform.sync(fromToToProcessor({
  593. files: 'test*',
  594. ignore: 'test1',
  595. from: /re\splace/g,
  596. to: 'b',
  597. }));
  598. const test1 = fs.readFileSync('test1', 'utf8');
  599. const test2 = fs.readFileSync('test2', 'utf8');
  600. expect(test1).to.equal('a re place c');
  601. expect(test2).to.equal('a b c');
  602. });
  603. it('should support an array of ignored files', () => {
  604. transform.sync(fromToToProcessor({
  605. files: 'test*',
  606. ignore: ['test1', 'test3'],
  607. from: /re\splace/g,
  608. to: 'b',
  609. }));
  610. const test1 = fs.readFileSync('test1', 'utf8');
  611. const test2 = fs.readFileSync('test2', 'utf8');
  612. expect(test1).to.equal('a re place c');
  613. expect(test2).to.equal('a b c');
  614. });
  615. it('should not fail when the ignore parameter is undefined', () => {
  616. transform.sync(fromToToProcessor({
  617. files: 'test*',
  618. ignore: undefined,
  619. from: /re\splace/g,
  620. to: 'b',
  621. }));
  622. const test1 = fs.readFileSync('test1', 'utf8');
  623. const test2 = fs.readFileSync('test2', 'utf8');
  624. expect(test1).to.equal('a b c');
  625. expect(test2).to.equal('a b c');
  626. });
  627. it('should work without expanding globs if disabled', () => {
  628. transform.sync(fromToToProcessor({
  629. files: ['test1', 'test2'],
  630. from: /re\splace/g,
  631. to: 'b',
  632. disableGlobs: true,
  633. }));
  634. const test1 = fs.readFileSync('test1', 'utf8');
  635. const test2 = fs.readFileSync('test2', 'utf8');
  636. expect(test1).to.equal('a b c');
  637. expect(test2).to.equal('a b c');
  638. });
  639. it('should not replace in a dry run', () => {
  640. transform.sync(fromToToProcessor({
  641. files: ['test1', 'test2'],
  642. from: /re\splace/g,
  643. to: 'b',
  644. dry: true,
  645. }));
  646. const test1 = fs.readFileSync('test1', 'utf8');
  647. const test2 = fs.readFileSync('test2', 'utf8');
  648. expect(test1).to.equal('a re place c');
  649. expect(test2).to.equal('a re place c');
  650. });
  651. it('should return changed files for a dry run', () => {
  652. const results = transform.sync(fromToToProcessor({
  653. files: ['test1', 'test2', 'test3'],
  654. from: /re\splace/g,
  655. to: 'b',
  656. dry: true,
  657. }));
  658. expect(results).to.have.length(3);
  659. expect(results[0].file).to.equal('test1');
  660. expect(results[0].hasChanged).to.equal(true);
  661. expect(results[1].file).to.equal('test2');
  662. expect(results[1].hasChanged).to.equal(true);
  663. expect(results[2].file).to.equal('test3');
  664. expect(results[2].hasChanged).to.equal(false);
  665. });
  666. });
  667. describe('module export', () => {
  668. it('default module export refers to async replace implementation', () => {
  669. expect(transform).to.be.a('function');
  670. });
  671. it(`exports named processFile, processFileSync and sync from module facade`, () => {
  672. expect(processFile).to.be.a('function');
  673. expect(processFileSync).to.be.a('function');
  674. expect(sync).to.be.a('function');
  675. });
  676. it('exposes inner functions as own fields of transform', () => {
  677. expect(transform.processFile).to.equal(transform);
  678. expect(transform.sync).to.equal(processFileSync);
  679. expect(transform.processFileSync).to.equal(processFileSync);
  680. });
  681. });
  682. });