Compare commits

...

3 Commits

Author SHA1 Message Date
autofix-ci[bot]
5658c2e017 [autofix.ci] apply automated fixes 2025-07-22 21:26:26 +00:00
Dylan Conway
d1bf4fdda7 rename to bun-{pid}.core 2025-07-22 14:21:12 -07:00
Meghan Denny
73d92c7518 Revert "Fix beforeAll hooks running for unmatched describe blocks when using test filters" (#21292)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-22 12:53:53 -07:00
5 changed files with 6 additions and 69 deletions

View File

@@ -1,6 +1,6 @@
import fs from "node:fs";
import { tmpdir } from "node:os";
import { basename, join } from "node:path";
import { join } from "node:path";
import { parseArgs } from "node:util";
// usage: bun debug-coredump.ts
@@ -44,8 +44,8 @@ if (!fs.existsSync(join(dir, "bun-profile")) || !fs.existsSync(join(dir, `bun-${
await Bun.$`bash -c ${`age -d -i <(echo "$AGE_CORES_IDENTITY")`} < ${cores} | tar -zxvC ${dir}`;
console.log("moving cores out of nested directory");
for await (const file of new Bun.Glob("bun-cores-*/bun-*.core").scan(dir)) {
fs.renameSync(join(dir, file), join(dir, basename(file)));
for await (const file of new Bun.Glob("bun-cores-*/*.core").scan(dir)) {
fs.renameSync(join(dir, file), join(dir, `bun-${pid}.core`));
}
} else {
console.log(`already downloaded in ${dir}`);

View File

@@ -890,19 +890,6 @@ pub const DescribeScope = struct {
return true;
}
pub fn hasRunnableTests(this: *const DescribeScope) bool {
for (this.tests.items) |test_scope| {
if (test_scope.tag != .skip and
test_scope.tag != .todo and
test_scope.tag != .skipped_because_label and
!(test_scope.tag != .only and Jest.runner.?.only))
{
return true;
}
}
return false;
}
pub fn push(new: *DescribeScope) void {
if (new.parent) |scope| {
if (comptime Environment.allow_assert) {
@@ -1194,7 +1181,7 @@ pub const DescribeScope = struct {
var i: TestRunner.Test.ID = 0;
if (this.shouldEvaluateScope() and this.hasRunnableTests()) {
if (this.shouldEvaluateScope()) {
if (this.runCallback(globalObject, .beforeAll)) |err| {
_ = globalObject.bunVM().uncaughtException(globalObject, err, true);
while (i < end) {

View File

@@ -294,10 +294,11 @@ pub fn copyFileReadWriteLoop(
}
}
const debug = bun.Output.scoped(.copy_file, true);
const bun = @import("bun");
const Environment = bun.Environment;
const Maybe = bun.sys.Maybe;
const debug = bun.Output.scoped(.copy_file, true);
const Platform = bun.analytics.GenerateHeader.GeneratePlatform;
const std = @import("std");

View File

@@ -1,15 +0,0 @@
describe("False assertion", () => {
beforeAll(() => {
console.log("Running False assertion tests...");
});
test("false is false", () => {
expect(false).toBe(false);
});
});
describe("True assertion", () => {
test("true is true", () => {
expect(true).toBe(true);
});
});

View File

@@ -1,36 +0,0 @@
// https://github.com/oven-sh/bun/issues/21177
// beforeAll hooks should not run for describe blocks that have no tests matching the filter
import { spawn } from "bun";
import { expect, test } from "bun:test";
import { bunEnv, bunExe } from "harness";
import { join } from "path";
test("beforeAll should not run for unmatched describe blocks when using test filters", async () => {
const testFile = join(import.meta.dir, "21177.fixture.js");
await using proc = spawn({
cmd: [bunExe(), "test", testFile, "-t", "true is true"],
env: bunEnv,
stderr: "pipe",
stdout: "pipe",
});
const [stdout, stderr, exitCode] = await Promise.all([
new Response(proc.stdout).text(),
new Response(proc.stderr).text(),
proc.exited,
]);
expect(exitCode).toBe(0);
const output = stdout + stderr;
// The beforeAll hook from "False assertion" describe block should NOT have run
// because no tests from that block match the filter
expect(output).not.toContain("Running False assertion tests...");
// The test should have passed
expect(output).toContain("1 pass");
expect(output).toContain("1 filtered out");
});