Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use mock for CSS-files #3590

Closed
wants to merge 1 commit into from
Closed

Use mock for CSS-files #3590

wants to merge 1 commit into from

Conversation

clentfort
Copy link

Summary:

Missing CSS files cause failing tests, this is problematic when using a
preprocessor such as SASS.

Test plan:

  1. Create a project
  2. Delete src/App.css.
  3. Run yarn test.

Verify the test passes and does not fail with a Cannot find module './App.css' from 'App.js'-error.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

**Summary:**

Missing CSS files cause failing tests, this is problematic when using a
preprocessor such as SASS.

**Test plan:**

1. Create a project
2. Delete `src/App.css`.
3. Run `yarn test`.

Verify the test passes and does not fail with a `Cannot find module
'./App.css' from 'App.js'`-error.
@clentfort
Copy link
Author

clentfort commented Dec 13, 2017

I prpose this change because I use a CSS-preprocessor with create-react-app, this leads to problems with tests failing on CI. The preprocessor is not run before the tests are executed, therefore the CSS files are missing.

Currently I have a pretest-hook, that generates the CSS-files. This slows down test-execution and adds another step that could possibly fail.

A build of a project will still fail, when a CSS file is missing, so this change can not lead to projects that stop working unexpectedly.

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@gaearon
Copy link
Contributor

gaearon commented Jan 9, 2018

Thanks for the PR, but I don't think we'll take this. You could similarly argue a missing file means a mistake that should be caught by tests.

As a workaround, you can run the build before tests (it's a good idea anyway).

We plan some sort of Sass support in future releases (#2498) so let's focus on that instead.

@gaearon gaearon closed this Jan 9, 2018
@clentfort clentfort deleted the patch-1 branch January 9, 2018 17:19
@lock lock bot locked and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants