diff options
author | 2023-07-22 02:42:30 +0300 | |
---|---|---|
committer | 2023-07-22 02:42:30 +0300 | |
commit | 311dffc690f346cc81dd82fb338faaf858cf9318 (patch) | |
tree | e351a3692cea4362804a40526a179ff134a1573a | |
parent | c4f062dbf4666413a028000a360dfe3ea222546f (diff) | |
download | bun-311dffc690f346cc81dd82fb338faaf858cf9318.tar.gz bun-311dffc690f346cc81dd82fb338faaf858cf9318.tar.zst bun-311dffc690f346cc81dd82fb338faaf858cf9318.zip |
improve test (#3731)
- minor build diffs
-rw-r--r-- | src/js/out/modules/node/child_process.js | 2 | ||||
-rw-r--r-- | src/js/out/modules/node/net.js | 2 | ||||
-rwxr-xr-x | test/bun.lockb | bin | 148618 -> 148960 bytes | |||
-rw-r--r-- | test/js/bun/test/test-test.test.ts | 20 | ||||
-rw-r--r-- | test/package.json | 4 |
5 files changed, 13 insertions, 15 deletions
diff --git a/src/js/out/modules/node/child_process.js b/src/js/out/modules/node/child_process.js index 84bf59e83..042fb7753 100644 --- a/src/js/out/modules/node/child_process.js +++ b/src/js/out/modules/node/child_process.js @@ -188,7 +188,7 @@ function spawnSync(file, args, options) { else if (typeof input === "string") bunStdio[0] = Buffer.from(input, encoding || "utf8"); else - throw new ERR_INVALID_ARG_TYPE(`options.stdio[0]`, ["Buffer", "TypedArray", "DataView", "string"], input); + throw new ERR_INVALID_ARG_TYPE("options.stdio[0]", ["Buffer", "TypedArray", "DataView", "string"], input); const { stdout, stderr, success, exitCode } = Bun.spawnSync({ cmd: options.args, env: options.env || void 0, diff --git a/src/js/out/modules/node/net.js b/src/js/out/modules/node/net.js index 06b2ef6ef..ca64e39b0 100644 --- a/src/js/out/modules/node/net.js +++ b/src/js/out/modules/node/net.js @@ -26,7 +26,7 @@ var isIPv4 = function(s) { self.emit("listening"); }, createServer = function(options, connectionListener) { return new Server(options, connectionListener); -}, v4Seg = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])", v4Str = `(${v4Seg}[.]){3}${v4Seg}`, IPv4Reg = new RegExp(`^${v4Str}$`), v6Seg = "(?:[0-9a-fA-F]{1,4})", IPv6Reg = new RegExp("^(" + `(?:${v6Seg}:){7}(?:${v6Seg}|:)|` + `(?:${v6Seg}:){6}(?:${v4Str}|:${v6Seg}|:)|` + `(?:${v6Seg}:){5}(?::${v4Str}|(:${v6Seg}){1,2}|:)|` + `(?:${v6Seg}:){4}(?:(:${v6Seg}){0,1}:${v4Str}|(:${v6Seg}){1,3}|:)|` + `(?:${v6Seg}:){3}(?:(:${v6Seg}){0,2}:${v4Str}|(:${v6Seg}){1,4}|:)|` + `(?:${v6Seg}:){2}(?:(:${v6Seg}){0,3}:${v4Str}|(:${v6Seg}){1,5}|:)|` + `(?:${v6Seg}:){1}(?:(:${v6Seg}){0,4}:${v4Str}|(:${v6Seg}){1,6}|:)|` + `(?::((?::${v6Seg}){0,5}:${v4Str}|(?::${v6Seg}){1,7}|:))` + ")(%[0-9a-zA-Z-.:]{1,})?$"), { Bun, createFIFO, Object } = globalThis[Symbol.for("Bun.lazy")]("primordials"), { connect: bunConnect } = Bun, { setTimeout } = globalThis, bunTlsSymbol = Symbol.for("::buntls::"), bunSocketServerHandlers = Symbol.for("::bunsocket_serverhandlers::"), bunSocketServerConnections = Symbol.for("::bunnetserverconnections::"), bunSocketServerOptions = Symbol.for("::bunnetserveroptions::"), bunSocketInternal = Symbol.for("::bunnetsocketinternal::"), bunTLSConnectOptions = Symbol.for("::buntlsconnectoptions::"), SocketClass, Socket = function(InternalSocket) { +}, v4Seg = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])", v4Str = `(${v4Seg}[.]){3}${v4Seg}`, IPv4Reg = new RegExp(`^${v4Str}\$`), v6Seg = "(?:[0-9a-fA-F]{1,4})", IPv6Reg = new RegExp("^(" + `(?:${v6Seg}:){7}(?:${v6Seg}|:)|` + `(?:${v6Seg}:){6}(?:${v4Str}|:${v6Seg}|:)|` + `(?:${v6Seg}:){5}(?::${v4Str}|(:${v6Seg}){1,2}|:)|` + `(?:${v6Seg}:){4}(?:(:${v6Seg}){0,1}:${v4Str}|(:${v6Seg}){1,3}|:)|` + `(?:${v6Seg}:){3}(?:(:${v6Seg}){0,2}:${v4Str}|(:${v6Seg}){1,4}|:)|` + `(?:${v6Seg}:){2}(?:(:${v6Seg}){0,3}:${v4Str}|(:${v6Seg}){1,5}|:)|` + `(?:${v6Seg}:){1}(?:(:${v6Seg}){0,4}:${v4Str}|(:${v6Seg}){1,6}|:)|` + `(?::((?::${v6Seg}){0,5}:${v4Str}|(?::${v6Seg}){1,7}|:))` + ")(%[0-9a-zA-Z-.:]{1,})?$"), { Bun, createFIFO, Object } = globalThis[Symbol.for("Bun.lazy")]("primordials"), { connect: bunConnect } = Bun, { setTimeout } = globalThis, bunTlsSymbol = Symbol.for("::buntls::"), bunSocketServerHandlers = Symbol.for("::bunsocket_serverhandlers::"), bunSocketServerConnections = Symbol.for("::bunnetserverconnections::"), bunSocketServerOptions = Symbol.for("::bunnetserveroptions::"), bunSocketInternal = Symbol.for("::bunnetsocketinternal::"), bunTLSConnectOptions = Symbol.for("::buntlsconnectoptions::"), SocketClass, Socket = function(InternalSocket) { return SocketClass = InternalSocket, Object.defineProperty(SocketClass.prototype, Symbol.toStringTag, { value: "Socket", enumerable: !1 diff --git a/test/bun.lockb b/test/bun.lockb Binary files differindex ad8548064..7caf819fd 100755 --- a/test/bun.lockb +++ b/test/bun.lockb diff --git a/test/js/bun/test/test-test.test.ts b/test/js/bun/test/test-test.test.ts index af2a143b5..b1b6d7d7a 100644 --- a/test/js/bun/test/test-test.test.ts +++ b/test/js/bun/test/test-test.test.ts @@ -609,12 +609,16 @@ it("should run beforeAll() & afterAll() even without tests", async () => { await writeFile( join(test_dir, "empty.test.js"), ` -beforeAll(() => console.log("???BEFORE ALL???")); -afterAll(() => console.log("!!!AFTER ALL!!!")); +beforeAll(() => console.log("before all")); +beforeEach(() => console.log("before each")); +afterEach(() => console.log("after each")); +afterAll(() => console.log("after all")); describe("empty", () => { - beforeAll(() => console.log(">>>BEFORE ALL>>>")); - afterAll(() => console.log("<<<AFTER ALL<<<")); + beforeAll(() => console.log("before all scoped")); + beforeEach(() => console.log("before each scoped")); + afterEach(() => console.log("after each scoped")); + afterAll(() => console.log("after all scoped")); }); `, ); @@ -632,13 +636,7 @@ describe("empty", () => { expect(err).toContain("0 fail"); expect(stdout).toBeDefined(); const out = await new Response(stdout).text(); - expect(out.split(/\r?\n/)).toEqual([ - "???BEFORE ALL???", - ">>>BEFORE ALL>>>", - "<<<AFTER ALL<<<", - "!!!AFTER ALL!!!", - "", - ]); + expect(out.split(/\r?\n/)).toEqual(["before all", "before all scoped", "after all scoped", "after all", ""]); expect(await exited).toBe(0); } finally { await rm(test_dir, { force: true, recursive: true }); diff --git a/test/package.json b/test/package.json index bc4ed1d8c..aeaa9d1d5 100644 --- a/test/package.json +++ b/test/package.json @@ -11,6 +11,7 @@ "@types/supertest": "2.0.12", "bktree-fast": "0.0.7", "body-parser": "1.20.2", + "comlink": "4.4.1", "dedent": "0.7.0", "esbuild": "0.18.6", "express": "4.18.2", @@ -30,8 +31,7 @@ "undici": "5.20.0", "vitest": "0.32.2", "webpack": "5.88.0", - "webpack-cli": "4.7.2", - "comlink": "4.4.1" + "webpack-cli": "4.7.2" }, "private": true, "scripts": { |