Frequently Asked Questions

What does the pony indicate?

The Ponicode logo in the VS Code gutter is always on the same line as a function declaration. It indicates that Ponicode can help you generate tests for that function. You can open the Ponicode interface by right clicking the function and selecting "Ponicode: Unit Test"

Useful links: Open the Ponicode interface, Testable functions

Why can't I see a pony near my function?

There could be several reasons to that. First make sure that you are using VS Code version 1.37.1 or above, that the Ponicode extension is up to date and keep in mind that exclusively support Javascript for now. If all those conditions are met, you might want to check out our "Testable Fucntions" section amongst our useful links below.

Useful links: Testable functions

Which functions can Ponicode unit test?

To start with, Ponicode for now exclusively supports Javascript. In order for a function to be testable, it has to: be reachable from the global scope, be awaited if asynchronous (we do not yet support the "then" format). Class methods are testable with the exceptions of static methods, getters, setters and constructors. You can find more details in our dedicated section "Testable Functions" (see link below).

Useful links: Testable functions

How does the Unit Tests section work?

The Unit Tests sections is your way to interact with your test file. You populate the section by manually adding test cases or by adding them from the Suggestions or History sections. Every change made to this section is reflected in real time in the test file and vice versa.

Note that when you open the Ponicode interface for a file named "FILE_NAME.js", Ponicode will look for a test file named "FILE_NAME.test.js" in the same directory. If it exists, the Unit Tests section will be populated with the found tests, otherwise the file is created.

Useful links: The Ponicode interface: Unit Tests, How to: create a unit test manually, How to: generate a unit test from a suggestion

What is the Suggestions section?

The Suggestions section is where you can interact with Ponicode's AI generated test cases. This section is populated when you open the interface for the first time and will be updated as you interact with the interface.

Useful links: The Ponicode interface: Suggestions

What is the History section?

When you run your application, Ponicode can catch the function calls and the transiting values to generate test cases. The History section is where you can find them.

Check out the link below to learn how to setup your project to use this functionality.

Useful links: The Ponicode interface: History

What happens when I click on the bolt icon?

Clicking on the bolt icon will populate/modify the values within the expectations column of the test case row in order to make the test pass.

Useful links: The bolt symbol

What is 'watch mode' and how does it work?

Watch mode can be toggled to run test cases as soon as they are created. You can then see within the tests you create wether they pass or fail.

It will also trigger the bolt button on the test cases as they appear in the Suggestions section.

Useful links: Watch mode, The Ponicode interface: Suggestions, The bolt symbol

How do I modify the expectations of my test?

There are two ways to modify the expecations of a test.

You can do it manually by simply double clicking the value you want to modify. This will open a text-box where you can freely modify the value.

You can use the bolt button. By clicking on it, Ponicode will automatically populate/modify the expectation columns in order for the test to pass.

Useful links: How to: generate a unit test manually, The bolt symbol

What is the History section?

When you run your application, Ponicode can catch the function calls and the transiting values to generate test cases. The History section is where you can find them.

Check out the link below to learn how to setup your project to use this functionality.

Useful links: The Ponicode interface: History

What happens when I click on the bolt icon?

Clicking on the bolt icon will populate/modify the values within the expectations column of the test case row in order to make the test pass.

Useful links: The bolt symbol

What is 'watch mode' and how does it work?

Watch mode can be toggled to run test cases as soon as they are created. You can then see within the tests you create wether they pass or fail.

It will also trigger the bolt button on the test cases as they appear in the Suggestions section.

Useful links: Watch mode, The Ponicode interface: Suggestions, The bolt symbol

How do I modify the expectations of my test?

There are two ways to modify the expecations of a test.

You can do it manually by simply double clicking the value you want to modify. This will open a text-box where you can freely modify the value.

You can use the bolt button. By clicking on it, Ponicode will automatically populate/modify the expectation columns in order for the test to pass.

Useful links: How to: generate a unit test manually, The bolt symbol

How can I mock a variable or function?

You first need to open the Ponicode interface for the function you want to test. To do so, open a .js file in VS Code and right click the function you want to test. Select: "Ponicode: Unit Test".

Now that the Ponicode interface is open go back to the .js file. Right click the function/variable you want to mock and this time select "Ponicode: Mock". Check out the links below for some more detailed instructions and examples.

Useful links: Mocking, How to: mock a function or a global

Can I test getters and setters?

No, we do not supports getters and setters as of now. We are working on this feature, and we will keep our users informed as soon as it will be implemented.

Useful links: Testable functions

Can I modify the tests generated by Ponicode?

Yes. Simply click on the values you wish to modify within the Ponicode interface to open edit mode. You can also add and remove input and expectation columns as a whole.

Useful links: The Ponicode interface, Adding/removing: the expectation columns

Can Ponicode help me test Redux functions?

We currently support Reducers in Redux and are working on implementing support of actions. We will let users know through our community slack once the feature is out.

Useful links: Languages, Ponicode Community Slack

Can Ponicode help me test React components?

No, we do not yet support React components. It has been requested by several Beta testers and we will let users know through our community slack once they will be able to unit test React components with Ponicode.

Useful links: Languages, Ponicode Community Slack

Can I use Ponicode on a Typescript project?

No. But we are aware that a lot of you are waiting for Typescript and have started working on supporting it. We will let our users know as soon as they can start using Ponicode on Typescript files. You can join our commuunity slack to be informed.

Useful links: Ponicode Community Slack, Languages

Why do I need an internet connection to use Ponicode?

Our AI runs on our servers. Therefore in order to give you AI based suggestions, you need an internet connection.

How can I send you feedback or request a feature?

You can use the Feedback button within the Ponicode interface. It is on action bar at the top of the interface. Alternatively, you can join our community slack and drop us a line there.

Useful links: Ponicode Community Slack, The Ponicode interface

I use VS Codium, how can I update/install Ponicode?

VSCodium uses the open-vsx marketplace. We are not present on open-vsx because we are not open source but we are compatible with VS Codium.

In order to download the latest version of Ponicode you need to first download the extension in its vsix format. Follow this link and click on "Download Extension" to do so.

Once the .vsix file is downloaded, go to VS Codium, select the extensions tab on the activity bar, click on "...", choose "Install from VSIX..." and select the downloaded .vsix file.

VS-Codium-installation


Why does Ponicode suggest installing Rewire?

Ponicode uses rewire to access and test the functions that are not exported in your code.

Why do I get an "Internal error while running test cases" when I try to run a test with Ponicode?

Ponicode works with Jest. If Jest is configured correctly in the project, this error should not happen. If it does, please feel free to contact us so we can address the problem.

The first thing we recommend doing if you encounter this error, is ensure that your project has a 'package.json' file.

The next step is verifying that the command 'jest myfile.test.js' works from the command line (or in the case of a React project created with create-react-app, "npm run test myfile.test.js"). If it does, then there is a problem with Ponicode and we would be very grateful if you could contact us at ping@ponicode.com, through the chat on the bottom right corner of this page or with a message on the Ponicode Slack community.

If "jest myfile.test.js" (or equivalent) does not work, you might want to check if you have a loader problem (for example if you're using JSX, React, ECMA script), or if your jest configuration is invalid.

Please mind that if you're working on a React project built with create-react-app, you will need specific configuration added to your package.json. You can find an example in the package.json of our demo project.

Ready to write beautiful code?

Smart and simple docstring generation. Now available in your favorite code hosting platform.

Try it now