-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(windows): fix build error with unnormalized brisa dir (#603)
* refactor: create load-constants helper * fix: normalize argv[1] pathname to work on Windows
- Loading branch information
Showing
4 changed files
with
243 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { describe, expect, it } from 'bun:test'; | ||
import { internalConstants } from '.'; | ||
|
||
describe('utils -> load-constants', () => { | ||
describe('internalConstants', () => { | ||
it('should return IS_SERVE_PROCESS as true and IS_BUILD_PROCESS as false', () => { | ||
process.argv[1] = 'brisa/out/cli/serve/index.js'; | ||
const result = internalConstants(); | ||
expect(result.IS_SERVE_PROCESS).toBeTrue(); | ||
expect(result.IS_BUILD_PROCESS).toBeFalse(); | ||
}); | ||
it('should return IS_SERVE_PROCESS as false and IS_BUILD_PROCESS as true', () => { | ||
process.argv[1] = 'brisa/out/cli/build.js'; | ||
const result = internalConstants(); | ||
expect(result.IS_SERVE_PROCESS).toBeFalse(); | ||
expect(result.IS_BUILD_PROCESS).toBeTrue(); | ||
}); | ||
it('should return IS_SERVE_PROCESS as true and IS_BUILD_PROCESS as false (argv Windows format)', () => { | ||
process.argv[1] = 'brisa\\out\\cli\\serve\\index.js'; | ||
const result = internalConstants(); | ||
expect(result.IS_SERVE_PROCESS).toBeTrue(); | ||
expect(result.IS_BUILD_PROCESS).toBeFalse(); | ||
}); | ||
it('should return IS_SERVE_PROCESS as false and IS_BUILD_PROCESS as true (argv Windows format)', () => { | ||
process.argv[1] = 'brisa\\out\\cli\\build.js'; | ||
const result = internalConstants(); | ||
expect(result.IS_SERVE_PROCESS).toBeFalse(); | ||
expect(result.IS_BUILD_PROCESS).toBeTrue(); | ||
}); | ||
|
||
it('should return BRISA_DIR', () => { | ||
process.argv[1] = 'brisa/out/cli/serve/index.js'; | ||
const result = internalConstants(); | ||
expect(result.BRISA_DIR).toBe('brisa'); | ||
}); | ||
|
||
it('should return BRISA_DIR (argv Windows format)', () => { | ||
process.argv[1] = 'brisa\\\\out\\\\cli\\\\serve\\\\index.js'; | ||
const result = internalConstants(); | ||
expect(result.BRISA_DIR).toBe('brisa'); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.