11// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22// See LICENSE in the project root for license information.
33
4- import * as path from 'path' ;
54import { FileSystem } from '@rushstack/node-core-library' ;
65
76import { LastInstallFlag } from '../LastInstallFlag' ;
87
9- const TEMP_DIR : string = path . join ( __dirname , ' temp' ) ;
8+ const TEMP_DIR_PATH : string = ` ${ __dirname } / temp` ;
109
1110describe ( LastInstallFlag . name , ( ) => {
1211 beforeEach ( ( ) => {
13- FileSystem . ensureEmptyFolder ( TEMP_DIR ) ;
12+ FileSystem . ensureEmptyFolder ( TEMP_DIR_PATH ) ;
1413 } ) ;
1514
1615 afterEach ( ( ) => {
17- FileSystem . ensureEmptyFolder ( TEMP_DIR ) ;
16+ FileSystem . ensureEmptyFolder ( TEMP_DIR_PATH ) ;
1817 } ) ;
1918
2019 it ( 'can create and remove a flag in an empty directory' , ( ) => {
2120 // preparation
22- const flag : LastInstallFlag = new LastInstallFlag ( TEMP_DIR ) ;
21+ const flag : LastInstallFlag = new LastInstallFlag ( TEMP_DIR_PATH ) ;
2322 FileSystem . deleteFile ( flag . path ) ;
2423
2524 // test state, should be invalid since the file doesn't exist
@@ -38,8 +37,8 @@ describe(LastInstallFlag.name, () => {
3837
3938 it ( 'can detect if the last flag was in a different state' , ( ) => {
4039 // preparation
41- const flag1 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR , { node : '5.0.0' } ) ;
42- const flag2 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR , { node : '8.9.4' } ) ;
40+ const flag1 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR_PATH , { node : '5.0.0' } ) ;
41+ const flag2 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR_PATH , { node : '8.9.4' } ) ;
4342 FileSystem . deleteFile ( flag1 . path ) ;
4443
4544 // test state, should be invalid since the file doesn't exist
@@ -63,7 +62,7 @@ describe(LastInstallFlag.name, () => {
6362
6463 it ( 'can detect if the last flag was in a corrupted state' , ( ) => {
6564 // preparation, write non-json into flag file
66- const flag : LastInstallFlag = new LastInstallFlag ( TEMP_DIR ) ;
65+ const flag : LastInstallFlag = new LastInstallFlag ( TEMP_DIR_PATH ) ;
6766 FileSystem . writeFile ( flag . path , 'sdfjkaklfjksldajgfkld' ) ;
6867
6968 // test state, should be invalid since the file is not JSON
@@ -72,13 +71,13 @@ describe(LastInstallFlag.name, () => {
7271 } ) ;
7372
7473 it ( "throws an error if new storePath doesn't match the old one" , ( ) => {
75- const flag1 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR , {
74+ const flag1 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR_PATH , {
7675 packageManager : 'pnpm' ,
77- storePath : path . join ( TEMP_DIR , ' pnpm-store' )
76+ storePath : ` ${ TEMP_DIR_PATH } / pnpm-store`
7877 } ) ;
79- const flag2 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR , {
78+ const flag2 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR_PATH , {
8079 packageManager : 'pnpm' ,
81- storePath : path . join ( TEMP_DIR , ' temp-store' )
80+ storePath : ` ${ TEMP_DIR_PATH } / temp-store`
8281 } ) ;
8382
8483 flag1 . create ( ) ;
@@ -88,11 +87,11 @@ describe(LastInstallFlag.name, () => {
8887 } ) ;
8988
9089 it ( "doesn't throw an error if conditions for error aren't met" , ( ) => {
91- const flag1 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR , {
90+ const flag1 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR_PATH , {
9291 packageManager : 'pnpm' ,
93- storePath : path . join ( TEMP_DIR , ' pnpm-store' )
92+ storePath : ` ${ TEMP_DIR_PATH } / pnpm-store`
9493 } ) ;
95- const flag2 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR , {
94+ const flag2 : LastInstallFlag = new LastInstallFlag ( TEMP_DIR_PATH , {
9695 packageManager : 'npm'
9796 } ) ;
9897
0 commit comments