From 9de4c711e7971f8b90842b33b99e05ca17ad9b07 Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Fri, 19 Jul 2024 09:43:55 -0400 Subject: [PATCH 1/3] Fix bug with absolute paths and getDestPath --- src/RokuDeploy.spec.ts | 13 +++++++++++++ src/RokuDeploy.ts | 12 +++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/RokuDeploy.spec.ts b/src/RokuDeploy.spec.ts index 43ef5c8..398c72c 100644 --- a/src/RokuDeploy.spec.ts +++ b/src/RokuDeploy.spec.ts @@ -3018,6 +3018,19 @@ describe('index', () => { }); describe('getDestPath', () => { + it('handles absolute paths properly', () => { + expect( + rokuDeploy.getDestPath( + s`c:/projects/roku/local3/brighterscript/.tmp/rootDir/source/main.bs`, + [{ + src: 'c:/projects/roku/local3/brighterscript/.tmp/rootDir/source/main.bs', + dest: 'source/standalone.brs' + }], + 'c:/projects/roku/local3/brighterscript/src/lsp/standalone-project-1' + ) + ).to.equal(s`source/standalone.brs`); + }); + it('handles unrelated exclusions properly', () => { expect( rokuDeploy.getDestPath( diff --git a/src/RokuDeploy.ts b/src/RokuDeploy.ts index 64e956b..51dd340 100644 --- a/src/RokuDeploy.ts +++ b/src/RokuDeploy.ts @@ -228,13 +228,11 @@ export class RokuDeploy { function makeGlobAbsolute(pattern: string) { return path.resolve( - path.posix.join( - rootDir, - //remove leading exclamation point if pattern is negated - pattern - //coerce all slashes to forward - ) - ).replace(/\\/g, '/'); + rootDir, + //remove leading exclamation point if pattern is negated + pattern + //coerce all slashes to forward + ).replace(/\\+/g, '/'); } let result: string; From 26706e5e4e42a9eec0410265a1e7ccddadd2173c Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Fri, 19 Jul 2024 09:50:49 -0400 Subject: [PATCH 2/3] Fix bug in the test --- src/RokuDeploy.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/RokuDeploy.spec.ts b/src/RokuDeploy.spec.ts index 398c72c..de7afb8 100644 --- a/src/RokuDeploy.spec.ts +++ b/src/RokuDeploy.spec.ts @@ -3018,15 +3018,15 @@ describe('index', () => { }); describe('getDestPath', () => { - it('handles absolute paths properly', () => { + it.only('handles absolute paths properly', () => { expect( rokuDeploy.getDestPath( - s`c:/projects/roku/local3/brighterscript/.tmp/rootDir/source/main.bs`, + s`${tempDir}/rootDir/source/main.bs`, [{ - src: 'c:/projects/roku/local3/brighterscript/.tmp/rootDir/source/main.bs', + src: `${tempDir}/rootDir/source/main.bs`, dest: 'source/standalone.brs' }], - 'c:/projects/roku/local3/brighterscript/src/lsp/standalone-project-1' + `${tempDir}/src/lsp/standalone-project-1` ) ).to.equal(s`source/standalone.brs`); }); From 222cac457a9638e7a32a49a4b70b73c47f583d82 Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Fri, 19 Jul 2024 10:09:41 -0400 Subject: [PATCH 3/3] remove .only --- src/RokuDeploy.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RokuDeploy.spec.ts b/src/RokuDeploy.spec.ts index de7afb8..f34c411 100644 --- a/src/RokuDeploy.spec.ts +++ b/src/RokuDeploy.spec.ts @@ -3018,7 +3018,7 @@ describe('index', () => { }); describe('getDestPath', () => { - it.only('handles absolute paths properly', () => { + it('handles absolute paths properly', () => { expect( rokuDeploy.getDestPath( s`${tempDir}/rootDir/source/main.bs`,