Giter Club home page Giter Club logo

Comments (5)

rkrisztian avatar rkrisztian commented on June 15, 2024 2

Webpack extension is also going to be useful for code coverage. The original way looks like this:
https://github.com/bahmutov/cypress-angular-unit-test#code-coverage

from devkit.

edbzn avatar edbzn commented on June 15, 2024 1

Actually, there's no way to extend the webpack configuration as it's generated from Angular CLI internals, but that's a feature we can think about.

from devkit.

rkrisztian avatar rkrisztian commented on June 15, 2024

Sadly I ran into various issues while trying to combine these together:

  • Angular 12 project generated with @nrwl/nx (i.e. heavily TypeScript based)
  • Cypress component testing (@jscutlery/cypress-angular)
    • With Cucumber feature support (cypress-cucumber-preprocessor)
    • With code coverage instrumentation (@cypress/code-coverage, ngx-build-plus)
      (Even if we ignore coverage for now, ngx-build-plus is still the idea to load .feature files.)

The issues I experienced:

  • import '@cypress/code-coverage/support'; fails with ReferenceError: Cypress is not defined
  • feature files don't compile for the following error:
Error: Dev-server compilation failed. We can not run tests if dev-server can not compile and emit assets, please make sure that all syntax errors resolved before running cypress. 

 [object Object]
    at EventEmitter.<anonymous> (/home/rkrisztian/.cache/Cypress/7.4.0/Cypress/resources/app/packages/server/lib/modes/run-ct.js:8:7)
    at EventEmitter.emit (events.js:327:22)
    at EventEmitter.<anonymous> (/home/rkrisztian/.cache/Cypress/7.4.0/Cypress/resources/app/packages/server/lib/plugins/dev-server.js:15:17)
    at EventEmitter.emit (events.js:315:20)
    at ChildProcess.<anonymous> (/home/rkrisztian/.cache/Cypress/7.4.0/Cypress/resources/app/packages/server/lib/plugins/util.js:19:22)
    at ChildProcess.emit (events.js:315:20)
    at emit (internal/child_process.js:903:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)

After some debugging, the error is the following:

{
  "moduleIdentifier": "/home/rkrisztian/my-project/apps/my-app/src/example.feature",
  "moduleName": "./src/example.feature",
  "loc": "1:13",
  "message": "Module parse failed: Unexpected token (1:13)\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders\n> Feature: App Main Page..." // (Rest omitted!)
 // ...
}

But I did include the rules into the webpack extension... :( And I also double checked that my webpack.extra.js is loaded and syntactically valid...

from devkit.

rkrisztian avatar rkrisztian commented on June 15, 2024

badeball/cypress-cucumber-preprocessor#443 might be related to my problems.

from devkit.

edbzn avatar edbzn commented on June 15, 2024

Hi, now we can pass to the dev server a custom Webpack config that will be merged with the Angular CLI. This feature will be published soon.

from devkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.