2222 * SOFTWARE.
2323 */
2424
25- 'use strict' ;
26-
27- const path = require ( 'path' ) ;
28- const prettier = require ( 'prettier' ) ;
29- const plugin = require ( '../src/index-rollup-legacy.js' ) ;
30- const verifyWarnLogsBecauseOfSourcemap = require ( './utils/verify-warn-logs-because-of-source-map.js' ) ;
31- const verifyWarnLogsNotTriggered = require ( './utils/verify-warn-logs-not-triggered.js' ) ;
32- const installWarnSpy = require ( './utils/install-warn-spy.js' ) ;
25+ import path from 'path' ;
26+ import prettier from 'prettier' ;
27+ import { rollupPluginPrettierLegacy } from '../src/index-rollup-legacy.js' ;
28+ import { verifyWarnLogsBecauseOfSourcemap } from './utils/verify-warn-logs-because-of-source-map.js' ;
29+ import { verifyWarnLogsNotTriggered } from './utils/verify-warn-logs-not-triggered.js' ;
30+ import { installWarnSpy } from './utils/install-warn-spy.js' ;
3331
3432describe ( 'rollup-plugin-prettier [legacy]' , ( ) => {
3533 beforeEach ( ( ) => {
3634 installWarnSpy ( ) ;
3735 } ) ;
3836
3937 it ( 'should have a name' , ( ) => {
40- const instance = plugin ( ) ;
38+ const instance = rollupPluginPrettierLegacy ( ) ;
4139 expect ( instance . name ) . toBe ( 'rollup-plugin-prettier' ) ;
4240 } ) ;
4341
4442 it ( 'should run prettier' , ( ) => {
45- const instance = plugin ( {
43+ const instance = rollupPluginPrettierLegacy ( {
4644 parser : 'babel' ,
4745 } ) ;
4846
@@ -59,7 +57,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
5957 } ) ;
6058
6159 it ( 'should run prettier with sourceMap (camelcase) in input options [rollup < 0.48]' , ( ) => {
62- const instance = plugin ( {
60+ const instance = rollupPluginPrettierLegacy ( {
6361 parser : 'babel' ,
6462 } ) ;
6563
@@ -80,7 +78,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
8078 } ) ;
8179
8280 it ( 'should run prettier with sourcemap (lowercase) in input options [rollup >= 0.48]' , ( ) => {
83- const instance = plugin ( {
81+ const instance = rollupPluginPrettierLegacy ( {
8482 parser : 'babel' ,
8583 } ) ;
8684
@@ -101,7 +99,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
10199 } ) ;
102100
103101 it ( 'should run prettier with sourcemap (lowercase) in output options' , ( ) => {
104- const instance = plugin ( {
102+ const instance = rollupPluginPrettierLegacy ( {
105103 parser : 'babel' ,
106104 } ) ;
107105
@@ -121,7 +119,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
121119 } ) ;
122120
123121 it ( 'should run prettier with sourcemap in output options (camelcase format)' , ( ) => {
124- const instance = plugin ( {
122+ const instance = rollupPluginPrettierLegacy ( {
125123 parser : 'babel' ,
126124 } ) ;
127125
@@ -141,7 +139,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
141139 } ) ;
142140
143141 it ( 'should run prettier with sourcemap (lowercase) in plugin options' , ( ) => {
144- const instance = plugin ( {
142+ const instance = rollupPluginPrettierLegacy ( {
145143 sourcemap : true ,
146144 parser : 'babel' ,
147145 } ) ;
@@ -161,7 +159,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
161159 } ) ;
162160
163161 it ( 'should run prettier with sourcemap (camelcase) in plugin options' , ( ) => {
164- const instance = plugin ( {
162+ const instance = rollupPluginPrettierLegacy ( {
165163 sourceMap : true ,
166164 parser : 'babel' ,
167165 } ) ;
@@ -181,7 +179,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
181179 } ) ;
182180
183181 it ( 'should run prettier with sourcemap (lowercase) disabled in output options' , ( ) => {
184- const instance = plugin ( {
182+ const instance = rollupPluginPrettierLegacy ( {
185183 parser : 'babel' ,
186184 } ) ;
187185
@@ -201,7 +199,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
201199 } ) ;
202200
203201 it ( 'should run prettier with sourcemap (camelcase) disabled in output options' , ( ) => {
204- const instance = plugin ( {
202+ const instance = rollupPluginPrettierLegacy ( {
205203 parser : 'babel' ,
206204 } ) ;
207205
@@ -226,7 +224,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
226224 singleQuote : true ,
227225 } ;
228226
229- const instance = plugin ( options ) ;
227+ const instance = rollupPluginPrettierLegacy ( options ) ;
230228 const code = 'var foo=0;var test="hello world";' ;
231229 const outputOptions = { sourcemap : false } ;
232230 const result = instance . transformBundle ( code , outputOptions ) ;
@@ -238,7 +236,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
238236 } ) ;
239237
240238 it ( 'should remove unnecessary spaces' , ( ) => {
241- const instance = plugin ( {
239+ const instance = rollupPluginPrettierLegacy ( {
242240 parser : 'babel' ,
243241 } ) ;
244242
@@ -253,7 +251,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
253251 } ) ;
254252
255253 it ( 'should add and remove characters' , ( ) => {
256- const instance = plugin ( {
254+ const instance = rollupPluginPrettierLegacy ( {
257255 parser : 'babel' ,
258256 } ) ;
259257
@@ -273,7 +271,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
273271 sourcemap : false ,
274272 } ;
275273
276- const instance = plugin ( options ) ;
274+ const instance = rollupPluginPrettierLegacy ( options ) ;
277275 const code = 'var foo = 0;' ;
278276 const outputOptions = { } ;
279277 instance . transformBundle ( code , outputOptions ) ;
@@ -294,7 +292,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
294292 spyOn ( prettier , 'format' ) . and . callThrough ( ) ;
295293
296294 const code = 'var foo = 0;' ;
297- const instance = plugin ( options ) ;
295+ const instance = rollupPluginPrettierLegacy ( options ) ;
298296 const outputOptions = { } ;
299297 instance . transformBundle ( code , outputOptions ) ;
300298
@@ -318,7 +316,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
318316 spyOn ( prettier , 'format' ) . and . callThrough ( ) ;
319317
320318 const code = 'var foo = 0;' ;
321- const instance = plugin ( options ) ;
319+ const instance = rollupPluginPrettierLegacy ( options ) ;
322320 const outputOptions = { } ;
323321 instance . transformBundle ( code , outputOptions ) ;
324322
@@ -344,7 +342,7 @@ describe('rollup-plugin-prettier [legacy]', () => {
344342
345343 spyOn ( prettier , 'format' ) . and . callThrough ( ) ;
346344
347- const instance = plugin ( options ) ;
345+ const instance = rollupPluginPrettierLegacy ( options ) ;
348346 const code = 'var foo = 0;' ;
349347 const outputOptions = { } ;
350348 instance . transformBundle ( code , outputOptions ) ;
0 commit comments