aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/bun-vscode/src/features/tasks/package.json.ts6
-rw-r--r--test/js/node/v8/capture-stack-trace.test.js15
2 files changed, 9 insertions, 12 deletions
diff --git a/packages/bun-vscode/src/features/tasks/package.json.ts b/packages/bun-vscode/src/features/tasks/package.json.ts
index 3f04fa25d..55947a4a1 100644
--- a/packages/bun-vscode/src/features/tasks/package.json.ts
+++ b/packages/bun-vscode/src/features/tasks/package.json.ts
@@ -55,9 +55,9 @@ function extractScriptsFromPackageJson(document: vscode.TextDocument) {
const range = new vscode.Range(document.positionAt(startIndex), document.positionAt(endIndex));
const scripts = matches[1].split(/,\s*/).map(script => {
- const elements = script.match(/"([^"\\]|\\.|\\\n)*"/g)
- if(elements?.length != 2) return null
- const [name, command] = elements
+ const elements = script.match(/"([^"\\]|\\.|\\\n)*"/g);
+ if (elements?.length != 2) return null;
+ const [name, command] = elements;
return {
name: name.replace('"', "").trim(),
command: command.replace(/(?<!\\)"/g, "").trim(),
diff --git a/test/js/node/v8/capture-stack-trace.test.js b/test/js/node/v8/capture-stack-trace.test.js
index c03491b33..6ffa2e90b 100644
--- a/test/js/node/v8/capture-stack-trace.test.js
+++ b/test/js/node/v8/capture-stack-trace.test.js
@@ -18,14 +18,12 @@ test("Regular .stack", () => {
});
test("throw inside Error.prepareStackTrace doesnt crash", () => {
-
- Error.prepareStackTrace = function (err, stack) {
+ Error.prepareStackTrace = function (err, stack) {
Error.prepareStackTrace = null;
- throw new Error('wat');
+ throw new Error("wat");
};
-expect(() => new Error().stack).toThrow("wat");
-
+ expect(() => new Error().stack).toThrow("wat");
});
test("capture stack trace", () => {
@@ -499,9 +497,8 @@ test("err.stack should invoke prepareStackTrace", () => {
expect(parentLineNumber).toBe(499);
});
-
test("Error.prepareStackTrace inside a node:vm works", () => {
- const {runInNewContext} = require("node:vm");
+ const { runInNewContext } = require("node:vm");
Error.prepareStackTrace = null;
const result = runInNewContext(
`
@@ -515,8 +512,8 @@ test("Error.prepareStackTrace inside a node:vm works", () => {
const err = new Error();
err.stack;
- `
- )
+ `,
+ );
expect(result).toBe("custom stack trace");
expect(Error.prepareStackTrace).toBeNull();
});