-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: vue-cli and nuxt preset for CT object API architecture (#20956)
- Loading branch information
1 parent
9970bfb
commit 57659c4
Showing
38 changed files
with
26,450 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// <reference types="cypress" /> | ||
/// <reference path="../support/e2e.ts" /> | ||
import type { ProjectFixtureDir } from '@tooling/system-tests/lib/fixtureDirs' | ||
|
||
const PROJECTS: ProjectFixtureDir[] = ['nuxtjs2'] | ||
|
||
// Add to this list to focus on a particular permutation | ||
// TODO: run vuecli4-vue2 tests once cypress/vue-2 is bundled | ||
const ONLY_PROJECTS: ProjectFixtureDir[] = [] | ||
|
||
for (const project of PROJECTS) { | ||
if (ONLY_PROJECTS.length && !ONLY_PROJECTS.includes(project)) { | ||
continue | ||
} | ||
|
||
// TODO: This will work once `cypress/vue2` is bundled in the binary | ||
// Since Nuxt.js 2 is based on `vue@2`. | ||
describe.skip(`Working with ${project}`, () => { | ||
beforeEach(() => { | ||
cy.scaffoldProject(project) | ||
cy.openProject(project) | ||
cy.startAppServer('component') | ||
}) | ||
|
||
it('should mount a passing test', () => { | ||
cy.visitApp() | ||
cy.contains('Tutorial.cy.js').click() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
}) | ||
} |
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,29 @@ | ||
// <reference types="cypress" /> | ||
/// <reference path="../support/e2e.ts" /> | ||
import type { ProjectFixtureDir } from '@tooling/system-tests/lib/fixtureDirs' | ||
|
||
const PROJECTS: ProjectFixtureDir[] = ['vuecli4-vue2', 'vuecli4-vue3', 'vuecli5-vue3'] | ||
|
||
// Add to this list to focus on a particular permutation | ||
// TODO: run vuecli4-vue2 tests once cypress/vue-2 is bundled | ||
const ONLY_PROJECTS: ProjectFixtureDir[] = ['vuecli4-vue3', 'vuecli5-vue3'] | ||
|
||
for (const project of PROJECTS) { | ||
if (ONLY_PROJECTS.length && !ONLY_PROJECTS.includes(project)) { | ||
continue | ||
} | ||
|
||
describe(`Working with ${project}`, () => { | ||
beforeEach(() => { | ||
cy.scaffoldProject(project) | ||
cy.openProject(project) | ||
cy.startAppServer('component') | ||
}) | ||
|
||
it('should mount a passing test', () => { | ||
cy.visitApp() | ||
cy.contains('HelloWorld.cy.js').click() | ||
cy.get('.passed > .num').should('contain', 1) | ||
}) | ||
}) | ||
} |
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,26 @@ | ||
import type { CreateFinalWebpackConfig } from '../createWebpackDevServer' | ||
import debugLib from 'debug' | ||
import type { Configuration } from 'webpack' | ||
|
||
type PresetHandler = Omit<CreateFinalWebpackConfig, 'frameworkConfig'> | ||
|
||
const debug = debugLib('cypress:webpack-dev-server-fresh:nuxtHandler') | ||
|
||
export async function nuxtHandler ({ devServerConfig }: PresetHandler): Promise<Configuration> { | ||
try { | ||
const nuxt = require.resolve('nuxt', { | ||
paths: [devServerConfig.cypressConfig.projectRoot], | ||
}) | ||
|
||
const { getWebpackConfig } = require(nuxt) | ||
|
||
const webpackConfig = await getWebpackConfig() | ||
|
||
debug('webpack config %o', webpackConfig) | ||
|
||
return webpackConfig | ||
} catch (e) { | ||
console.error(e) // eslint-disable-line no-console | ||
throw Error(`Error loading nuxt. Looked in ${require.resolve.paths(devServerConfig.cypressConfig.projectRoot)}`) | ||
} | ||
} |
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,24 @@ | ||
import type { CreateFinalWebpackConfig } from '../createWebpackDevServer' | ||
import debugLib from 'debug' | ||
import type { Configuration } from 'webpack' | ||
|
||
type PresetHandler = Omit<CreateFinalWebpackConfig, 'frameworkConfig'> | ||
|
||
const debug = debugLib('cypress:webpack-dev-server-fresh:vueCliHandler') | ||
|
||
export function vueCliHandler ({ devServerConfig }: PresetHandler): Configuration { | ||
try { | ||
const config = require.resolve('@vue/cli-service/webpack.config', { | ||
paths: [devServerConfig.cypressConfig.projectRoot], | ||
}) | ||
|
||
const webpackConfig = require(config) | ||
|
||
debug('webpack config %o', webpackConfig) | ||
|
||
return webpackConfig | ||
} catch (e) { | ||
console.error(e) // eslint-disable-line no-console | ||
throw Error(`Error loading @vue/cli-service/webpack.config.js. Looked in ${require.resolve.paths(devServerConfig.cypressConfig.projectRoot)}`) | ||
} | ||
} |
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
Oops, something went wrong.
57659c4
There was a problem hiding this comment.
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:
57659c4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle 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:
57659c4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin 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: