Skip to content

TSConfig seemingly not used when passed in via angular's build options (see #23161) #23673

@yusijs

Description

@yusijs

Current behavior

In #23161 we were allowed to pass in an Angular config object, which also includes a tsconfig-path. However, that tsconfig path seems to be fully ignored; if I pass in a random string, everything builds/tests as it should. I dug a bit through the code and looking at e.g

const tsConfigContent = JSON.stringify({
, it always uses /tsconfig.json.

Desired behavior

In my Angular / NX apps I have:

  • tsconfig.json (baseline)
  • tsconfig.app.json
  • tsconfig.jest.json
  • tsconfig.editor.json

I would also like to have a tsconfig.cypress.json to ensure the correct paths etc are used without having to interfere with the rest of my tsconfig-setup.

Test code to reproduce

// cypress.config.ts
export default defineConfig({
  component: {
    video: true,
    videosFolder: root + 'dist/cypress/components/videos',
    screenshotsFolder: root + 'dist/cypress/components/screenshots',
    devServer: {
      framework: 'angular',
      bundler: 'webpack',
      options: { // temporary, this will be done automatically when we get it directly from nx
        projectConfig: {
          root: projectRoot,
          sourceRoot: projectRoot + 'src',
          buildOptions: {
            tsConfig: _projectRoot + 'tsconfig.app.json',
            ... more config (that works yay)
          },
        }
      }
    },
    specPattern: 'cypress/specs/**/*.cy.ts',
  },
});

Cypress Version

10.7.0

Node version

v18.4.0 (also tried with 16.2.0)

Operating System

macOS 12.5

Debug Logs

No response

Other

No response

Metadata

Metadata

Assignees

Labels

CTIssue related to component testingnpm: @cypress/angular@cypress/angular package issues

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions