Jest No Tests found












12















running docker mhart/alpine-node:8 on macOS with




nodejs (6.10.3-r0) (18/18)
yarn 0.24.6
jest 20.0.4




I have a __tests__/index.test.js file however, when running the code



node_modules/.bin/jest --watchAll I get the below output




No tests found

In /usr/src/app

5 files checked.

testMatch: /__tests__//*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match

testPathIgnorePatterns: /node_modules/,/src,src - 0 matches

Pattern: "" - 0 matches




I've re-installed the package numbers times but to no avail.










share|improve this question





























    12















    running docker mhart/alpine-node:8 on macOS with




    nodejs (6.10.3-r0) (18/18)
    yarn 0.24.6
    jest 20.0.4




    I have a __tests__/index.test.js file however, when running the code



    node_modules/.bin/jest --watchAll I get the below output




    No tests found

    In /usr/src/app

    5 files checked.

    testMatch: /__tests__//*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match

    testPathIgnorePatterns: /node_modules/,/src,src - 0 matches

    Pattern: "" - 0 matches




    I've re-installed the package numbers times but to no avail.










    share|improve this question



























      12












      12








      12


      3






      running docker mhart/alpine-node:8 on macOS with




      nodejs (6.10.3-r0) (18/18)
      yarn 0.24.6
      jest 20.0.4




      I have a __tests__/index.test.js file however, when running the code



      node_modules/.bin/jest --watchAll I get the below output




      No tests found

      In /usr/src/app

      5 files checked.

      testMatch: /__tests__//*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match

      testPathIgnorePatterns: /node_modules/,/src,src - 0 matches

      Pattern: "" - 0 matches




      I've re-installed the package numbers times but to no avail.










      share|improve this question
















      running docker mhart/alpine-node:8 on macOS with




      nodejs (6.10.3-r0) (18/18)
      yarn 0.24.6
      jest 20.0.4




      I have a __tests__/index.test.js file however, when running the code



      node_modules/.bin/jest --watchAll I get the below output




      No tests found

      In /usr/src/app

      5 files checked.

      testMatch: /__tests__//*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match

      testPathIgnorePatterns: /node_modules/,/src,src - 0 matches

      Pattern: "" - 0 matches




      I've re-installed the package numbers times but to no avail.







      javascript node.js unit-testing jestjs






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 6 '18 at 23:56









      Serhii Matrunchyk

      95511834




      95511834










      asked Jun 24 '17 at 23:11









      KendallKendall

      1,46862546




      1,46862546
























          5 Answers
          5






          active

          oldest

          votes


















          7














          Your output says that testMatch had 1 match, which may be your __tests__/index.test.js file. It seems that your testPathIgnorePatterns is causing that test suite to be ignored. No tests found In /usr/src/app says that Jest is looking for tests in /usr/src/app, and testPathIgnorePatterns: /node_modules/,/src,src says that Jest is ignoring files in /src directories.



          Either point Jest to look at the location of your __tests__/index.test.js file if it is outside the /src directory, or stop testPathIgnorePatterns from ignoring the /src directory.






          share|improve this answer































            3














            If you want to run all the tests inside the tests folder you can simply do the following
            jest __tests__ --watch






            share|improve this answer































              1














              I had this error while attempting to run tests in a submodule of a project. Fixed the issue by testing the submodule in isolation, in a separate folder tree from the main project.






              share|improve this answer































                1














                You can try running jest without any parameters. A key thing to note is the test file names have to follow the convention *.test.js.






                share|improve this answer































                  1














                  If you have file structure such as the following



                  myFolder
                  │ myFile1.js
                  │ myFile2.js
                  │ ...

                  └───__tests__
                  myFile1.spec.js
                  myFile2.spec.js
                  ...


                  then you need to have in jest.config.js the following pattern for testMatch property:



                  testMatch: ['**/__tests__/*.js?(x)'],


                  The simple example of jest.config.js:



                  const jestConfig = {
                  verbose: true,
                  testURL: "http://localhost/",
                  'transform': {
                  '^.+\.jsx?$': 'babel-jest',
                  },
                  testMatch: ['**/__tests__/*.js?(x)'],
                  }

                  module.exports = jestConfig





                  share|improve this answer























                    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%2f44741766%2fjest-no-tests-found%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown

























                    5 Answers
                    5






                    active

                    oldest

                    votes








                    5 Answers
                    5






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    7














                    Your output says that testMatch had 1 match, which may be your __tests__/index.test.js file. It seems that your testPathIgnorePatterns is causing that test suite to be ignored. No tests found In /usr/src/app says that Jest is looking for tests in /usr/src/app, and testPathIgnorePatterns: /node_modules/,/src,src says that Jest is ignoring files in /src directories.



                    Either point Jest to look at the location of your __tests__/index.test.js file if it is outside the /src directory, or stop testPathIgnorePatterns from ignoring the /src directory.






                    share|improve this answer




























                      7














                      Your output says that testMatch had 1 match, which may be your __tests__/index.test.js file. It seems that your testPathIgnorePatterns is causing that test suite to be ignored. No tests found In /usr/src/app says that Jest is looking for tests in /usr/src/app, and testPathIgnorePatterns: /node_modules/,/src,src says that Jest is ignoring files in /src directories.



                      Either point Jest to look at the location of your __tests__/index.test.js file if it is outside the /src directory, or stop testPathIgnorePatterns from ignoring the /src directory.






                      share|improve this answer


























                        7












                        7








                        7







                        Your output says that testMatch had 1 match, which may be your __tests__/index.test.js file. It seems that your testPathIgnorePatterns is causing that test suite to be ignored. No tests found In /usr/src/app says that Jest is looking for tests in /usr/src/app, and testPathIgnorePatterns: /node_modules/,/src,src says that Jest is ignoring files in /src directories.



                        Either point Jest to look at the location of your __tests__/index.test.js file if it is outside the /src directory, or stop testPathIgnorePatterns from ignoring the /src directory.






                        share|improve this answer













                        Your output says that testMatch had 1 match, which may be your __tests__/index.test.js file. It seems that your testPathIgnorePatterns is causing that test suite to be ignored. No tests found In /usr/src/app says that Jest is looking for tests in /usr/src/app, and testPathIgnorePatterns: /node_modules/,/src,src says that Jest is ignoring files in /src directories.



                        Either point Jest to look at the location of your __tests__/index.test.js file if it is outside the /src directory, or stop testPathIgnorePatterns from ignoring the /src directory.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Aug 13 '17 at 14:04









                        Zachary Ryan SmithZachary Ryan Smith

                        1,14911120




                        1,14911120

























                            3














                            If you want to run all the tests inside the tests folder you can simply do the following
                            jest __tests__ --watch






                            share|improve this answer




























                              3














                              If you want to run all the tests inside the tests folder you can simply do the following
                              jest __tests__ --watch






                              share|improve this answer


























                                3












                                3








                                3







                                If you want to run all the tests inside the tests folder you can simply do the following
                                jest __tests__ --watch






                                share|improve this answer













                                If you want to run all the tests inside the tests folder you can simply do the following
                                jest __tests__ --watch







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Nov 28 '17 at 17:55









                                Abu KhadijaAbu Khadija

                                364




                                364























                                    1














                                    I had this error while attempting to run tests in a submodule of a project. Fixed the issue by testing the submodule in isolation, in a separate folder tree from the main project.






                                    share|improve this answer




























                                      1














                                      I had this error while attempting to run tests in a submodule of a project. Fixed the issue by testing the submodule in isolation, in a separate folder tree from the main project.






                                      share|improve this answer


























                                        1












                                        1








                                        1







                                        I had this error while attempting to run tests in a submodule of a project. Fixed the issue by testing the submodule in isolation, in a separate folder tree from the main project.






                                        share|improve this answer













                                        I had this error while attempting to run tests in a submodule of a project. Fixed the issue by testing the submodule in isolation, in a separate folder tree from the main project.







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Aug 14 '18 at 10:02









                                        mikehmikeh

                                        626618




                                        626618























                                            1














                                            You can try running jest without any parameters. A key thing to note is the test file names have to follow the convention *.test.js.






                                            share|improve this answer




























                                              1














                                              You can try running jest without any parameters. A key thing to note is the test file names have to follow the convention *.test.js.






                                              share|improve this answer


























                                                1












                                                1








                                                1







                                                You can try running jest without any parameters. A key thing to note is the test file names have to follow the convention *.test.js.






                                                share|improve this answer













                                                You can try running jest without any parameters. A key thing to note is the test file names have to follow the convention *.test.js.







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Nov 25 '18 at 0:38









                                                KaruhangaKaruhanga

                                                4171415




                                                4171415























                                                    1














                                                    If you have file structure such as the following



                                                    myFolder
                                                    │ myFile1.js
                                                    │ myFile2.js
                                                    │ ...

                                                    └───__tests__
                                                    myFile1.spec.js
                                                    myFile2.spec.js
                                                    ...


                                                    then you need to have in jest.config.js the following pattern for testMatch property:



                                                    testMatch: ['**/__tests__/*.js?(x)'],


                                                    The simple example of jest.config.js:



                                                    const jestConfig = {
                                                    verbose: true,
                                                    testURL: "http://localhost/",
                                                    'transform': {
                                                    '^.+\.jsx?$': 'babel-jest',
                                                    },
                                                    testMatch: ['**/__tests__/*.js?(x)'],
                                                    }

                                                    module.exports = jestConfig





                                                    share|improve this answer




























                                                      1














                                                      If you have file structure such as the following



                                                      myFolder
                                                      │ myFile1.js
                                                      │ myFile2.js
                                                      │ ...

                                                      └───__tests__
                                                      myFile1.spec.js
                                                      myFile2.spec.js
                                                      ...


                                                      then you need to have in jest.config.js the following pattern for testMatch property:



                                                      testMatch: ['**/__tests__/*.js?(x)'],


                                                      The simple example of jest.config.js:



                                                      const jestConfig = {
                                                      verbose: true,
                                                      testURL: "http://localhost/",
                                                      'transform': {
                                                      '^.+\.jsx?$': 'babel-jest',
                                                      },
                                                      testMatch: ['**/__tests__/*.js?(x)'],
                                                      }

                                                      module.exports = jestConfig





                                                      share|improve this answer


























                                                        1












                                                        1








                                                        1







                                                        If you have file structure such as the following



                                                        myFolder
                                                        │ myFile1.js
                                                        │ myFile2.js
                                                        │ ...

                                                        └───__tests__
                                                        myFile1.spec.js
                                                        myFile2.spec.js
                                                        ...


                                                        then you need to have in jest.config.js the following pattern for testMatch property:



                                                        testMatch: ['**/__tests__/*.js?(x)'],


                                                        The simple example of jest.config.js:



                                                        const jestConfig = {
                                                        verbose: true,
                                                        testURL: "http://localhost/",
                                                        'transform': {
                                                        '^.+\.jsx?$': 'babel-jest',
                                                        },
                                                        testMatch: ['**/__tests__/*.js?(x)'],
                                                        }

                                                        module.exports = jestConfig





                                                        share|improve this answer













                                                        If you have file structure such as the following



                                                        myFolder
                                                        │ myFile1.js
                                                        │ myFile2.js
                                                        │ ...

                                                        └───__tests__
                                                        myFile1.spec.js
                                                        myFile2.spec.js
                                                        ...


                                                        then you need to have in jest.config.js the following pattern for testMatch property:



                                                        testMatch: ['**/__tests__/*.js?(x)'],


                                                        The simple example of jest.config.js:



                                                        const jestConfig = {
                                                        verbose: true,
                                                        testURL: "http://localhost/",
                                                        'transform': {
                                                        '^.+\.jsx?$': 'babel-jest',
                                                        },
                                                        testMatch: ['**/__tests__/*.js?(x)'],
                                                        }

                                                        module.exports = jestConfig






                                                        share|improve this answer












                                                        share|improve this answer



                                                        share|improve this answer










                                                        answered Jan 19 at 4:36









                                                        RomanRoman

                                                        3,0171930




                                                        3,0171930






























                                                            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%2f44741766%2fjest-no-tests-found%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

                                                            Costa Masnaga

                                                            Fotorealismo

                                                            Sidney Franklin