Skip to content

Instantly share code, notes, and snippets.

View simon360's full-sized avatar

Simon Andrews simon360

  • London, UK
View GitHub Profile
@simon360
simon360 / Configuring CircleCI with Jest.md
Created March 21, 2022 20:21
Configuring CircleCI with Jest and test splitting

Configuring CircleCI with Jest and test splitting

I've found plenty of documentation online for how to run Jest on CircleCI with test splitting, but none of them have solved two problems that I've run into, with a relatively basic (albeit large) React + Next.js project. And I bet others have these problems, too. Namely:

  • Jest on CircleCI won't run tests with [ or ] in the filename. (That's a particular problem when using NextJS.)
  • CircleCI won't split by timings when using Jest with jest-junit

I've found solutions for both of these problems, but it wasn't easy. I can't be the first person to encounter these problems, right?

The dream config

@simon360
simon360 / PasswordQuality.tsx
Created January 3, 2022 18:28
A simple function to check password quality, with some React components that demonstrate how it can be used.
// Only dependency is Tailwind CSS. Could swap out the class names for your own if you'd rather.
//
// Use like this:
// <PasswordQuality quality={checkPasswordQuality('my$uperSecur3Password')} />
/**
* Runs a number of quality checks against a password. Can be used to encourage the user to provide a secure password.
*
* Example return value: `{score: 0.5, "Length (12)": false, Capitals: true, Numbers: false, Symbols: true}`
*
@simon360
simon360 / check-packages.js
Created April 20, 2018 11:58
Compare different package.json files in a monorepo to see if dependency versions differ
const chalk = require("chalk");
const packages = [
require("./package.json"),
require("./packages/cec-scripts/package.json"),
require("./packages/generator-cec/package.json"),
require("./packages/utility-cec-simulator/package.json")
];
const compareDeps = p => {
@simon360
simon360 / open-as-project-in-atom.sh
Last active March 18, 2018 19:32
Open the specified files in Atom, and if any are in a git repository, open that repository in the sidebar. If it's not in a git repository, open the containing folder in the sidebar.
#!/bin/bash
# Open the specified files in Atom, and if any are in a git repository, open
# that repository in the sidebar. If it's not in a git repository, open the
# containing folder in the sidebar.
# TODO: currently, will only open the project for the first file; further files
# will be opened in the same window, even if their repository differs.
# Can load into Automator on macOS, and add it as a service to the Finder.