Tests for Default template do not work
See original GitHub issue** I’d post this in the templates repo but there is no issue section available.
Do you want to request a feature or report a bug?
Bug
What is the current behaviour?
The npm test
command fails for apps produced using the default
template
If the current behaviour is a bug, please provide the steps to reproduce.
npm i -g preact-cli@3.0.0-rc.1
preact create default foobar
npm test
output:
● Validation Error:
Preset jest-preset-preact not found.
Configuration Documentation:
https://facebook.github.io/jest/docs/configuration.html
What is the expected behaviour? Should run sample tests successfully.
Please mention other relevant information.
Even if I use the --config
flag to point to the jest-preset-preact
config file directly, it fails.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Something wrong with default template | WordPress.org
Hi @drjkiel! On the pages where the lists are properly displayed, the page template used is Default. The pages where the lists aren't...
Read more >Pycharm 2020.1 not retaining testing template configs
I updated my PyCharm today, and I noticed that when testing modules via the IDE they're not retaining the configurations I set in...
Read more >Test not recognising default property `form.invalid` in a ...
This is done by the 'required' property on the name input field. So I created the following template: <form #form="ngForm"> <!-- note the...
Read more >ALM template tests - ADM Help Centers
All template tests are saved in your ALM project (except for the default template test, which is located on the ALM client) and...
Read more >Template test cases for test toolkit - Azure Resource Manager
This article describes tests that are run with the template test toolkit for Azure Resource Manager templates (ARM templates).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I needed some more steps to get tests running with jest 24.9.0.
Update
preact-cli
to version v3.0.0-rc.4After update to jest 24.9.0 I run into the problem that
preact-cli babel-config
does not exports a function directly. This can be solved with updatingpreact-cli
to version v3.0.0-rc.4.Change browser to “maintained node versions” in jest-preset-preact
The next issue was. I changed the config inbrowerlists
doesn’t know browser “node” anymorebabel-jest.js
injest-preset-preact
to use “maintained node versions”.Update: This is because I don’t have “node 10” installed. https://github.com/preactjs/preact-cli/pull/898#issue-323046105
Minor changes to
header.test.js
andheader/index.js
I’ve changed the import to “./style.css”.
Solved with
import { r } from preact
inheader.test.js
.Well, I’ve created a pull request for templates repo with @andreek fixes https://github.com/preactjs-templates/default/pull/31
As for style.css I think we should add ‘css’ to moduleFileExtensions in jest config here https://github.com/preactjs/preact-cli/blob/2455618c20b58f385fcc0466d6f4de284947e4f1/packages/jest-preset-preact/src/config.js#L17 as mentioned here https://jestjs.io/docs/en/configuration#modulefileextensions-array-string
but as now it will create a dependency to preact-cli release that doesn’t yet exist