ng test --include for a specific file is still executing all spec files

Discussão em 'Angular' iniciado por fumeng, Fevereiro 19, 2025.

  1. fumeng

    fumeng Guest

    I've got an Angular 13 app and I'm running the following script to only execute one spec file, but it's still executing everything:

    npx ng test --include src/app/services/mySharedService.spec.ts


    my test.ts is standard and has this snippet:

    const context = require.context('./', true, /\.spec\ts$/);


    my karma.conf.js is standard, too. with a basePath of ''.

    Either way, the script I run should override all those and only execute the file I include. What am I doing wrong?

    i checked the documentation and the --include option mentions an array as the value type. so i tried adding that via:

    npx ng test --include ['src/app/services/mySharedService.spec.ts']


    and it says that it did not match any spec files.

    even this snippet will execute tests outside the services folder:

    ng test --include='**/services/*.spec.ts'

    Continue reading...

Compartilhe esta Página