Jest-preset-angular: `Schema validation failed` Error when running tests and updating @angular-builders/jest from `7.3.1` to `8.0.1`

Created on 30 May 2019  路  9Comments  路  Source: thymikee/jest-preset-angular

Firstly, apologies if this has already been answered. I can't seem to find any issues or comments with this error.

I have just updated my version of @angular-builders/jest from 7.3.1 to 8.0.1. From what i understand, issues should be raised here. When I run my tests I now get the following error (it was working fine before):

Schema validation failed with the following errors:
  Data path ".builders['run']" should have required property 'class'.
Error: Schema validation failed with the following errors:
  Data path ".builders['run']" should have required property 'class'.
....

I can't see anything in the doc's to advise me what this issue might be, I guess there is a breaking change, but i don't use transform or global in my configurations.

I would like to update this as my code coverage is a bit misleading at the moment.

Hopefully, someone here knows what the issue is.

Most helpful comment

Can confirm that it works with Angular v8!

Here the changes I had to make from a newly generated Angular app to make the tests run in jest.

All 9 comments

Yeah, Angular v8 is only out since two days, we have not looked into it yet. Version 8 of jest-preset-angular will eventually support it.

I created a v8 repo and tried to run the tests there, but failed. Interestingly enough I had different errors (during TestBed setup, platform was never setup inside the TestBed instance, aka getComponentFromError).
Another notice:

  • zone.js had a major udpate (v0.8 to v0.9) and we might have to adjust or extend zone-patch

It seems there are even more things that are not clear yet, especially in how Angular sets up the tests for karma. I think it might some time until we can properly support Angular v8.

Oh I see, you only refer to the update of @angular-builders/jest. Sorry for the confusion, I somehow thought you referred to @angular-devkit/build-angular@8.

Please understand that we do not support any problems that are directly related with the @angular-builders/jest. Please create an issue on https://github.com/meltedspark/angular-builders/issues instead.

I also do not know why there is already a v8 package of @angular-builders/jest out already, if it relies on this preset supporting Angular v8, which it does not yet.

@wtho do we have an eta on v8 support?

Thanks for all you do :)

@schtauffen if using without jest-builder v8 works fine with the current version of preset :) At work I use without jest-builder

Oh strange, I am not using jest-builder but get this:

Module /node_modules/jest-preset-angular/preprocessor.js in the transform option was not found.

my config:

module.exports = {
  preset: 'jest-preset-angular',
  setupFilesAfterEnv: ['<rootDir>/src/setupJest.ts'],
  transform: {
    '^.+\\.(ts|html)$': '<rootDir>/node_modules/jest-preset-angular/preprocessor.js',
    '^.+\\.js$': 'babel-jest',
  },
  verbose: false,
};

@schtauffen you use the transform-syntax of ts-jest version < 23.10 and jest-preset-angular version < 7.
To use the current transform-syntax see the exposed configuration in the README.md.

Before regex-preprocessors were used, now AST-transformers are applied to the code loaded for jest.

Can confirm that it works with Angular v8!

Here the changes I had to make from a newly generated Angular app to make the tests run in jest.

Can confirm that it works with Angular v8!

Here the changes I had to make from a newly generated Angular app to make the tests run in jest.

Thanks for the direction! Everything is now working :)

Yeah, I even tried a newly generated project with Ivy (the new compiler) enabled and with bazel (the new build tool) and it worked :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

r-kernberger picture r-kernberger  路  7Comments

Nxt3 picture Nxt3  路  4Comments

jfcere picture jfcere  路  4Comments

thekip picture thekip  路  6Comments

chris5287 picture chris5287  路  7Comments