blog.iankulin.com

Tools

Node.js built in test runner

A look at Node’s built-in test runner from my perspective as a long-time Mocha and Chai user, showing how to write and run basic tests with node:test and node:assert. Coming from Mocha requires few changes, though test files need to live in a test directory to be picked up. I weigh the convenience of a bundled runner against lock-in to a particular runtime...

Testing Node.js apps - Mocha, Chai, and Supertest

I walk through testing a Node/Express API with mocha, chai, and supertest, using a simple maths-endpoint app as the example. I cover installing the tools as dev dependencies, exporting the app so tests can control it, writing test suites and cases, running tests via an npm script, and the role each tool plays. I had been using Bruno for lightweight endpoint checks and found the full setup trivial to configure...

Bruno asserts

After ChatGPT flagged that mdserver might allow path traversal attacks, I used Bruno, an under-development Postman/Insomnia alternative, to check whether Express was sanitizing URLs properly. ChatGPT generated pass and fail URL examples, I wrote asserts for each in Bruno, and the whole collection can be run at once. A side benefit is that requests are stored as version-controllable text committed alongside the rest of the code...

We need to talk about Bruno

After Insomnia forced account creation and my saved API requests disappeared, I switched to Bruno, a free and open-source API client available for Mac, Windows, and Linux, plus a CLI and VS Code plugins. Bruno stores request collections as human-readable text files, making them easy to commit to source control alongside code. The writeup includes my first impressions after an afternoon of use...

Hide 'Problems' for a file in VS Code

How I silence linter warnings that VS Code raises for the minified pico.min.css file from the Pico CSS library: I exclude the file with a files.exclude entry in .vscode/settings.json, which stops it appearing in the file view and being processed by extensions. I also cover committing workspace settings to the repository and leaving a note in .gitignore so the hidden file isn’t confusing later...

CodePen

An overview of how I use CodePen as a scratchpad for small front-end experiments, finding it quicker than setting up scratch files in a separate VS Code instance. I cover the free and paid tiers, and mention that pens can be embedded in WordPress blog posts...

Digital Color Meter

My quick guide to two small MacOS tips: the built-in Digital Color Meter app shows the RGB values of whatever is under the cursor (useful when matching colours, as with the iOS calculator buttons), and screenshots can include the cursor by enabling it in the Shift-Command-5 options...

Lost in Translation

JavaScript is much more consistent across browsers now that Internet Explorer is largely unsupported, but tools for dealing with older browsers still exist. In the post, I cover approaches like libraries, polyfills, and transpilation with Babel, showing examples of arrow functions and backtick templates converted into IE 6-compatible code using Babel’s interactive web tool...

CodePen.io

After seeing examples from a web development course, I try CodePen.io, an online editor for HTML, CSS and JavaScript with a live preview. I note its support for preprocessors, some quirks around document-level HTML, and its limits compared to a full IDE, and share a link to my first example pen...

Running Javascript in VS Code

I share a quick tip on running JavaScript in VS Code: install Node.js, and the editor will offer it as the runtime the first time you execute a JS file. I also note that the Live Server dev server is accessible to other devices on my network via my machine’s IP address, which is handy for previewing layouts on phones...

Who is Emmet?

Emmet is a Visual Studio Code feature that expands short abbreviations into full HTML, using CSS selector syntax. I describe how I discovered it and demonstrate the basics: creating elements with classes and ids, nesting child elements, inserting text, and repeating items such as list entries...

ChatGPT's code writing

I ask ChatGPT to write a SwiftUI todo app with items that reoccur after a set number of days, sharing the generated code and the fixes needed to make it run, such as replacing a non-existent date formatter and adding a NavigationView. Iterating toward a more complex app, including CoreData persistence, required progressively more manual correction from me. My brief closing thoughts cover what ChatGPT might mean for developers and internet content...

Copying a file via SSH

I copy a sample JSON file from my Mac to a Raspberry Pi on the home network using the scp command, after noting that drag-and-drop into an SSH session isn’t possible. I include the basic command syntax with a brief explanation of its arguments...

Mock Data

Needing mock student data for an iOS app without using real records, I try Mockaroo, a web-based test data generator with configurable field types and download options including JSON and a REST API. My writeup ends with a privacy caution that schemas saved on the service are publicly visible...

iOS 16 Developer Mode

After updating my iPhone to iOS 16, I found my app would no longer run until Developer Mode was enabled. I briefly cover where to find the setting (in Privacy and Security) and note that it requires a reboot and re-authentication...

SwiftLint

Prompted by a video on effective developer habits, I finally add a linter to my Swift workflow. I cover installing SwiftLint and hooking it into Xcode builds, adjusting rules via a swiftlint.yml config file, and selectively disabling rules with code comments. My approach is to enable all optional rules up front, then decide for each violation whether to change the code or drop the rule...

Testing, testing

A walkthrough of adding unit tests to an existing Swift project in Xcode, using my CodeTrimmer macOS utility as the example. I cover adding a unit testing target, writing XCTest functions for the stripSpaces() method, and running the tests to see the results...

How to upgrade XCode and Swift

A short note on updating to Xcode 14 and Swift 5.7: the update is found in the Mac App Store rather than Xcode’s About dialog. I also show how to check your current Xcode and Swift versions, both through Xcode’s project settings and via the command line, and link elsewhere for details on what’s new in each release...

Visual Studio Code

A short review of Visual Studio Code after trying it for HTML/CSS and C++ work on a Mac. I found the experience smooth across the board, praising the painless extension setup, code completion, debugging with breakpoints, and git integration, though Xcode remains my IDE of choice...

Oh My Zsh

While working through the Missing Semester material, I wanted my zsh prompt to display the current git branch name. A bit of searching led me to install Oh My Zsh and enable its git and macos plugins to accomplish it...