diff --git a/e2e/angular/src/config-compat.test.ts b/e2e/angular/src/config-compat.test.ts index 2266ba1ba7..af2102268c 100644 --- a/e2e/angular/src/config-compat.test.ts +++ b/e2e/angular/src/config-compat.test.ts @@ -17,6 +17,7 @@ describe('new config format', () => { // update the angular.json const workspaceJson = readJson(`angular.json`); + workspaceJson.version = 2; workspaceJson.projects[myapp].targets = updateConfig( workspaceJson.projects[myapp].architect ); @@ -34,9 +35,7 @@ function updateConfig(targets: any) { const res = {}; Object.entries(targets).forEach(([name, t]: any) => { t.executor = t.builder; - t.generators = t.schematics; delete t.builder; - delete t.schematics; res[name] = t; }); return res; diff --git a/e2e/angular/src/storybook.test.ts b/e2e/angular/src/storybook.test.ts new file mode 100644 index 0000000000..0e993908a5 --- /dev/null +++ b/e2e/angular/src/storybook.test.ts @@ -0,0 +1,267 @@ +import { + checkFilesExist, + newProject, + readFile, + runCLI, + supportUi, + tmpProjPath, + uniq, +} from '@nrwl/e2e/utils'; +import { mkdirSync, writeFileSync } from 'fs'; + +describe('Storybook schematics', () => { + describe('build storybook', () => { + it('should execute e2e tests using Cypress running against Storybook', () => { + newProject(); + + const myapp = uniq('myapp'); + runCLI(`generate @nrwl/angular:app ${myapp} --no-interactive`); + + const mylib = uniq('test-ui-lib'); + createTestUILib(mylib); + const mylib2 = uniq('test-ui-lib-react'); + runCLI(`generate @nrwl/react:lib ${mylib2} --no-interactive`); + runCLI( + `generate @nrwl/react:component Button --project=${mylib2} --no-interactive` + ); + writeFileSync( + tmpProjPath(`libs/${mylib2}/src/lib/button.tsx`), + ` + import React from 'react'; + + import './button.css'; + + export type ButtonStyle = 'default' | 'primary' | 'warning'; + + /* eslint-disable-next-line */ + export interface ButtonProps { + text?: string; + style?: ButtonStyle; + padding?: number; + } + + export const Button = (props: ButtonProps) => { + return ( + + ); + }; + + export default Button; + ` + ); + writeFileSync( + tmpProjPath(`libs/${mylib2}/src/lib/button.stories.tsx`), + ` + import React from 'react'; + import { Button, ButtonStyle } from './button'; + import { text, number } from '@storybook/addon-knobs'; + + export default { title: 'Button' }; + + export const primary = () => ( + +

You are {{age}} years old.

+ ` + ); + runCLI( + `g @nrwl/angular:component test-other --project=${libName} --no-interactive` + ); +} diff --git a/e2e/cli/src/cli.test.ts b/e2e/cli/src/cli.test.ts index 17da534f0c..bc626bf4f9 100644 --- a/e2e/cli/src/cli.test.ts +++ b/e2e/cli/src/cli.test.ts @@ -12,7 +12,7 @@ import { } from '@nrwl/e2e/utils'; describe('Help', () => { - it('should show help', async () => { + it('gggshould show help', async () => { newProject(); const myapp = uniq('myapp'); runCLI(`generate @nrwl/web:app ${myapp}`); diff --git a/e2e/linter/src/linter.test.ts b/e2e/linter/src/linter.test.ts index c951c4fff3..c1d427bcdd 100644 --- a/e2e/linter/src/linter.test.ts +++ b/e2e/linter/src/linter.test.ts @@ -77,8 +77,8 @@ describe('Linter', () => { // This test is only relevant for the deprecated lint builder, // so we need to patch the workspace.json to use it const workspaceJson = readJson(`workspace.json`); - workspaceJson.projects[myapp].architect.lint = { - builder: '@nrwl/linter:lint', + workspaceJson.projects[myapp].targets.lint = { + executor: '@nrwl/linter:lint', options: { linter: 'eslint', tsConfig: [ diff --git a/e2e/node/src/node.test.ts b/e2e/node/src/node.test.ts index cb33334f34..449389e00c 100644 --- a/e2e/node/src/node.test.ts +++ b/e2e/node/src/node.test.ts @@ -282,7 +282,7 @@ describe('Node Libraries', () => { `generate @nrwl/angular:lib ${nglib} --publishable --importPath=@proj/${nglib}` ); const workspace = readJson(workspaceConfigName()); - workspace.projects[nodelib].architect.build.options.assets.push({ + workspace.projects[nodelib].targets.build.options.assets.push({ input: `./dist/libs/${nglib}`, glob: '**/*', output: '.', diff --git a/e2e/react/src/react-package.test.ts b/e2e/react/src/react-package.test.ts index f3e9e0b202..43ca658abb 100644 --- a/e2e/react/src/react-package.test.ts +++ b/e2e/react/src/react-package.test.ts @@ -88,7 +88,7 @@ describe('Build React libraries and apps', () => { // Add assets to child lib updateFile('workspace.json', (c) => { const json = JSON.parse(c); - json.projects[childLib].architect.build.options.assets = [ + json.projects[childLib].targets.build.options.assets = [ `libs/${childLib}/src/assets`, ]; return JSON.stringify(json, null, 2); diff --git a/e2e/react/src/react.test.ts b/e2e/react/src/react.test.ts index 7fe8819de7..7dbf75a1f5 100644 --- a/e2e/react/src/react.test.ts +++ b/e2e/react/src/react.test.ts @@ -53,7 +53,7 @@ describe('React Applications', () => { // Turn vendor sourcemaps on updateFile(`workspace.json`, (content) => { const json = JSON.parse(content); - json.projects[appName].architect.build.options.sourceMap = { + json.projects[appName].targets.build.options.sourceMap = { scripts: true, vendor: true, }; @@ -314,10 +314,10 @@ describe('React Applications', () => { angularJson.projects[ appName - ].architect.build.options.main = `apps/${appName}/src/main.jsx`; + ].targets.build.options.main = `apps/${appName}/src/main.jsx`; angularJson.projects[ appName - ].architect.build.options.polyfills = `apps/${appName}/src/polyfills.js`; + ].targets.build.options.polyfills = `apps/${appName}/src/polyfills.js`; updateFile(workspaceConfigName(), serializeJson(angularJson)); const mainPath = `apps/${appName}/src/main.jsx`; diff --git a/e2e/storybook/src/storybook.test.ts b/e2e/storybook/src/storybook.test.ts index 4009603729..d30b14ce07 100644 --- a/e2e/storybook/src/storybook.test.ts +++ b/e2e/storybook/src/storybook.test.ts @@ -3,166 +3,13 @@ import { newProject, readFile, runCLI, - supportUi, tmpProjPath, uniq, } from '@nrwl/e2e/utils'; -import { mkdirSync, writeFileSync } from 'fs'; +import { writeFileSync } from 'fs'; describe('Storybook schematics', () => { - describe('running Storybook and Cypress', () => { - it('should execute e2e tests using Cypress running against Storybook', () => { - newProject(); - - const myapp = uniq('myapp'); - runCLI(`generate @nrwl/angular:app ${myapp} --no-interactive`); - - const mylib = uniq('test-ui-lib'); - createTestUILib(mylib); - const mylib2 = uniq('test-ui-lib-react'); - runCLI(`generate @nrwl/react:lib ${mylib2} --no-interactive`); - runCLI( - `generate @nrwl/react:component Button --project=${mylib2} --no-interactive` - ); - writeFileSync( - tmpProjPath(`libs/${mylib2}/src/lib/button.tsx`), - ` - import React from 'react'; - - import './button.css'; - - export type ButtonStyle = 'default' | 'primary' | 'warning'; - - /* eslint-disable-next-line */ - export interface ButtonProps { - text?: string; - style?: ButtonStyle; - padding?: number; - } - - export const Button = (props: ButtonProps) => { - return ( - - ); - }; - - export default Button; - ` - ); - writeFileSync( - tmpProjPath(`libs/${mylib2}/src/lib/button.stories.tsx`), - ` - import React from 'react'; - import { Button, ButtonStyle } from './button'; - import { text, number } from '@storybook/addon-knobs'; - - export default { title: 'Button' }; - - export const primary = () => ( -