Skip to content

Instantly share code, notes, and snippets.

const fs = require("fs");
const path = require("path");
function findInDir(dir, filter, fileList = []) {
const files = fs.readdirSync(dir);
files.forEach((file) => {
const filePath = path.join(dir, file);
const fileStat = fs.lstatSync(filePath);
@ajs139
ajs139 / machine.js
Created April 3, 2020 14:39
Generated by XState Viz: https://xstate.js.org/viz
const states = {
idle: {
on: {
START: 'started',
},
},
started: {
entry: ['start'],
on: { CLOSE: 'closed', COMPLETE: 'completed', PAUSE: 'paused' },
exit: [assign({ started: true })],
require('expect-puppeteer');
const isCI = require('is-ci');
const path = require('path');
const { mkdirp, writeFile } = require('fs-extra');
const screenshotsPath = path.resolve(__dirname, '../reports/screenshots');
const toFilename = s => s.replace(/[^a-z0-9.-]+/gi, '_');
export const extract = (text: string): Object => {
const re = /\{+\s*(.*?)\s*\}+/g;
const tags: any[] = [];
let matches;
while (Boolean((matches = re.exec(text)))) {
if (matches) {
tags.push(matches[1]);
}
}
const root: any = {};