diff --git a/packages/project-config/src/__tests__/paths.test.ts b/packages/project-config/src/__tests__/paths.test.ts index 9b9d264f9060..608492a13027 100644 --- a/packages/project-config/src/__tests__/paths.test.ts +++ b/packages/project-config/src/__tests__/paths.test.ts @@ -131,9 +131,8 @@ describe('paths', () => { process.env.RWJS_CWD = RWJS_CWD }) - it('finds the correct base directory', () => { - expect(getBaseDir()).toBe(FIXTURE_BASEDIR) - }) + it('finds the correct base directory', () => + expect(getBaseDir()).toBe(FIXTURE_BASEDIR)) it('finds the correct base directory from a file', () => { const projectFilePath = path.join( @@ -169,16 +168,12 @@ describe('paths', () => { it('switches windows slashes in import statements', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const inputPath = 'C:\\Users\\Bob\\dev\\Redwood\\UserPage\\UserPage' const outputPath = importStatementPath(inputPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(outputPath).toEqual('C:/Users/Bob/dev/Redwood/UserPage/UserPage') }) @@ -224,48 +219,36 @@ describe('paths', () => { describe('ensurePosixPath', () => { it('Returns unmodified input if not on Windows', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'NotWindows', - }) + Object.defineProperty(process, 'platform', { value: 'NotWindows' }) const testPath = 'X:\\some\\weird\\path' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual(testPath) }) it('Transforms paths on Windows', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const testPath = '..\\some\\relative\\path' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual('../some/relative/path') }) it('Handles drive letters', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const testPath = 'C:\\some\\full\\path\\to\\file.ext' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual('/c/some/full/path/to/file.ext') }) @@ -290,9 +273,8 @@ describe('paths', () => { process.env.RWJS_CWD = RWJS_CWD }) - it('finds the correct base directory', () => { - expect(getBaseDir()).toBe(FIXTURE_BASEDIR) - }) + it('finds the correct base directory', () => + expect(getBaseDir()).toBe(FIXTURE_BASEDIR)) it('finds the correct base directory from a file', () => { const projectFilePath = path.join( @@ -328,16 +310,12 @@ describe('paths', () => { it('switches windows slashes in import statements', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const inputPath = 'C:\\Users\\Bob\\dev\\Redwood\\UserPage\\UserPage' const outputPath = importStatementPath(inputPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(outputPath).toEqual('C:/Users/Bob/dev/Redwood/UserPage/UserPage') }) @@ -429,48 +407,36 @@ describe('paths', () => { describe('ensurePosixPath', () => { it('Returns unmodified input if not on Windows', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'NotWindows', - }) + Object.defineProperty(process, 'platform', { value: 'NotWindows' }) const testPath = 'X:\\some\\weird\\path' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual(testPath) }) it('Transforms paths on Windows', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const testPath = '..\\some\\relative\\path' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual('../some/relative/path') }) it('Handles drive letters', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const testPath = 'C:\\some\\full\\path\\to\\file.ext' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual('/c/some/full/path/to/file.ext') }) @@ -495,9 +461,8 @@ describe('paths', () => { process.env.RWJS_CWD = RWJS_CWD }) - it('finds the correct base directory', () => { - expect(getBaseDir()).toBe(FIXTURE_BASEDIR) - }) + it('finds the correct base directory', () => + expect(getBaseDir()).toBe(FIXTURE_BASEDIR)) it('finds the correct base directory from a file', () => { const projectFilePath = path.join( @@ -534,16 +499,12 @@ describe('paths', () => { it('switches windows slashes in import statements', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const inputPath = 'C:\\Users\\Bob\\dev\\Redwood\\UserPage\\UserPage' const outputPath = importStatementPath(inputPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(outputPath).toEqual('C:/Users/Bob/dev/Redwood/UserPage/UserPage') }) @@ -595,48 +556,36 @@ describe('paths', () => { describe('ensurePosixPath', () => { it('Returns unmodified input if not on Windows', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'NotWindows', - }) + Object.defineProperty(process, 'platform', { value: 'NotWindows' }) const testPath = 'X:\\some\\weird\\path' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual(testPath) }) it('Transforms paths on Windows', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const testPath = '..\\some\\relative\\path' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual('../some/relative/path') }) it('Handles drive letters', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const testPath = 'C:\\some\\full\\path\\to\\file.ext' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual('/c/some/full/path/to/file.ext') }) @@ -696,16 +645,12 @@ describe('paths', () => { it('switches windows slashes in import statements', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const inputPath = 'C:\\Users\\Bob\\dev\\Redwood\\UserPage\\UserPage' const outputPath = importStatementPath(inputPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(outputPath).toEqual('C:/Users/Bob/dev/Redwood/UserPage/UserPage') }) @@ -812,48 +757,36 @@ describe('paths', () => { describe('ensurePosixPath', () => { it('Returns unmodified input if not on Windows', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'NotWindows', - }) + Object.defineProperty(process, 'platform', { value: 'NotWindows' }) const testPath = 'X:\\some\\weird\\path' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual(testPath) }) it('Transforms paths on Windows', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const testPath = '..\\some\\relative\\path' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual('../some/relative/path') }) it('Handles drive letters', () => { const originalPlatform = process.platform - Object.defineProperty(process, 'platform', { - value: 'win32', - }) + Object.defineProperty(process, 'platform', { value: 'win32' }) const testPath = 'C:\\some\\full\\path\\to\\file.ext' const posixPath = ensurePosixPath(testPath) - Object.defineProperty(process, 'platform', { - value: originalPlatform, - }) + Object.defineProperty(process, 'platform', { value: originalPlatform }) expect(posixPath).toEqual('/c/some/full/path/to/file.ext') })