“No tests found” when running jest from command line The Next CEO of Stack OverflowJest from create-react-app not running on WindowsError while running jest on node 0.12.0Jest No Tests foundHow to watch webpack-dev-server running Jest tests at the same time?React Jest creating error “new Error('…')” exit and fail testing immediatelytrying to run typescript with jest with create-react-appTypeError: environment.dispose is not a function when running npm testReact native typescript throws error when running jest test commandLoading a test .env file in jestconfiguring jest to run tests in a different folderJest tests keep failing

Can you be charged for obstruction for refusing to answer questions?

Would be okay to drive on this tire?

Is a distribution that is normal, but highly skewed considered Gaussian?

Method for adding error messages to a dictionary given a key

The exact meaning of 'Mom made me a sandwich'

Is it possible to use a NPN BJT as switch, from single power source?

Does Germany produce more waste than the US?

Why do airplanes bank sharply to the right after air-to-air refueling?

How to get from Geneva Airport to Metabief, Doubs, France by public transport?

A Man With a Stainless Steel Endoskeleton (like The Terminator) Fighting Cloaked Aliens Only He Can See

How to check if all elements of 1 list are in the *same quantity* and in any order, in the list2?

Why is my new battery behaving weirdly?

Can MTA send mail via a relay without being told so?

What steps are necessary to read a Modern SSD in Medieval Europe?

Why did CATV standarize in 75 ohms and everyone else in 50?

Why isn't acceleration always zero whenever velocity is zero, such as the moment a ball bounces off a wall?

Domestic-to-international connection at Orlando (MCO)

Proper way to express "He disappeared them"

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

Is there a difference between "Fahrstuhl" and "Aufzug"

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?

Is it convenient to ask the journal's editor for two additional days to complete a review?

Is it professional to write unrelated content in an almost-empty email?

Why didn't Khan get resurrected in the Genesis Explosion?



“No tests found” when running jest from command line



The Next CEO of Stack OverflowJest from create-react-app not running on WindowsError while running jest on node 0.12.0Jest No Tests foundHow to watch webpack-dev-server running Jest tests at the same time?React Jest creating error “new Error('…')” exit and fail testing immediatelytrying to run typescript with jest with create-react-appTypeError: environment.dispose is not a function when running npm testReact native typescript throws error when running jest test commandLoading a test .env file in jestconfiguring jest to run tests in a different folderJest tests keep failing










1















In a React project built with create-react-app where the test files resides in the same folder next to the code they need to test, like follows:



|- /src/path
| |- List.tsx
| |- List.test.tsx


when trying to run npx jest, or using the global jest, I get the following result:



No tests found
In C:srcpath
34 files checked.
testMatch: ***test.tsx,**/*test.tsx,src***.test.tsx,src/**/*.test.tsx,C:srcpathsrc***.test.tsx,C:srcpathsrc***.test.tsx - 0 matches
testPathIgnorePatterns: \node_modules\ - 34 matches
Pattern: - 0 matches


Running npm test - which in turns run the script react-scripts test from package.json - works fine and is able to find and run all the tests in the project (in watch mode).



Any idea how to solve this problem?



Environment



  • node: 10.15.0

  • npm: 6.4.1

  • react-scripts: 2.1.3

  • Operating system: Windows 10 1809 17763.316

jest.config.js



module.exports = /)(.test).tsx?$'
],
;









share|improve this question




























    1















    In a React project built with create-react-app where the test files resides in the same folder next to the code they need to test, like follows:



    |- /src/path
    | |- List.tsx
    | |- List.test.tsx


    when trying to run npx jest, or using the global jest, I get the following result:



    No tests found
    In C:srcpath
    34 files checked.
    testMatch: ***test.tsx,**/*test.tsx,src***.test.tsx,src/**/*.test.tsx,C:srcpathsrc***.test.tsx,C:srcpathsrc***.test.tsx - 0 matches
    testPathIgnorePatterns: \node_modules\ - 34 matches
    Pattern: - 0 matches


    Running npm test - which in turns run the script react-scripts test from package.json - works fine and is able to find and run all the tests in the project (in watch mode).



    Any idea how to solve this problem?



    Environment



    • node: 10.15.0

    • npm: 6.4.1

    • react-scripts: 2.1.3

    • Operating system: Windows 10 1809 17763.316

    jest.config.js



    module.exports = /)(.test).tsx?$'
    ],
    ;









    share|improve this question


























      1












      1








      1








      In a React project built with create-react-app where the test files resides in the same folder next to the code they need to test, like follows:



      |- /src/path
      | |- List.tsx
      | |- List.test.tsx


      when trying to run npx jest, or using the global jest, I get the following result:



      No tests found
      In C:srcpath
      34 files checked.
      testMatch: ***test.tsx,**/*test.tsx,src***.test.tsx,src/**/*.test.tsx,C:srcpathsrc***.test.tsx,C:srcpathsrc***.test.tsx - 0 matches
      testPathIgnorePatterns: \node_modules\ - 34 matches
      Pattern: - 0 matches


      Running npm test - which in turns run the script react-scripts test from package.json - works fine and is able to find and run all the tests in the project (in watch mode).



      Any idea how to solve this problem?



      Environment



      • node: 10.15.0

      • npm: 6.4.1

      • react-scripts: 2.1.3

      • Operating system: Windows 10 1809 17763.316

      jest.config.js



      module.exports = /)(.test).tsx?$'
      ],
      ;









      share|improve this question
















      In a React project built with create-react-app where the test files resides in the same folder next to the code they need to test, like follows:



      |- /src/path
      | |- List.tsx
      | |- List.test.tsx


      when trying to run npx jest, or using the global jest, I get the following result:



      No tests found
      In C:srcpath
      34 files checked.
      testMatch: ***test.tsx,**/*test.tsx,src***.test.tsx,src/**/*.test.tsx,C:srcpathsrc***.test.tsx,C:srcpathsrc***.test.tsx - 0 matches
      testPathIgnorePatterns: \node_modules\ - 34 matches
      Pattern: - 0 matches


      Running npm test - which in turns run the script react-scripts test from package.json - works fine and is able to find and run all the tests in the project (in watch mode).



      Any idea how to solve this problem?



      Environment



      • node: 10.15.0

      • npm: 6.4.1

      • react-scripts: 2.1.3

      • Operating system: Windows 10 1809 17763.316

      jest.config.js



      module.exports = /)(.test).tsx?$'
      ],
      ;






      reactjs typescript jestjs react-scripts






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 10:06







      Marco Lackovic

















      asked Mar 7 at 16:07









      Marco LackovicMarco Lackovic

      2,66042736




      2,66042736






















          2 Answers
          2






          active

          oldest

          votes


















          1














          According to this answer, projects built with create-react-app are not meant to be tested directly with jest.



          react-scripts test should be used instead of jest to make use of the Jest configuration generated by the CRA setup.






          share|improve this answer






























            0














            Have you tried using / as a directory separator?



            From Jest docs:




            See the micromatch package for details of the patterns you can specify.




            From Micromatch docs:




            Micromatch exclusively and explicitly reserves backslashes for escaping characters in a glob pattern, even on windows. This is consistent with bash behavior.



            ...



            In other words, since \ is reserved as an escape character in globs, on windows path.join('foo', '*') would result in foo\*, which tells micromatch to match * as a literal character. This is the same behavior as bash.




            So I'd try:



            module.exports = 
            testMatch: [ '**/*.test.tsx' ]
            ;





            share|improve this answer























            • Thanks! Yes, I have tried with / with no success. I have updated my questions with other patterns I have tried.

              – Marco Lackovic
              Mar 8 at 9:08











            • From here I can't really help because I'm not on windows... is jest.config.js in the same folder as src?

              – gombosg
              Mar 8 at 17:42











            • It is not in the same folder, it is one folder below it, in the root of the project.

              – Marco Lackovic
              Mar 9 at 18:37











            • @MarcoLackovic have you tried running without setting the matches? The defaults seem to be fine for you.

              – gombosg
              Mar 11 at 1:56






            • 1





              Then maybe raising a GitHub issue is the way to go if it doesn't work with the defaults.

              – gombosg
              Mar 11 at 18:24











            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55048197%2fno-tests-found-when-running-jest-from-command-line%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            According to this answer, projects built with create-react-app are not meant to be tested directly with jest.



            react-scripts test should be used instead of jest to make use of the Jest configuration generated by the CRA setup.






            share|improve this answer



























              1














              According to this answer, projects built with create-react-app are not meant to be tested directly with jest.



              react-scripts test should be used instead of jest to make use of the Jest configuration generated by the CRA setup.






              share|improve this answer

























                1












                1








                1







                According to this answer, projects built with create-react-app are not meant to be tested directly with jest.



                react-scripts test should be used instead of jest to make use of the Jest configuration generated by the CRA setup.






                share|improve this answer













                According to this answer, projects built with create-react-app are not meant to be tested directly with jest.



                react-scripts test should be used instead of jest to make use of the Jest configuration generated by the CRA setup.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 14 at 9:19









                Marco LackovicMarco Lackovic

                2,66042736




                2,66042736























                    0














                    Have you tried using / as a directory separator?



                    From Jest docs:




                    See the micromatch package for details of the patterns you can specify.




                    From Micromatch docs:




                    Micromatch exclusively and explicitly reserves backslashes for escaping characters in a glob pattern, even on windows. This is consistent with bash behavior.



                    ...



                    In other words, since \ is reserved as an escape character in globs, on windows path.join('foo', '*') would result in foo\*, which tells micromatch to match * as a literal character. This is the same behavior as bash.




                    So I'd try:



                    module.exports = 
                    testMatch: [ '**/*.test.tsx' ]
                    ;





                    share|improve this answer























                    • Thanks! Yes, I have tried with / with no success. I have updated my questions with other patterns I have tried.

                      – Marco Lackovic
                      Mar 8 at 9:08











                    • From here I can't really help because I'm not on windows... is jest.config.js in the same folder as src?

                      – gombosg
                      Mar 8 at 17:42











                    • It is not in the same folder, it is one folder below it, in the root of the project.

                      – Marco Lackovic
                      Mar 9 at 18:37











                    • @MarcoLackovic have you tried running without setting the matches? The defaults seem to be fine for you.

                      – gombosg
                      Mar 11 at 1:56






                    • 1





                      Then maybe raising a GitHub issue is the way to go if it doesn't work with the defaults.

                      – gombosg
                      Mar 11 at 18:24















                    0














                    Have you tried using / as a directory separator?



                    From Jest docs:




                    See the micromatch package for details of the patterns you can specify.




                    From Micromatch docs:




                    Micromatch exclusively and explicitly reserves backslashes for escaping characters in a glob pattern, even on windows. This is consistent with bash behavior.



                    ...



                    In other words, since \ is reserved as an escape character in globs, on windows path.join('foo', '*') would result in foo\*, which tells micromatch to match * as a literal character. This is the same behavior as bash.




                    So I'd try:



                    module.exports = 
                    testMatch: [ '**/*.test.tsx' ]
                    ;





                    share|improve this answer























                    • Thanks! Yes, I have tried with / with no success. I have updated my questions with other patterns I have tried.

                      – Marco Lackovic
                      Mar 8 at 9:08











                    • From here I can't really help because I'm not on windows... is jest.config.js in the same folder as src?

                      – gombosg
                      Mar 8 at 17:42











                    • It is not in the same folder, it is one folder below it, in the root of the project.

                      – Marco Lackovic
                      Mar 9 at 18:37











                    • @MarcoLackovic have you tried running without setting the matches? The defaults seem to be fine for you.

                      – gombosg
                      Mar 11 at 1:56






                    • 1





                      Then maybe raising a GitHub issue is the way to go if it doesn't work with the defaults.

                      – gombosg
                      Mar 11 at 18:24













                    0












                    0








                    0







                    Have you tried using / as a directory separator?



                    From Jest docs:




                    See the micromatch package for details of the patterns you can specify.




                    From Micromatch docs:




                    Micromatch exclusively and explicitly reserves backslashes for escaping characters in a glob pattern, even on windows. This is consistent with bash behavior.



                    ...



                    In other words, since \ is reserved as an escape character in globs, on windows path.join('foo', '*') would result in foo\*, which tells micromatch to match * as a literal character. This is the same behavior as bash.




                    So I'd try:



                    module.exports = 
                    testMatch: [ '**/*.test.tsx' ]
                    ;





                    share|improve this answer













                    Have you tried using / as a directory separator?



                    From Jest docs:




                    See the micromatch package for details of the patterns you can specify.




                    From Micromatch docs:




                    Micromatch exclusively and explicitly reserves backslashes for escaping characters in a glob pattern, even on windows. This is consistent with bash behavior.



                    ...



                    In other words, since \ is reserved as an escape character in globs, on windows path.join('foo', '*') would result in foo\*, which tells micromatch to match * as a literal character. This is the same behavior as bash.




                    So I'd try:



                    module.exports = 
                    testMatch: [ '**/*.test.tsx' ]
                    ;






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 7 at 16:35









                    gombosggombosg

                    6414




                    6414












                    • Thanks! Yes, I have tried with / with no success. I have updated my questions with other patterns I have tried.

                      – Marco Lackovic
                      Mar 8 at 9:08











                    • From here I can't really help because I'm not on windows... is jest.config.js in the same folder as src?

                      – gombosg
                      Mar 8 at 17:42











                    • It is not in the same folder, it is one folder below it, in the root of the project.

                      – Marco Lackovic
                      Mar 9 at 18:37











                    • @MarcoLackovic have you tried running without setting the matches? The defaults seem to be fine for you.

                      – gombosg
                      Mar 11 at 1:56






                    • 1





                      Then maybe raising a GitHub issue is the way to go if it doesn't work with the defaults.

                      – gombosg
                      Mar 11 at 18:24

















                    • Thanks! Yes, I have tried with / with no success. I have updated my questions with other patterns I have tried.

                      – Marco Lackovic
                      Mar 8 at 9:08











                    • From here I can't really help because I'm not on windows... is jest.config.js in the same folder as src?

                      – gombosg
                      Mar 8 at 17:42











                    • It is not in the same folder, it is one folder below it, in the root of the project.

                      – Marco Lackovic
                      Mar 9 at 18:37











                    • @MarcoLackovic have you tried running without setting the matches? The defaults seem to be fine for you.

                      – gombosg
                      Mar 11 at 1:56






                    • 1





                      Then maybe raising a GitHub issue is the way to go if it doesn't work with the defaults.

                      – gombosg
                      Mar 11 at 18:24
















                    Thanks! Yes, I have tried with / with no success. I have updated my questions with other patterns I have tried.

                    – Marco Lackovic
                    Mar 8 at 9:08





                    Thanks! Yes, I have tried with / with no success. I have updated my questions with other patterns I have tried.

                    – Marco Lackovic
                    Mar 8 at 9:08













                    From here I can't really help because I'm not on windows... is jest.config.js in the same folder as src?

                    – gombosg
                    Mar 8 at 17:42





                    From here I can't really help because I'm not on windows... is jest.config.js in the same folder as src?

                    – gombosg
                    Mar 8 at 17:42













                    It is not in the same folder, it is one folder below it, in the root of the project.

                    – Marco Lackovic
                    Mar 9 at 18:37





                    It is not in the same folder, it is one folder below it, in the root of the project.

                    – Marco Lackovic
                    Mar 9 at 18:37













                    @MarcoLackovic have you tried running without setting the matches? The defaults seem to be fine for you.

                    – gombosg
                    Mar 11 at 1:56





                    @MarcoLackovic have you tried running without setting the matches? The defaults seem to be fine for you.

                    – gombosg
                    Mar 11 at 1:56




                    1




                    1





                    Then maybe raising a GitHub issue is the way to go if it doesn't work with the defaults.

                    – gombosg
                    Mar 11 at 18:24





                    Then maybe raising a GitHub issue is the way to go if it doesn't work with the defaults.

                    – gombosg
                    Mar 11 at 18:24

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55048197%2fno-tests-found-when-running-jest-from-command-line%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    1928 у кіно

                    Захаров Федір Захарович

                    Ель Греко