Skip to content

Commit

Permalink
Fix bug with absolute paths and getDestPath (#171)
Browse files Browse the repository at this point in the history
* Fix bug with absolute paths and getDestPath

* Fix bug in the test

* remove .only
  • Loading branch information
TwitchBronBron committed Jul 19, 2024
1 parent 7091ae9 commit 2f90c39
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
13 changes: 13 additions & 0 deletions src/RokuDeploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3018,6 +3018,19 @@ describe('index', () => {
});

describe('getDestPath', () => {
it('handles absolute paths properly', () => {
expect(
rokuDeploy.getDestPath(
s`${tempDir}/rootDir/source/main.bs`,
[{
src: `${tempDir}/rootDir/source/main.bs`,
dest: 'source/standalone.brs'
}],
`${tempDir}/src/lsp/standalone-project-1`
)
).to.equal(s`source/standalone.brs`);
});

it('handles unrelated exclusions properly', () => {
expect(
rokuDeploy.getDestPath(
Expand Down
12 changes: 5 additions & 7 deletions src/RokuDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2f90c39

Please sign in to comment.