Since there are several answers here showing non-working code for Windows, here is a clarification: Show
This command does not work, for two reasons:
To solve this problem, we have to invoke the command line interpreter (
Now when the Java process is connected to a console, i.e. has been started from a command line without output redirection, it will clear the console. Quokka.js is a rapid prototyping playground in your editor, with access to your project’s files, inline reporting, code coverage and rich output formatting. Runtime values are updated and displayed in your IDE next to your code, as you type. Table of Contents
Quokka ‘Community’ edition is free for everyone. We also offer a commercial Quokka ‘Pro’ edition that provides a number of additional advanced features (marked with ‘Pro’ label in the docs below). Quokka.js is brought to you by the Wallaby.js team and is built on top of the same technology used in the Wallaby.js Core. If you like what you see in Quokka.js and would like the same live features for your unit tests and all files of your project, and a lot more, then definitely check out Wallaby.js. Getting started To get started with Quokka.js in VS Code, install the extension first by clicking on the Extensions icon in the Activity Bar on the side of VS Code and searching for To get started with Quokka.js in JetBrains IDE, install the plugin first by using To get started with Quokka.js in Sublime Text, install the package first by using Once the extension is installed, press Once the extension is installed, press Once the extension is installed, press Now you are ready to go, just start typing some code in your editor and see what happens next. Live Feedback You may create a new Quokka file, or start Quokka on an existing file. The results of the execution are displayed right in
the editor. To see the full execution output, you may view the Quokka Console by invoking the You may create a new Quokka file, or start Quokka on an existing file. The results of the execution are displayed right in the editor. To see the full execution output, you may view the Quokka Console by invoking the You may create a new Quokka file, or
start Quokka on an existing file by using the If you create a new Quokka scratch file and want to save it, then you may press It is recommended that you memorize a couple of Quokka keyboard shortcuts (you may see them when using the editor’s command palette). This will make working with Quokka much faster. To open a new Quokka file use Live Logging/CompareYou may use
Note that when using identifier expressions for logging (for example, typing Please also note that Boolean, Number and
Function data types are not supported when use sequence expressions to compare objects (e.g. Live Code CoverageOnce Quokka.js is running, you can see the code coverage in the gutter of your editor. The coverage is live, so you can start changing your code and the coverage will automatically be updated, just as you type. As you may see, there are various colored squares displayed for each line of your source code.
Value Explorer Value Explorer allows you to inspect
everything that is logged in Quokka with Expression paths and values can be copied using the tree node’s context menu. Note that while Value Explorer is available for both Community and Pro editions, in Community edition only 2 levels of the explorer’s tree can be expanded. Auto-Expand Value Explorer Objects Identifier Expressions and Live Comments can be provided with an additional hint to automatically expand objects when they are logged to Value Explorer.
Inserting the special comment Use this feature with small- to medium-sized objects when you want to expand all properties in Value Explorer. Having the properties expanded also helps when using the ‘Copy Data’ action on the Value Explorer tree node, because it only copies expanded properties’ data. Note that automatically expanded objects have the following limitations:
Time MachineQuokka’s Time Machine allows you to move forward and backwards through your code, jump or auto-play to a specific line of code, view runtime values and step into, over and out of your code. In addition to Quokka Community time machine features, Quokka PRO edition also allows you to edit your code without stopping the time machine and continue to explore your code’s execution path. Your browser does not support the video tag or this video format. You can download the video anyway.Once Quokka has started on a file, the time machine is available at any time. It can be started via a command or by using code lens in Quokka output.
Time machine ActionsTime machine actions are available from from the file header actions and Quokka output header code lens, as well as via keyboard shortcuts.
Inspecting Runtime Values Inspecting runtime values during time-travel sessions is quick and easy. All you need to do is select the object, object property, parameter, expression or variable that you want to view. When you do this, Quokka will display the value that you selected. If your selection is invalid (e.g. you only selected part of a variable) then no output will be displayed. For nested expressions statements
(e.g. Note that your selection must be either on the current step or a previous step for the value to be displayed. In addition to displaying selected expression values beside your code, selected expressions are also available in Quokka Value Explorer in an easy-to-navigate, real-time tree view. Nested properties can be expanded to any depth, and values/paths may be copied to the clipboard. Edit-and-continueQuokka PRO edition allows you to edit your code without stopping the time machine and continue to explore the code’s execution path. Code Story ViewerQuokka’s Code Story Viewer provides a unique and highly efficient way of inspecting what your code is doing in a single continuous view. The viewer is fully integrated with Quokka’s Time Machine, which means you can simply select a variable or expression to see its runtime value. Seeing the executed code displayed in a single continuous view really cuts down on context switching that you may experience in a traditional debugger experience while trying to understand the execution of your code. Once Quokka has started on a file, the Code Story can be launched using the Codeclip Quokka’s Once Quokka has been started on a file, your code can be shared using the Recent Files The list of all recently launched Quokka files (both physical and scratch files) can be viewed by using the
When Microsoft’s VS Code plugin for Live Share is installed alongside Quokka, Quokka provides software
developers with the ability to interactively collaborate on the same code at the same time. This feature adds a new dimension to real-time instructor-led training as well as interactive prototyping/debugging and works best when guests and host use Live Share’s How does it work? When the host and
client both have Quokka plugin installed during a Live Share collaboration, when code changes are made and Quokka is running, Quokka will execute the code changes on the host and immediately send the display values to all collaboration participants. Before sharing the Quokka session with clients, the host will be prompted to either Members of the Live Share collaboration see the same Quokka display values when they are visible to the host. If the Live Share session is configured to be read-only, only the host can edit code but collaborators will see all of the Quokka execution results. If the Live Share session is editable by other collaborators, as non-host code edits are made, Quokka will evaluate the changes on the host and send the execution results to all collaborators. Interactive Examples The Wallaby.js team curates a set of interactive
examples that may be launched from within VS Code using the While The most powerful way to log any expression is to use a special comment right after the expression you want to log. Inserting the special comment For example, will output the result of
will output the
result of the full You may also write any JavaScript code right in the comment to shape the output. The code has the access to the Note that there’s no constraints in terms of what the comment code can do. For example, the watch
comment below is incrementing Also, unlike console logging, the special comment logging has some built-in smarts. For example, when you place the comment after an expression that is a promise, the resolved value of the promise is logged. Similarly, if an expression is an observable, then its values are displayed. So you don’t need to insert a To save some time on typing the comment when you need it, you may create a code snippet with a custom keybinding. To save some time on typing the comment when you need it, you may create a live template. To save some time on typing the comment when you need it, you may create code snippets. Live Value DisplayWhile
the Live Comments feature provides an excellent way to log expression values and will keep displaying values when you change your code, sometimes you may want to display or capture expression values without modifying code. The Show ValueIf you want to quickly display some expression value, but without modifying your code, you may do it by simply selecting an expression in an editor. If you want to quickly display some expression value, but without modifying your code, you may do it by simply selecting an expression in an editor. Copy Value If you want to copy an expression value to your clipboard without modifying your code, Live Value Display allows you to do it with a special command ( If you want to copy an expression value to your clipboard without modifying your code, Live
Value Display allows you to do it with a special intention action ( Show Line Value(s) If you want to output the values of multiple lines, you may use the If you want to output the values of multiple lines, you may use the Show Line Timing(s) If you want to output the execution time of a line, you may use the If you want to output the execution time of a line, you may use the Toggle Auto Log If you want Quokka to show the runtime values for every single line of your code then you may use the This feature is useful in scenarios such as when you are live coding and have intermediate results that you want to be displayed as you type. Sticky ValuesLive Values are sticky which means that they survive your file changes while being updated as you type. You may press You may press Live Value Display feature may be adjusted to different workflows by changing Show Value on Selection and Show All Selected Values settings. Project Files ImportQuokka ‘Community’ edition allows you to import any locally installed node modules to a Quokka file. In addition to that, Quokka ‘Pro’ edition also allows to import any files from your project:
Quokka also resolves imported modules with non-relative names when using CPU ProfilerQuokka’s CPU Profiler allows you to quickly record the CPU usage profile of your code to analyze its runtime performance. To record and view the CPU profile, you may use the Before the profile is displayed, you may choose where to display it: in Quokka Chrome Dev Tools or directly in VS Code. VS Code embedded viewIf you select to open the CPU profile in VS Code, then it will be displayed with VS Code’s built-in CPU profile table extension (and optional Flame Chart extension). To record and view CPU profile, you may run the To record and view CPU profile, you may run the Quokka Chrome DevToolsIf you select to open the CPU profile in Quokka Chrome DevTools, three views for analyzing the results are provided once the DevTools app is opened. Each view gives you a different perspective on the executed functions: After recording CPU profile, Quokka Chrome DevTools will be opened and the CPU profile will be displayed with three views for analyzing the results. Each view gives you a different perspective on the activities:
You may search for a specific function, file, or other text in the DevTool views using The You may use the In all the views Quick Package InstallThis feature allows you to quickly install any node package, via You may install missing packages via
intention actions ( You may install missing packages by using the hover message, or with the By default Quokka uses the
Live Performance TestingThe feature allows to quickly see how various parts of your code perform. It can be very helpful for identifying possible bottlenecks in your app and for doing the performance optimization, or just for experimenting to see how different things perform. Inserting the special comment Adding the comment to an expression that gets executed multiple times, for example inside a loop, will make the tool to display total execution time, average execution time (total execution time divided by number of times the expression had been executed), minimum and maximum execution time. You may also use the execution time reporting comment and add to it any expression that you may use in live comments to display both an expression execution time and execution result. For example, displays Run on Save/Run OnceChoose how and when Quokka should run on your files. In addition to the community edition’s Automatic mode, you can start Quokka and only Run on Save or tell Quokka to start and just Run Once. This feature is helpful for using Quokka to run slow-running scripts, or scripts with side-effects. The Run on Save and Run Once actions are available along-side other Quokka commands, in your IDE’s list of commands. If you use these commands often, you can improve your productivity by adding key-bindings. RuntimeQuokka.js is using your system’s node.js to run your code. You also may configure Quokka to use any specific node.js version, if you are using
By default Quokka uses Browser-like RuntimeTo simulate a browser environment, Quokka supports jsdom. The ConfigurationQuokka.js does not need any configuration by default. It will run your code using your system’s node.js. It may also run your TypeScript code without any configuration. If you would like to use Babel/React JSX or override your If you are using VS Code, you can override our editor display settings with VS Code User Setting overrides. You can view the overridable settings in the VS Code Settings editor under Settings -> Extensions -> Quokka. You may override the coverage indicator colors in VS Code’s user settings (
If you are using VS Code, you may change your Quokka console output to If you are using VS
Code, you may configure Quokka to automatically start on a file if it was running when the file was last closed by updating your VS Code setting If you are using VS Code, you may configure Quokka to start automatically if your file matches a regular expression by updating your VS Code setting If you are using VS Code, then by default, your license and settings will automatically be synchronized between VS Code remoting instances, and between other machines when PluginsQuokka.js provides a plugin model that may be configured by using the Monorepos / Nested packagesQuokka supports running from root-level monorepos and projects with nested packages. If you start Quokka on an existing file within a nested package, then Quokka will automatically run in the context of
the nested package. In this case, the ExamplesBecause Quokka.js runs your code using
Questions and issuesIf you find an issue, please report it in our support repository. |