Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Testing wih Jest fails. #30

Open
1ik opened this issue Oct 28, 2017 · 1 comment
Open

Testing wih Jest fails. #30

1ik opened this issue Oct 28, 2017 · 1 comment

Comments

@1ik
Copy link

1ik commented Oct 28, 2017

The following block of code is causing a failure when I am using Jest with jest-angular-preset plugin.

styleUrls: [
'./quillEditor.component.css',
'../quill/dist/quill.core.css',
'../quill/dist/quill.snow.css',
'../quill/dist/quill.bubble.css'
],

The details of the error is,

 FAIL  src/app/app.component.spec.ts (5.944s)
  AppComponent
    ✕ should create the app (96ms)

  ● AppComponent › should create the app

    SyntaxError: The string did not match the expected pattern.

      at XMLHttpRequest.open [as __zone_symbol__open] (node_modules/jest-preset-angular/node_modules/jsdom/lib/jsdom/living/xmlhttprequest.js:475:15)
      at Array.map (native)

  ● AppComponent › should create the app

    SyntaxError: The string did not match the expected pattern.

      at XMLHttpRequest.open [as __zone_symbol__open] (node_modules/jest-preset-angular/node_modules/jsdom/lib/jsdom/living/xmlhttprequest.js:475:15)
      at Array.map (native)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        7.915s
Ran all test suites.

However, the error can be easily fixed if it's changed to inline like the following,

styleUrls: [
    './quillEditor.component.css', '../quill/dist/quill.core.css', '../quill/dist/quill.snow.css', '../quill/dist/quill.bubble.css'
  ],

I know this is jest-angular-preset's plugins regex that fails to parse the line breaks but if you think that little change in code won't hurt I can create a PR :).

@clementGilardy
Copy link

I have the same problem but I have just once style in my array...

styleUrls: ['./accueil.component.scss']

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants