Skip to content

Commit

Permalink
docs: in vite-dev-server example don't require the config (#15866)
Browse files Browse the repository at this point in the history
* refactor: simplify vite example

* docs: document the vite server options in TSDoc

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
  • Loading branch information
Barthélémy Ledoux and lmiller1990 authored Apr 16, 2021
1 parent 0a63455 commit df789cc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
8 changes: 5 additions & 3 deletions npm/vite-dev-server/cypress/plugins.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { startDevServer } from '@cypress/vite-dev-server'
import viteConfig from '../vite.config'
const path = require('path')
const { startDevServer } = require('../dist')

module.exports = (on, config) => {
on('dev-server:start', async (options) => {
return startDevServer({
options,
viteConfig,
viteConfig: {
configFile: path.resolve(__dirname, '..', 'vite.config.ts'),
},
})
})

Expand Down
13 changes: 10 additions & 3 deletions npm/vite-dev-server/src/startServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ interface Options {
}

export interface StartDevServer {
/* this is the Cypress options object */
/**
* the Cypress options object
*/
options: Options
/* support passing a path to the user's webpack config */
viteConfig?: UserConfig // TODO: implement taking in the user's vite configuration. Right now we don't
/**
* By default, vite will use your vite.config file to
* Start the server. If you need additional plugins or
* to override some options, you can do so using this.
* @optional
*/
viteConfig?: UserConfig
}

const resolveServerConfig = async ({ viteConfig, options }: StartDevServer): Promise<InlineConfig> => {
Expand Down
File renamed without changes.

3 comments on commit df789cc

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on df789cc Apr 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/7.2.0/appveyor-develop-df789cc412d6f7eb17dac6f6614383a7885db004/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on df789cc Apr 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/7.2.0/appveyor-develop-df789cc412d6f7eb17dac6f6614383a7885db004/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on df789cc Apr 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/7.2.0/circle-develop-df789cc412d6f7eb17dac6f6614383a7885db004/cypress.tgz

Please sign in to comment.