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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user