@@ -18,6 +18,34 @@ describe("createTempLicenses", () => {
1818 expect ( licenseWritten ) . toBe ( true ) ;
1919 } ) ;
2020
21+ it ( "copies root license into package contents" , async ( ) => {
22+ const cwd = await initFixture ( "licenses" ) ;
23+ const project = new Project ( cwd ) ;
24+ const [ pkg ] = await project . getPackages ( ) ;
25+
26+ // automagical "contents" setter creates absolute path
27+ pkg . contents = "dist" ;
28+
29+ await createTempLicenses ( project . licensePath , [ pkg ] ) ;
30+
31+ const licenseWritten = await fs . pathExists ( path . join ( pkg . contents , "LICENSE" ) ) ;
32+ expect ( licenseWritten ) . toBe ( true ) ;
33+ } ) ;
34+
35+ it ( "copies root license into package publishConfig.directory" , async ( ) => {
36+ const cwd = await initFixture ( "licenses" ) ;
37+ const project = new Project ( cwd ) ;
38+ const [ pkg ] = await project . getPackages ( ) ;
39+
40+ // automagical "contents" getter creates absolute path
41+ await pkg . set ( "publishConfig" , { directory : "build" } ) . serialize ( ) ;
42+
43+ await createTempLicenses ( project . licensePath , [ pkg ] ) ;
44+
45+ const licenseWritten = await fs . pathExists ( path . join ( pkg . contents , "LICENSE" ) ) ;
46+ expect ( licenseWritten ) . toBe ( true ) ;
47+ } ) ;
48+
2149 it ( "copies root license with extension into package location" , async ( ) => {
2250 const cwd = await initFixture ( "licenses" ) ;
2351 const project = new Project ( cwd ) ;
0 commit comments