Remove lodash deps (#13057)

* inline escapeRegExp instead of using any dep

* inline camelCase

* replace merge with object spread

* copy if array instead of using clone

* inline isRegExp

* review fixes!

* remove escape-string-regexp from package.json and in test

* add error for field defaults that are not primitives or empty arrays

* replace merge with object spread

* yarn
This commit is contained in:
Henry Zhu
2021-03-27 12:59:34 -04:00
committed by GitHub
parent 6ac07a1647
commit 6b39bafab6
17 changed files with 52 additions and 84 deletions

View File

@@ -3,8 +3,6 @@ import * as helper from "@babel/helper-fixtures";
import rimraf from "rimraf";
import { sync as makeDirSync } from "make-dir";
import child from "child_process";
import escapeRegExp from "lodash/escapeRegExp";
import merge from "lodash/merge";
import path from "path";
import fs from "fs";
import { fileURLToPath } from "url";
@@ -58,6 +56,10 @@ const saveInFiles = function (files) {
});
};
function escapeRegExp(string) {
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
}
const normalizeOutput = function (str, cwd) {
let result = str
.replace(/\(\d+ms\)/g, "(123ms)")
@@ -218,7 +220,7 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) {
const testLoc = path.join(suiteLoc, testName);
const opts = {
let opts = {
args: [],
};
@@ -244,7 +246,7 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) {
delete taskOpts.os;
}
merge(opts, taskOpts);
opts = { args: [], ...taskOpts };
}
["stdout", "stdin", "stderr"].forEach(function (key) {