wrote robust tests for subscription items update and schedule phases udpate
This commit is contained in:
@@ -6,22 +6,22 @@ const lineNum = parseInt(process.argv[3], 10);
|
||||
const content = readFileSync(file, "utf-8");
|
||||
const lines = content.split("\n");
|
||||
|
||||
// Walk backwards from cursor to find enclosing describe or test.concurrent
|
||||
// Walk backwards from cursor to find enclosing describe, test, or test.concurrent
|
||||
for (let i = lineNum - 1; i >= 0; i--) {
|
||||
const line = lines[i];
|
||||
|
||||
// Match describe/test.concurrent with chalk.yellowBright or similar
|
||||
// Match describe/test/test.concurrent with chalk.yellowBright or similar
|
||||
const chalkMatch = line.match(
|
||||
/(?:describe|test\.concurrent)\s*\(\s*`\$\{chalk\.\w+\(["'](.*?)["']\)\}`/,
|
||||
/(?:describe|test(?:\.concurrent)?)\s*\(\s*`\$\{chalk\.\w+\(["'](.*?)["']\)\}`/,
|
||||
);
|
||||
if (chalkMatch) {
|
||||
console.log(chalkMatch[1].replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Match simple describe/test.concurrent: ("name", ...) or ('name', ...) or (`name`, ...)
|
||||
// Match simple describe/test/test.concurrent: ("name", ...) or ('name', ...) or (`name`, ...)
|
||||
const simpleMatch = line.match(
|
||||
/(?:describe|test\.concurrent)\s*\(\s*["'`](.*?)["'`]/,
|
||||
/(?:describe|test(?:\.concurrent)?)\s*\(\s*["'`](.*?)["'`]/,
|
||||
);
|
||||
if (simpleMatch) {
|
||||
console.log(simpleMatch[1].replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
||||
|
||||
Reference in New Issue
Block a user