Skip to content

configure to allow raw testing of individual files #140

@robbiemu

Description

@robbiemu

Is your feature request related to a problem? Please describe.

I would like to be able to directly test individual files. When setting jest up on my own, I used to be able to: jest ./src/app/app.component.spec.ts

and this comes in handy especially in vscode where I might drag and drop the file directly to the terminal..

now that produces:

Determining test suites to run...
ngcc-jest-processor: running ngcc
FAIL  src/app/app.component.spec.ts
 AppComponent
   ✕ should create the app (3 ms)
   ✕ should have as title 'ang15-test' (6 ms)
   ✕ should render title (1 ms)

 ● AppComponent › should create the app

   Need to call TestBed.initTestEnvironment() first
...

likewise, I cannot call ng test directly with the filename:

ng test ./src/app/app.component.spec.ts

Error: Invalid values:
  Argument: project, Given: "./src/app/app.component.spec.ts", Choices: "ang15-test"

ng test -- ./src/app/app.component.spec.ts
Option '--' has been specified multiple times. The value './src/app/app.component.spec.ts' will be used.
Error: Schema validation failed with the following errors:
  Data path "/" must be array.

Describe the solution you'd like
A clear and concise description of what you want to happen.

I should be able to test specific files directly on the commandline, such as:

jest <filename>

Describe alternatives you've considered
As I've had that working in multiple repos before, I am sure I will be able to figure it out with modern angular 15 now. I just havent located the issue yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions