From f110d0c0e652ff89ad3880dec4826445d7238980 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Wed, 30 Aug 2023 11:13:05 -0400 Subject: [PATCH] chore(react): update unit tests to use "as-provided" when generating apps/libs (#18893) --- .../__snapshots__/application.spec.ts.snap | 2 +- .../application/application.spec.ts | 291 +++++++++--------- .../component-cypress-spec.spec.ts | 22 +- .../component-story/component-story.spec.ts | 19 +- .../component-test/component-test.spec.ts | 86 +++--- .../generators/component/component.spec.ts | 158 ++++------ .../cypress-component-configuration.spec.ts | 59 ++-- .../react/src/generators/hook/hook.spec.ts | 48 ++- .../react/src/generators/host/host.spec.ts | 39 +-- .../react/src/generators/init/init.spec.ts | 2 +- .../src/generators/library/library.spec.ts | 158 +++++----- .../react/src/generators/redux/redux.spec.ts | 12 +- .../src/generators/remote/remote.spec.ts | 13 +- .../generators/setup-ssr/setup-ssr.spec.ts | 1 + .../setup-tailwind/setup-tailwind.spec.ts | 64 ++-- .../generators/stories/stories.app.spec.ts | 85 +++-- .../generators/stories/stories.lib.spec.ts | 50 ++- .../generators/stories/stories.nextjs.spec.ts | 15 +- .../configuration.spec.ts | 31 +- .../update-16-7-0-add-typings.spec.ts | 2 +- .../react/src/utils/testing-generators.ts | 7 +- .../application/application.spec.ts | 264 ++++++++-------- packages/web/src/generators/init/init.spec.ts | 2 +- .../static-serve-configuration.spec.ts | 38 +-- 24 files changed, 719 insertions(+), 749 deletions(-) diff --git a/packages/react/src/generators/application/__snapshots__/application.spec.ts.snap b/packages/react/src/generators/application/__snapshots__/application.spec.ts.snap index 2f1fe8b2b04d4..c2e7dd14828ce 100644 --- a/packages/react/src/generators/application/__snapshots__/application.spec.ts.snap +++ b/packages/react/src/generators/application/__snapshots__/application.spec.ts.snap @@ -68,7 +68,7 @@ import NxWelcome from './nx-welcome'; export function App() { return (
- +
); } diff --git a/packages/react/src/generators/application/application.spec.ts b/packages/react/src/generators/application/application.spec.ts index 8b89127ad9c9a..cd9a5113ccc3e 100644 --- a/packages/react/src/generators/application/application.spec.ts +++ b/packages/react/src/generators/application/application.spec.ts @@ -24,13 +24,14 @@ describe('app', () => { linter: Linter.EsLint, style: 'css', strict: true, + projectNameAndRootFormat: 'as-provided', }; let mockedInstalledCypressVersion: jest.Mock< ReturnType > = installedCypressVersion as never; beforeEach(() => { mockedInstalledCypressVersion.mockReturnValue(10); - appTree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' }); + appTree = createTreeWithEmptyWorkspace(); }); describe('not nested', () => { @@ -39,8 +40,8 @@ describe('app', () => { const projects = getProjects(appTree); - expect(projects.get('my-app').root).toEqual('apps/my-app'); - expect(projects.get('my-app-e2e').root).toEqual('apps/my-app-e2e'); + expect(projects.get('my-app').root).toEqual('my-app'); + expect(projects.get('my-app-e2e').root).toEqual('my-app-e2e'); }); it('should add vite types to tsconfigs', async () => { @@ -49,14 +50,14 @@ describe('app', () => { bundler: 'vite', unitTestRunner: 'vitest', }); - const tsconfigApp = readJson(appTree, 'apps/my-app/tsconfig.app.json'); + const tsconfigApp = readJson(appTree, 'my-app/tsconfig.app.json'); expect(tsconfigApp.compilerOptions.types).toEqual([ 'node', '@nx/react/typings/cssmodule.d.ts', '@nx/react/typings/image.d.ts', 'vite/client', ]); - const tsconfigSpec = readJson(appTree, 'apps/my-app/tsconfig.spec.json'); + const tsconfigSpec = readJson(appTree, 'my-app/tsconfig.spec.json'); expect(tsconfigSpec.compilerOptions.types).toEqual([ 'vitest/globals', 'vitest/importMeta', @@ -94,19 +95,17 @@ describe('app', () => { it('should generate files', async () => { await applicationGenerator(appTree, schema); - expect(appTree.exists('apps/my-app/.babelrc')).toBeTruthy(); - expect(appTree.exists('apps/my-app/src/main.tsx')).toBeTruthy(); - expect(appTree.exists('apps/my-app/src/app/app.tsx')).toBeTruthy(); - expect( - appTree.read('apps/my-app/src/app/app.tsx', 'utf-8') - ).toMatchSnapshot(); - expect(appTree.exists('apps/my-app/src/app/app.spec.tsx')).toBeTruthy(); - expect(appTree.exists('apps/my-app/src/app/app.module.css')).toBeTruthy(); + expect(appTree.exists('my-app/.babelrc')).toBeTruthy(); + expect(appTree.exists('my-app/src/main.tsx')).toBeTruthy(); + expect(appTree.exists('my-app/src/app/app.tsx')).toBeTruthy(); + expect(appTree.read('my-app/src/app/app.tsx', 'utf-8')).toMatchSnapshot(); + expect(appTree.exists('my-app/src/app/app.spec.tsx')).toBeTruthy(); + expect(appTree.exists('my-app/src/app/app.module.css')).toBeTruthy(); - const jestConfig = appTree.read('apps/my-app/jest.config.ts').toString(); + const jestConfig = appTree.read('my-app/jest.config.ts').toString(); expect(jestConfig).toContain('@nx/react/plugins/jest'); - const tsconfig = readJson(appTree, 'apps/my-app/tsconfig.json'); + const tsconfig = readJson(appTree, 'my-app/tsconfig.json'); expect(tsconfig.references).toEqual([ { path: './tsconfig.app.json', @@ -116,8 +115,8 @@ describe('app', () => { }, ]); expect(tsconfig.compilerOptions.strict).toEqual(true); - const tsconfigApp = readJson(appTree, 'apps/my-app/tsconfig.app.json'); - expect(tsconfigApp.compilerOptions.outDir).toEqual('../../dist/out-tsc'); + const tsconfigApp = readJson(appTree, 'my-app/tsconfig.app.json'); + expect(tsconfigApp.compilerOptions.outDir).toEqual('../dist/out-tsc'); expect(tsconfigApp.extends).toEqual('./tsconfig.json'); expect(tsconfigApp.exclude).toEqual([ 'jest.config.ts', @@ -131,26 +130,26 @@ describe('app', () => { 'src/**/*.test.jsx', ]); - const eslintJson = readJson(appTree, 'apps/my-app/.eslintrc.json'); + const eslintJson = readJson(appTree, 'my-app/.eslintrc.json'); expect(eslintJson.extends).toEqual([ 'plugin:@nx/react', - '../../.eslintrc.json', + '../.eslintrc.json', ]); - expect(appTree.exists('apps/my-app-e2e/cypress.config.ts')).toBeTruthy(); - const tsconfigE2E = readJson(appTree, 'apps/my-app-e2e/tsconfig.json'); + expect(appTree.exists('my-app-e2e/cypress.config.ts')).toBeTruthy(); + const tsconfigE2E = readJson(appTree, 'my-app-e2e/tsconfig.json'); expect(tsconfigE2E).toMatchInlineSnapshot(` { "compilerOptions": { "allowJs": true, - "outDir": "../../dist/out-tsc", + "outDir": "../dist/out-tsc", "sourceMap": false, "types": [ "cypress", "node", ], }, - "extends": "../../tsconfig.base.json", + "extends": "../tsconfig.base.json", "include": [ "src/**/*.ts", "src/**/*.js", @@ -163,40 +162,43 @@ describe('app', () => { it('should extend from root tsconfig.base.json', async () => { await applicationGenerator(appTree, schema); - const tsConfig = readJson(appTree, 'apps/my-app/tsconfig.json'); - expect(tsConfig.extends).toEqual('../../tsconfig.base.json'); + const tsConfig = readJson(appTree, 'my-app/tsconfig.json'); + expect(tsConfig.extends).toEqual('../tsconfig.base.json'); }); }); describe('nested', () => { it('should create project configurations', async () => { - await applicationGenerator(appTree, { ...schema, directory: 'myDir' }); + await applicationGenerator(appTree, { + ...schema, + directory: 'my-dir/my-app', + }); const projectsConfigurations = getProjects(appTree); - expect(projectsConfigurations.get('my-dir-my-app').root).toEqual( - 'apps/my-dir/my-app' + expect(projectsConfigurations.get('my-app').root).toEqual( + 'my-dir/my-app' ); - expect(projectsConfigurations.get('my-dir-my-app-e2e').root).toEqual( - 'apps/my-dir/my-app-e2e' + expect(projectsConfigurations.get('my-app-e2e').root).toEqual( + 'my-dir/my-app-e2e' ); }); it('should update tags and implicit deps', async () => { await applicationGenerator(appTree, { ...schema, - directory: 'myDir', + directory: 'my-dir/my-app', tags: 'one,two', }); const projects = Object.fromEntries(getProjects(appTree)); expect(projects).toMatchObject({ - 'my-dir-my-app': { + 'my-app': { tags: ['one', 'two'], }, - 'my-dir-my-app-e2e': { + 'my-app-e2e': { tags: [], - implicitDependencies: ['my-dir-my-app'], + implicitDependencies: ['my-app'], }, }); }); @@ -204,17 +206,17 @@ describe('app', () => { it("should generate correct directory for window's style paths", async () => { await applicationGenerator(appTree, { ...schema, - directory: 'myOuterDir\\myInnerDir', + directory: 'my-outer-dir\\my-inner-dir\\my-app', }); const projectsConfigurations = getProjects(appTree); - expect( - projectsConfigurations.get('my-outer-dir-my-inner-dir-my-app').root - ).toEqual('apps/my-outer-dir/my-inner-dir/my-app'); - expect( - projectsConfigurations.get('my-outer-dir-my-inner-dir-my-app-e2e').root - ).toEqual('apps/my-outer-dir/my-inner-dir/my-app-e2e'); + expect(projectsConfigurations.get('my-app').root).toEqual( + 'my-outer-dir/my-inner-dir/my-app' + ); + expect(projectsConfigurations.get('my-app-e2e').root).toEqual( + 'my-outer-dir/my-inner-dir/my-app-e2e' + ); }); it('should generate files', async () => { @@ -223,14 +225,17 @@ describe('app', () => { expect(lookupFn(config)).toEqual(expectedValue); }; - await applicationGenerator(appTree, { ...schema, directory: 'myDir' }); + await applicationGenerator(appTree, { + ...schema, + directory: 'my-dir/my-app', + }); // Make sure these exist [ - 'apps/my-dir/my-app/src/main.tsx', - 'apps/my-dir/my-app/src/app/app.tsx', - 'apps/my-dir/my-app/src/app/app.spec.tsx', - 'apps/my-dir/my-app/src/app/app.module.css', + 'my-dir/my-app/src/main.tsx', + 'my-dir/my-app/src/app/app.tsx', + 'my-dir/my-app/src/app/app.spec.tsx', + 'my-dir/my-app/src/app/app.module.css', ].forEach((path) => { expect(appTree.exists(path)).toBeTruthy(); }); @@ -238,12 +243,12 @@ describe('app', () => { // Make sure these have properties [ { - path: 'apps/my-dir/my-app/tsconfig.app.json', + path: 'my-dir/my-app/tsconfig.app.json', lookupFn: (json) => json.compilerOptions.outDir, - expectedValue: '../../../dist/out-tsc', + expectedValue: '../../dist/out-tsc', }, { - path: 'apps/my-dir/my-app/tsconfig.app.json', + path: 'my-dir/my-app/tsconfig.app.json', lookupFn: (json) => json.exclude, expectedValue: [ 'jest.config.ts', @@ -258,14 +263,14 @@ describe('app', () => { ], }, { - path: 'apps/my-dir/my-app-e2e/tsconfig.json', + path: 'my-dir/my-app-e2e/tsconfig.json', lookupFn: (json) => json.compilerOptions.outDir, - expectedValue: '../../../dist/out-tsc', + expectedValue: '../../dist/out-tsc', }, { - path: 'apps/my-dir/my-app/.eslintrc.json', + path: 'my-dir/my-app/.eslintrc.json', lookupFn: (json) => json.extends, - expectedValue: ['plugin:@nx/react', '../../../.eslintrc.json'], + expectedValue: ['plugin:@nx/react', '../../.eslintrc.json'], }, ].forEach(hasJsonValue); }); @@ -273,31 +278,33 @@ describe('app', () => { it('should setup playwright', async () => { await applicationGenerator(appTree, { ...schema, - directory: 'myDir', + directory: 'my-dir/my-app', e2eTestRunner: 'playwright', }); expect( - appTree.exists('apps/my-dir/my-app-e2e/playwright.config.ts') + appTree.exists('my-dir/my-app-e2e/playwright.config.ts') ).toBeTruthy(); expect( - appTree.exists('apps/my-dir/my-app-e2e/src/example.spec.ts') + appTree.exists('my-dir/my-app-e2e/src/example.spec.ts') ).toBeTruthy(); expect( - readProjectConfiguration(appTree, 'my-dir-my-app-e2e')?.targets?.e2e - ?.executor + readProjectConfiguration(appTree, 'my-app-e2e')?.targets?.e2e?.executor ).toEqual('@nx/playwright:playwright'); }); }); it('should create Nx specific template', async () => { - await applicationGenerator(appTree, { ...schema, directory: 'myDir' }); + await applicationGenerator(appTree, { + ...schema, + directory: 'my-dir/my-app', + }); expect( - appTree.read('apps/my-dir/my-app/src/app/app.tsx', 'utf-8') + appTree.read('my-dir/my-app/src/app/app.tsx', 'utf-8') ).toMatchSnapshot(); expect( - appTree.read('apps/my-dir/my-app/src/app/nx-welcome.tsx').toString() + appTree.read('my-dir/my-app/src/app/nx-welcome.tsx').toString() ).toContain('Hello there'); }); @@ -315,7 +322,7 @@ describe('app', () => { }); expect(() => { - readJson(appTree, `apps/my-app/.babelrc`); + readJson(appTree, `my-app/.babelrc`); }).not.toThrow(); } ); @@ -323,16 +330,14 @@ describe('app', () => { describe('--style scss', () => { it('should generate scss styles', async () => { await applicationGenerator(appTree, { ...schema, style: 'scss' }); - expect(appTree.exists('apps/my-app/src/app/app.module.scss')).toEqual( - true - ); + expect(appTree.exists('my-app/src/app/app.module.scss')).toEqual(true); }); }); it('should setup jest with tsx support', async () => { await applicationGenerator(appTree, { ...schema, name: 'my-app' }); - expect(appTree.read('apps/my-app/jest.config.ts').toString()).toContain( + expect(appTree.read('my-app/jest.config.ts').toString()).toContain( `moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],` ); }); @@ -340,7 +345,7 @@ describe('app', () => { it('should setup jest with babel-jest support', async () => { await applicationGenerator(appTree, { ...schema, name: 'my-app' }); - expect(appTree.read('apps/my-app/jest.config.ts').toString()).toContain( + expect(appTree.read('my-app/jest.config.ts').toString()).toContain( "['babel-jest', { presets: ['@nx/react/babel'] }]" ); }); @@ -348,7 +353,7 @@ describe('app', () => { it('should setup jest without serializers', async () => { await applicationGenerator(appTree, { ...schema, name: 'my-app' }); - expect(appTree.read('apps/my-app/jest.config.ts').toString()).not.toContain( + expect(appTree.read('my-app/jest.config.ts').toString()).not.toContain( `'jest-preset-angular/build/AngularSnapshotSerializer.js',` ); }); @@ -366,24 +371,24 @@ describe('app', () => { expect(targetConfig.build.outputs).toEqual(['{options.outputPath}']); expect(targetConfig.build.options).toEqual({ compiler: 'babel', - assets: ['apps/my-app/src/favicon.ico', 'apps/my-app/src/assets'], - index: 'apps/my-app/src/index.html', - main: 'apps/my-app/src/main.tsx', + assets: ['my-app/src/favicon.ico', 'my-app/src/assets'], + index: 'my-app/src/index.html', + main: 'my-app/src/main.tsx', baseHref: '/', - outputPath: 'dist/apps/my-app', + outputPath: 'dist/my-app', scripts: [], - styles: ['apps/my-app/src/styles.css'], - tsConfig: 'apps/my-app/tsconfig.app.json', + styles: ['my-app/src/styles.css'], + tsConfig: 'my-app/tsconfig.app.json', isolatedConfig: true, - webpackConfig: 'apps/my-app/webpack.config.js', + webpackConfig: 'my-app/webpack.config.js', }); expect(targetConfig.build.configurations.production).toEqual({ optimization: true, extractLicenses: true, fileReplacements: [ { - replace: 'apps/my-app/src/environments/environment.ts', - with: 'apps/my-app/src/environments/environment.prod.ts', + replace: 'my-app/src/environments/environment.ts', + with: 'my-app/src/environments/environment.prod.ts', }, ], namedChunks: false, @@ -405,13 +410,11 @@ describe('app', () => { expect(targetConfig.build.executor).toEqual('@nx/vite:build'); expect(targetConfig.build.outputs).toEqual(['{options.outputPath}']); expect(targetConfig.build.options).toEqual({ - outputPath: 'dist/apps/my-app', + outputPath: 'dist/my-app', }); + expect(appTree.exists(`my-app/environments/environment.ts`)).toBeFalsy(); expect( - appTree.exists(`apps/my-app/environments/environment.ts`) - ).toBeFalsy(); - expect( - appTree.exists(`apps/my-app/environments/environment.prod.ts`) + appTree.exists(`my-app/environments/environment.prod.ts`) ).toBeFalsy(); }); @@ -462,7 +465,7 @@ describe('app', () => { executor: '@nx/linter:eslint', outputs: ['{options.outputFile}'], options: { - lintFilePatterns: ['apps/my-app/**/*.{ts,tsx,js,jsx}'], + lintFilePatterns: ['my-app/**/*.{ts,tsx,js,jsx}'], }, }); }); @@ -475,9 +478,9 @@ describe('app', () => { }); expect(appTree.exists('jest.config.ts')).toBeFalsy(); - expect(appTree.exists('apps/my-app/src/app/app.spec.tsx')).toBeFalsy(); - expect(appTree.exists('apps/my-app/tsconfig.spec.json')).toBeFalsy(); - expect(appTree.exists('apps/my-app/jest.config.ts')).toBeFalsy(); + expect(appTree.exists('my-app/src/app/app.spec.tsx')).toBeFalsy(); + expect(appTree.exists('my-app/tsconfig.spec.json')).toBeFalsy(); + expect(appTree.exists('my-app/jest.config.ts')).toBeFalsy(); const projectsConfigurations = getProjects(appTree); expect(projectsConfigurations.get('my-app').targets.test).toBeUndefined(); expect(projectsConfigurations.get('my-app').targets.lint) @@ -486,7 +489,7 @@ describe('app', () => { "executor": "@nx/linter:eslint", "options": { "lintFilePatterns": [ - "apps/my-app/**/*.{ts,tsx,js,jsx}", + "my-app/**/*.{ts,tsx,js,jsx}", ], }, "outputs": [ @@ -501,7 +504,7 @@ describe('app', () => { it('should not generate test configuration', async () => { await applicationGenerator(appTree, { ...schema, e2eTestRunner: 'none' }); - expect(appTree.exists('apps/my-app-e2e')).toBeFalsy(); + expect(appTree.exists('my-app-e2e')).toBeFalsy(); const projectsConfigurations = getProjects(appTree); expect(projectsConfigurations.get('my-app-e2e')).toBeUndefined(); }); @@ -514,12 +517,8 @@ describe('app', () => { e2eTestRunner: 'playwright', }); - expect( - appTree.exists('apps/my-app-e2e/playwright.config.ts') - ).toBeTruthy(); - expect( - appTree.exists('apps/my-app-e2e/src/example.spec.ts') - ).toBeTruthy(); + expect(appTree.exists('my-app-e2e/playwright.config.ts')).toBeTruthy(); + expect(appTree.exists('my-app-e2e/src/example.spec.ts')).toBeTruthy(); expect( readProjectConfiguration(appTree, 'my-app-e2e')?.targets?.e2e?.executor ).toEqual('@nx/playwright:playwright'); @@ -530,16 +529,16 @@ describe('app', () => { it('should use upper case app file', async () => { await applicationGenerator(appTree, { ...schema, pascalCaseFiles: true }); - expect(appTree.exists('apps/my-app/src/app/App.tsx')).toBeTruthy(); - expect(appTree.exists('apps/my-app/src/app/App.spec.tsx')).toBeTruthy(); - expect(appTree.exists('apps/my-app/src/app/App.module.css')).toBeTruthy(); + expect(appTree.exists('my-app/src/app/App.tsx')).toBeTruthy(); + expect(appTree.exists('my-app/src/app/App.spec.tsx')).toBeTruthy(); + expect(appTree.exists('my-app/src/app/App.module.css')).toBeTruthy(); }); it(`should use the correct case for file import in the spec file`, async () => { await applicationGenerator(appTree, { ...schema, pascalCaseFiles: true }); const appSpecContent = appTree - .read('apps/my-app/src/app/App.spec.tsx') + .read('my-app/src/app/App.spec.tsx') .toString(); expect(appSpecContent).toMatch(/import App from '.\/App'/); @@ -549,7 +548,7 @@ describe('app', () => { it('should generate functional components by default', async () => { await applicationGenerator(appTree, schema); - const appContent = appTree.read('apps/my-app/src/app/app.tsx').toString(); + const appContent = appTree.read('my-app/src/app/app.tsx').toString(); expect(appContent).not.toMatch(/extends Component/); }); @@ -558,7 +557,7 @@ describe('app', () => { await applicationGenerator(appTree, { ...schema }); const appSpecContent = appTree - .read('apps/my-app/src/app/app.spec.tsx') + .read('my-app/src/app/app.spec.tsx') .toString(); expect(appSpecContent).toMatch(/import App from '.\/app'/); @@ -584,12 +583,12 @@ describe('app', () => { ).toBeDefined(); expect(packageJson.devDependencies['eslint-config-prettier']).toBeDefined(); - const eslintJson = readJson(appTree, '/apps/my-app/.eslintrc.json'); + const eslintJson = readJson(appTree, '/my-app/.eslintrc.json'); expect(eslintJson).toMatchInlineSnapshot(` { "extends": [ "plugin:@nx/react", - "../../.eslintrc.json", + "../.eslintrc.json", ], "ignorePatterns": [ "!**/*", @@ -627,7 +626,7 @@ describe('app', () => { it('should generate class components', async () => { await applicationGenerator(appTree, { ...schema, classComponent: true }); - const appContent = appTree.read('apps/my-app/src/app/app.tsx').toString(); + const appContent = appTree.read('my-app/src/app/app.tsx').toString(); expect(appContent).toMatch(/extends Component/); }); @@ -637,16 +636,16 @@ describe('app', () => { it('should not generate any styles', async () => { await applicationGenerator(appTree, { ...schema, style: 'none' }); - expect(appTree.exists('apps/my-app/src/app/app.tsx')).toBeTruthy(); - expect(appTree.exists('apps/my-app/src/app/app.spec.tsx')).toBeTruthy(); - expect(appTree.exists('apps/my-app/src/app/app.css')).toBeFalsy(); - expect(appTree.exists('apps/my-app/src/app/app.scss')).toBeFalsy(); - expect(appTree.exists('apps/my-app/src/app/app.styl')).toBeFalsy(); - expect(appTree.exists('apps/my-app/src/app/app.module.css')).toBeFalsy(); - expect(appTree.exists('apps/my-app/src/app/app.module.scss')).toBeFalsy(); - expect(appTree.exists('apps/my-app/src/app/app.module.styl')).toBeFalsy(); + expect(appTree.exists('my-app/src/app/app.tsx')).toBeTruthy(); + expect(appTree.exists('my-app/src/app/app.spec.tsx')).toBeTruthy(); + expect(appTree.exists('my-app/src/app/app.css')).toBeFalsy(); + expect(appTree.exists('my-app/src/app/app.scss')).toBeFalsy(); + expect(appTree.exists('my-app/src/app/app.styl')).toBeFalsy(); + expect(appTree.exists('my-app/src/app/app.module.css')).toBeFalsy(); + expect(appTree.exists('my-app/src/app/app.module.scss')).toBeFalsy(); + expect(appTree.exists('my-app/src/app/app.module.styl')).toBeFalsy(); - const content = appTree.read('apps/my-app/src/app/app.tsx').toString(); + const content = appTree.read('my-app/src/app/app.tsx').toString(); expect(content).not.toContain('styled-components'); expect(content).not.toContain(''); expect(content).not.toContain('@emotion/styled'); @@ -715,14 +714,12 @@ describe('app', () => { }); expect( - appTree.exists('apps/my-app/src/app/app.styled-components') - ).toBeFalsy(); - expect(appTree.exists('apps/my-app/src/app/app.tsx')).toBeTruthy(); - expect( - appTree.exists('apps/my-app/src/styles.styled-components') + appTree.exists('my-app/src/app/app.styled-components') ).toBeFalsy(); + expect(appTree.exists('my-app/src/app/app.tsx')).toBeTruthy(); + expect(appTree.exists('my-app/src/styles.styled-components')).toBeFalsy(); - const content = appTree.read('apps/my-app/src/app/app.tsx').toString(); + const content = appTree.read('my-app/src/app/app.tsx').toString(); expect(content).toContain('styled-component'); expect(content).toContain(''); }); @@ -745,12 +742,10 @@ describe('app', () => { style: '@emotion/styled', }); - expect( - appTree.exists('apps/my-app/src/app/app.@emotion/styled') - ).toBeFalsy(); - expect(appTree.exists('apps/my-app/src/app/app.tsx')).toBeTruthy(); + expect(appTree.exists('my-app/src/app/app.@emotion/styled')).toBeFalsy(); + expect(appTree.exists('my-app/src/app/app.tsx')).toBeTruthy(); - const content = appTree.read('apps/my-app/src/app/app.tsx').toString(); + const content = appTree.read('my-app/src/app/app.tsx').toString(); expect(content).toContain('@emotion/styled'); expect(content).toContain(''); }); @@ -761,7 +756,7 @@ describe('app', () => { style: '@emotion/styled', }); - const tsconfigJson = readJson(appTree, 'apps/my-app/tsconfig.json'); + const tsconfigJson = readJson(appTree, 'my-app/tsconfig.json'); expect(tsconfigJson.compilerOptions['jsxImportSource']).toEqual( '@emotion/react' ); @@ -814,10 +809,10 @@ describe('app', () => { style: 'styled-jsx', }); - expect(appTree.exists('apps/my-app/src/app/app.styled-jsx')).toBeFalsy(); - expect(appTree.exists('apps/my-app/src/app/app.tsx')).toBeTruthy(); + expect(appTree.exists('my-app/src/app/app.styled-jsx')).toBeFalsy(); + expect(appTree.exists('my-app/src/app/app.tsx')).toBeTruthy(); - const content = appTree.read('apps/my-app/src/app/app.tsx').toString(); + const content = appTree.read('my-app/src/app/app.tsx').toString(); expect(content).toContain('