MoT foundation certificate - Jest error?

I’m following the excellent foundation certificate in test automation.
I have hit upon an error on installing the items requested in the course documentation a Jest error that “No files found in /Users/agoodall/Personalproj/mot-cert-support-app-js.” occurs.
I have checked the config and the pattern matches where the tests should exist. Bit stumped.

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
No files found in /Users/agoodall/Personalproj/mot-cert-support-app-js.
Make sure Jest's configuration does not exclude this directory.
To set up Jest, make sure a package.json file exists.
Jest Documentation: https://jestjs.io/docs/configuration
Files: "/Users/agoodall/Personalproj/mot-cert-support-app-js/test/specs/test.e2e.js"

Process finished with exit code 1

jest exists in the package.json

    "jest": "^29.7.0",
    "jest-junit": "^16.0.0",

config looks ok

    //
    specs: [
        './test/specs/**/*.js'
    ],
    // Patterns to exclude.
    exclude: [
        // 'path/to/excluded/files'
    ],

Any ideas as to what I can try would be awesome please.
Many thanks.

4 Likes

I’m not an expert in this at all but was wondering and from what I googled it seems that your config isn’t ok, as I understood, it should be like

module.exports = {
  testMatch: [
    "**/test/specs/**/*.js"
  ],
};

probably you’ve checked the official docs, right? Configuring Jest · Jest
Maybe you can find something relevant here:
How to disable ts-jest process my .js files · Issue #1102 · kulshekhar/ts-jest · GitHub
javascript - Jest running tests by specific path - Stack Overflow
sorry if it wasn’t helpful, hope someone with better expertise in Jest will provide more useful info and answers

1 Like

I changed the config to match your suggestion and unfortunately the same error is returned.

Will have a dig through and see if there’s anything may point the way.

1 Like

Just in case you haven’t tried, try to ask ChatGPT :sweat_smile: it helps me many times with my programming and automation. Unfortunately, I can’t help you with this because I don’t have any experience with using Jest.
Good luck with finding the solutions for this error :slight_smile:

I’ve been plugged into chatGPT hunting for the solution. Many thanks for your help,

1 Like

Finally got it to work! I’m still figuring out exactly what I did , so I’m aware for next time.

4 Likes

Great to hear that :slight_smile: If you figure it out share the problem and the solution so it might be useful for others in the future :wink:

2 Likes

That’s one advantage of putting all your work into a git repo - easy to follow up changes.

Once I got it working it all got pushed my personal repo. :slight_smile:

I recommend to do it right from the beginning.
Create the directory, init a repo, start working and commit early & often.

3 Likes

And fail often through this process. Yes.

Off-topic:
My problem with my repos was that I used to have an inner conflict and did not want to show public what beginner git errors or coding errors I might have done, so after I got it working, I deleted the repo to erase the history.

Now I look different to it and would explain it as a good learning skill :wink: