Files
cypress/npm/webpack-dev-server/test/makeWebpackConfig.spec.ts
Jess b326693879 chore: cutting over system-tests and Cypress to use the new CT Object API (#21079)
* removing vite-dev-server local dependency from react-vite-ts-configured system test

* moving some CRA examples over to use the object api for setup

* fixing issue where function API was broken by object API for cy config + devservers

* adding deeply nested react import to project-fixtures for cra

* finishes cutting over cypress/react for sys tests

* chore: adding circle for this feature branch

* chore: moving over many vue + vite system tests to use object API instead of function API (#21080)

* doing webpack-dev-server cutovers

* removing more webpack-dev-server refrences

* fixing snapshots

* bumping yarn.lock

* wip

* fix test

* fix assertion

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>

* feat: removing all references for "fresh" dev servers (webpack-dev-server-fresh and vite-dev-server-fresh) (#21094)

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>

* chore: add dev-servers as deps to server to be included in the binary (#21091)

* fix bad merge

* fix next types and webpack-dev-server- resolve

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
2022-04-20 15:57:19 +10:00

42 lines
1.5 KiB
TypeScript

import { expect } from 'chai'
import EventEmitter from 'events'
import snapshot from 'snap-shot-it'
import { WebpackDevServerConfig } from '../src/devServer'
import { sourceDefaultWebpackDependencies } from '../src/helpers/sourceRelativeWebpackModules'
import { makeWebpackConfig } from '../src/makeWebpackConfig'
describe('makeWebpackConfig', () => {
it('ignores userland webpack `output.publicPath`', async () => {
const devServerConfig: WebpackDevServerConfig = {
specs: [],
cypressConfig: {
isTextTerminal: false,
projectRoot: '.',
supportFile: '/support.js',
devServerPublicPathRoute: '/test-public-path',
} as Cypress.PluginConfigOptions,
webpackConfig: {
output: {
publicPath: '/this-will-be-ignored',
},
},
devServerEvents: new EventEmitter(),
}
const actual = await makeWebpackConfig({
devServerConfig,
sourceWebpackModulesResult: sourceDefaultWebpackDependencies(devServerConfig),
})
// plugins contain circular deps which cannot be serialized in a snapshot.
// instead just compare the name and order of the plugins.
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)
})
})