Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(publicPath): allow for custom public path
Closes #464
- Loading branch information
1 parent
b8abbce
commit 19095e7
Showing
12 changed files
with
202 additions
and
66 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
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
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,50 @@ | ||
import { Config } from '../../../declarations'; | ||
import { mockLogger, mockStencilSystem } from '../../../testing/mocks'; | ||
import { validateBuildConfig } from '../validate-config'; | ||
import * as path from 'path'; | ||
|
||
|
||
describe('validatePublicPath', () => { | ||
|
||
let config: Config; | ||
const logger = mockLogger(); | ||
const sys = mockStencilSystem(); | ||
|
||
beforeEach(() => { | ||
config = { | ||
sys: sys, | ||
logger: logger, | ||
rootDir: '/User/some/path/', | ||
suppressTypeScriptErrors: true | ||
}; | ||
}); | ||
|
||
|
||
it('should set publicPath from custom buildDir', () => { | ||
config.wwwDir = 'some-www'; | ||
config.buildDir = 'some-build'; | ||
validateBuildConfig(config); | ||
expect(config.publicPath).toBe('/some-build/'); | ||
expect(path.isAbsolute(config.publicPath)).toBe(true); | ||
}); | ||
|
||
it('should set publicPath and not force absolute path, but suffix with /', () => { | ||
config.publicPath = 'my-crazy-public-path'; | ||
validateBuildConfig(config); | ||
expect(config.publicPath).toBe('my-crazy-public-path/'); | ||
}); | ||
|
||
it('should set discoverPublicPath to false if custom publicPath', () => { | ||
config.publicPath = '/my-crazy-public-path/app/'; | ||
validateBuildConfig(config); | ||
expect(config.publicPath).toBe('/my-crazy-public-path/app/'); | ||
expect(config.discoverPublicPath).toBe(false); | ||
}); | ||
|
||
it('should set default publicPath, set discoverPublicPath true, and convert to absolute path', () => { | ||
validateBuildConfig(config); | ||
expect(config.publicPath).toBe('/build/'); | ||
expect(config.discoverPublicPath).toBe(true); | ||
}); | ||
|
||
}); |
Oops, something went wrong.