github unkn0wn-root/resterm v0.21.3

latest releases: v0.39.4, v0.39.3, v0.39.2...
3 months ago

What's New

Two small quality-of-life improvements that make scripting a bit easier and test feedback more intuitive.

Script blocks with {% ... %}

You now have a second way to write inline scripts. Alongside the existing > line prefix, I've added {% %} script blocks that let you write your script body without marking each line individually. Some people prefer the explicit > on every line because it makes script boundaries obvious in the file, while others would rather drop into a block and write freely, so now you can pick whichever style feels more natural for the way you work.

Before:

# @script test
> client.test("status ok", function () {
>   tests.assert(response.statusCode === 200, "expected 200");
>   tests.assert(response.json().id !== undefined, "missing id");
> });

New:

# @script test
> {%
  client.test("status ok", function () {
    tests.assert(response.statusCode === 200, "expected 200");
    tests.assert(response.json().id !== undefined, "missing id");
  });
%}

Both styles continue to work, so existing files won't need any changes. You can also mix them freely - for example, keep file includes as standalone > < ./helpers.js lines and use {% %} for your inline logic right next to them.

Example:

# @script test
> < ./scripts/helpers.js
> {%
client.test("status ok", function () {
  tests.assert(response.statusCode === 200, "expected 200");
});
%}

Other small changes

  • The Tests segment in the header bar now shows a status-aware icon: A ✔ appears when all tests pass, a ✗ shows up when there are failures, and a ⚠ signals a script error.

Don't miss a new resterm release

NewReleases is sending notifications on new releases.