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. Show
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 startedTo 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 0 to display the editor’s command palette, and then type Quokka to see the list of the available commands. Select and run the 2 command.Once the extension is installed, press 3 to create a new Quokka file. You may select any JavaScript, ECMAScript 6, or TypeScript file type.Once the extension is installed, press 0 to display the editor’s command palette, and then type Quokka to see the list of the available commands. Select and run the 2 command.Now you are ready to go, just start typing some code in your editor and see what happens next. Live FeedbackYou 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 7 command or clicking the bottom-right status bar indicator.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 7 command or clicking the bottom-left output panel icon.You may create a new Quokka file, or start Quokka on an existing file by using the 9 context menu action in any opened file editor (you may also assign some shortcut to the action). The results of the execution are displayed right in the editor. To see the full execution output, you may view the Quokka Console by clicking the bottom-right status bar indicator.If you create a new Quokka scratch file and want to save it, then you may press 0 to do so. Later on, you may open the file and run Quokka using the 9 context menu action in the opened file editor.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 2 for JavaScript, or 3 for TypeScript. To start/restart Quokka on an existing file, use 4.Live Logging/CompareYou may use 5 or identifier expressions (i.e. just typing a variable name) to log any values.You may also use sequence expressions to compare objects: Note that when using identifier expressions for logging (for example, typing 6 to see the value of the 6 variable), you may hit some limits in terms of the number of displayed properties and the logged object traversal depth. In this case, you may use 8 to display objects without the limitations.Please also note that Boolean, Number and Function data types are not supported when use sequence expressions to compare objects (e.g. 9).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 ExplorerValue Explorer allows you to inspect everything that is logged in Quokka with 5, identifier expressions, . Results are displayed in an easy-to-navigate tree view that is updated in realtime as you write your code. 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 ObjectsIdentifier 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 2 after any expression will expand your object and its properties within the Value Explorer tree.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. 3 ( 4) command/code lens starts the time machine and pauses code execution on the currently active line (or on the first executed line of the program if the current line is never executed). 5 ( 6) command/code lens starts the time machine on the currently active line (or on the first executed line of the program if the current line is never executed) and automatically proceeds to the next executed code region after a short delay (configurable via 7 setting in VS Code).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 ValuesInspecting 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. 9), you do not need to select the entire expression (selecting only Quokka 0 will output Quokka 1).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 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 CodeclipQuokka’s Once Quokka has been started on a file, your code can be shared using the Recent FilesThe list of all recently launched Quokka files (both physical and scratch files) can be viewed by using the
VS Code Live Share IntegrationWhen 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 ExamplesThe Wallaby.js team curates a set of interactive examples that may be launched from within VS Code using the Live CommentsWhile 5 may do a great job for displaying values, sometimes you may need to see the value right in the middle of an expression. For example, given a chain of Settings - Plugins 5, you may want to inspect the result of Settings - Plugins 6 before Settings - Plugins 7 is called.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 Live comment snippetTo save some time on typing the comment when you need it, you may 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 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 1, Package Control: Install Package 0, and Package Control: Install Package 1 features allow you to do exactly that.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 ValueIf 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 1 for the selected line(s) as if you had selected the entire line to display.If you want to output the values of multiple lines, you may use the 1 for the selected line(s) as if you had selected the entire line to display.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 LogIf 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 02 and 03 intention actions available.Live Value Display feature may be adjusted to different workflows by changing and 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 04 and 05 files that specify 06 and/or 07 settings. CPU ProfilerQuokka’s CPU Profiler allows you to quickly record the of your code to analyze its runtime performance. To record and view the CPU profile, you may use the 08 button, or run the 09 command.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 ). You may use the 16 tab to view which functions cause the most work, or the 17 tab to view which functions directly took up the most time in aggregate.In all the views 18 represents the time directly spent in that function. 19 represents the time spent in that function or any of its children. You may click 18, 19, or 22 to sort the table by that column.Quick Package InstallThis feature allows you to quickly install any node package, via 23 or 24, without switching away from your editor, and without even having to type the package name (there is enough information in your code already). The package may be installed just for the active Quokka session, so that when you are just playing with things, your 25 folder is not trashed. Having said that, you may also target the project’s 25, if you want to do it. You may install missing packages via intention actions ( You may install missing packages by using the hover message, or with the 28 keyboard shortcut (whenever there’s a missing package), via command palette ( 29 commands), or via the links in the Quokka output. By default Quokka uses the 30 command. You may change it to 31 by setting the 32 value in your Quokka config:
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 33 after any expression will report how much time it took to execute the expression. 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 34 execution time and result.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. RuntimeBy default, Quokka.js uses your system’s node.js to run your code. You also may configure Quokka to use , if you are using 35 for example.Quokka uses 36 module for JavaScript files, allowing ES imports and top level await to be used with zero configuration.Browser-like RuntimeTo simulate a browser environment, Quokka supports jsdom. The 37 package must be installed and available from your project as well adding as .Vite-node RuntimeFor projects using Vite, Quokka uses 38 to run your JavaScript/TypeScript code in node.js using Vite’s resolvers and transformers. To use Quokka with 38, The 38 package must be installed in your project; Quokka will automatically detect and use 38 once it is installed.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 04 settings, then you may configure Quokka.js.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 ( 43 file). The snippet below shows the config with Quokka’s default colors.
If you are using VS Code, you may change your Quokka console output to 44 mode by updating your VS Code setting 45 to 46.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 47 to 46. Please note that this setting is ignored if your file is opened using Run on Save or Run Once.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 49. For example, to have Quokka start automatically on all files that end with 50, you would update the setting to 51.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 52 is enabled. This can be disabled by setting the VS Code setting 53 to 54.PluginsQuokka.js provides a plugin model that may be configured by using . Quokka’s plugin model allows you to specify a file or a node module with code to execute at various stages of Quokka.js’ code execution pipeline. You may find more information about how to write a Quokka plugin in the Extensibility docs section. 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 56 directory will be the nested package directory containing the 57 file for the existing file.ExamplesBecause Quokka.js runs your code using 58, sometimes a little more configuration may be required to match your project’s runtime configuration. If the examples below aren’t relevant for your project, search our support repository for an existing configuration. |