mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-23 07:39:52 -06:00
* fix: remove publicPath in react-scripts if it is present * fix: remove publicPath in react-scripts if it is present * fix: remove publicPath in webpack-dev-server regardless * fix: add root path * chore: revert * fix: remove user base path * remove unused function * test: add unit test for make webpack config * chore: make purpose for fake url more clear * do not include local filesystem path in snapshot
32 lines
1013 B
TypeScript
32 lines
1013 B
TypeScript
import { expect } from 'chai'
|
|
import snapshot from 'snap-shot-it'
|
|
import { makeWebpackConfig } from '../../src/makeWebpackConfig'
|
|
|
|
describe('makeWebpackConfig', () => {
|
|
it('ignores userland webpack `output.publicPath`', async () => {
|
|
const actual = await makeWebpackConfig({
|
|
output: {
|
|
publicPath: '/this-will-be-ignored',
|
|
},
|
|
}, {
|
|
devServerPublicPathRoute: '/test-public-path',
|
|
isOpenMode: true,
|
|
supportFile: '/support.js',
|
|
projectRoot: '.',
|
|
files: [],
|
|
})
|
|
|
|
// plugins contain circular deps which cannot be serialized in a snapshot.
|
|
// instead just compare the name and order of the plugins.
|
|
// @ts-expect-error
|
|
actual.plugins = actual.plugins.map((p) => p.constructor.name)
|
|
|
|
// these will include paths from the user's local file system, so we should not include them the snapshot
|
|
delete actual.output.path
|
|
delete actual.entry
|
|
|
|
expect(actual.output.publicPath).to.eq('/test-public-path/')
|
|
snapshot(actual)
|
|
})
|
|
})
|