@@ -2,11 +2,7 @@ import * as fs from 'fs';
22import * as path from 'path' ;
33import executor from './executor' ;
44import { AddLicenseHeadersExecutorSchema } from './schema' ;
5- import {
6- createTempDir ,
7- cleanupTempDir ,
8- createMockContext ,
9- } from '../../utils/test-utils' ;
5+ import { createTempDir , cleanupTempDir , createMockContext } from '../../utils/test-utils' ;
106import { writeFileText , writeJson , readFileText } from '../../utils' ;
117
128describe ( 'AddLicenseHeadersExecutor E2E' , ( ) => {
@@ -29,23 +25,20 @@ describe('AddLicenseHeadersExecutor E2E', () => {
2925
3026 await writeFileText (
3127 path . join ( npmDir , 'index.js' ) ,
32- `export function hello() {\n return 'Hello';\n}\n`
28+ `export function hello() {\n return 'Hello';\n}\n` ,
3329 ) ;
3430
35- await writeFileText (
36- path . join ( npmDir , 'utils.js' ) ,
37- `export const add = (a, b) => a + b;\n`
38- ) ;
31+ await writeFileText ( path . join ( npmDir , 'utils.js' ) , `export const add = (a, b) => a + b;\n` ) ;
3932
4033 fs . mkdirSync ( path . join ( npmDir , 'components' ) , { recursive : true } ) ;
4134 await writeFileText (
4235 path . join ( npmDir , 'components' , 'button.js' ) ,
43- `export const Button = () => {};\n`
36+ `export const Button = () => {};\n` ,
4437 ) ;
4538
4639 await writeFileText (
4740 path . join ( npmDir , 'types.ts' ) ,
48- `export interface Config { name: string; }\n`
41+ `export interface Config { name: string; }\n` ,
4942 ) ;
5043 } ) ;
5144
@@ -90,9 +83,7 @@ describe('AddLicenseHeadersExecutor E2E', () => {
9083 expect ( result . success ) . toBe ( true ) ;
9184
9285 const npmDir = path . join ( tempDir , 'packages' , 'test-lib' , 'npm' ) ;
93- const buttonContent = await readFileText (
94- path . join ( npmDir , 'components' , 'button.js' )
95- ) ;
86+ const buttonContent = await readFileText ( path . join ( npmDir , 'components' , 'button.js' ) ) ;
9687
9788 expect ( buttonContent ) . toMatch ( / ^ \/ \* ! / ) ;
9889 expect ( buttonContent ) . toContain ( 'test-package' ) ;
@@ -148,7 +139,7 @@ describe('AddLicenseHeadersExecutor E2E', () => {
148139
149140 await writeFileText (
150141 path . join ( npmDir , 'with-header.js' ) ,
151- `/*!\n * Existing header\n */\nexport const foo = 'bar';\n`
142+ `/*!\n * Existing header\n */\nexport const foo = 'bar';\n` ,
152143 ) ;
153144
154145 const options : AddLicenseHeadersExecutorSchema = {
@@ -241,10 +232,7 @@ describe('AddLicenseHeadersExecutor E2E', () => {
241232 it ( 'should fail gracefully with invalid package.json' , async ( ) => {
242233 const projectDir = path . join ( tempDir , 'packages' , 'test-lib' ) ;
243234
244- await writeFileText (
245- path . join ( projectDir , 'package.json' ) ,
246- 'not valid json {{{}'
247- ) ;
235+ await writeFileText ( path . join ( projectDir , 'package.json' ) , 'not valid json {{{}' ) ;
248236
249237 const options : AddLicenseHeadersExecutorSchema = {
250238 targetDirectory : './npm' ,
@@ -278,10 +266,7 @@ describe('AddLicenseHeadersExecutor E2E', () => {
278266 const customDir = path . join ( projectDir , 'dist' ) ;
279267 fs . mkdirSync ( customDir , { recursive : true } ) ;
280268
281- await writeFileText (
282- path . join ( customDir , 'custom.js' ) ,
283- `export const custom = true;\n`
284- ) ;
269+ await writeFileText ( path . join ( customDir , 'custom.js' ) , `export const custom = true;\n` ) ;
285270
286271 const options : AddLicenseHeadersExecutorSchema = {
287272 targetDirectory : './dist' ,
@@ -300,13 +285,10 @@ describe('AddLicenseHeadersExecutor E2E', () => {
300285 it ( 'should work with custom package.json path' , async ( ) => {
301286 const projectDir = path . join ( tempDir , 'packages' , 'test-lib' ) ;
302287
303- await writeJson (
304- path . join ( projectDir , 'custom-package.json' ) ,
305- {
306- name : 'custom-package-name' ,
307- version : '2.0.0' ,
308- }
309- ) ;
288+ await writeJson ( path . join ( projectDir , 'custom-package.json' ) , {
289+ name : 'custom-package-name' ,
290+ version : '2.0.0' ,
291+ } ) ;
310292
311293 const options : AddLicenseHeadersExecutorSchema = {
312294 targetDirectory : './npm' ,
@@ -325,10 +307,10 @@ describe('AddLicenseHeadersExecutor E2E', () => {
325307 } ) ;
326308 } ) ;
327309
328- it ( 'should preserve formatting and whitespace' , async ( ) => {
329- const npmDir = path . join ( tempDir , 'packages' , 'test-lib' , 'npm' ) ;
310+ it ( 'should preserve formatting and whitespace' , async ( ) => {
311+ const npmDir = path . join ( tempDir , 'packages' , 'test-lib' , 'npm' ) ;
330312
331- const originalContent = `export function complex() {
313+ const originalContent = `export function complex() {
332314 if (true) {
333315 return 'formatted';
334316 }
0 commit comments