diff options
author | 2023-03-02 19:02:10 -0800 | |
---|---|---|
committer | 2023-03-02 19:02:10 -0800 | |
commit | 9388b3f8257bc2e580deaece4cd2677928104fc6 (patch) | |
tree | 3f6aff2009cef69897f599fe51305b894f81a376 /test | |
parent | b469e5035161286abeb1a7726518d1afcc163a51 (diff) | |
download | bun-9388b3f8257bc2e580deaece4cd2677928104fc6.tar.gz bun-9388b3f8257bc2e580deaece4cd2677928104fc6.tar.zst bun-9388b3f8257bc2e580deaece4cd2677928104fc6.zip |
Add a zig fmt action (#2277)
* Add a zig fmt action
* add failing file
* Setup prettier better
* Update prettier-fmt.yml
* Fail on error
* Update prettier-fmt.yml
* boop
* boop2
* tar.gz
* Update zig-fmt.yml
* Update zig-fmt.yml
* Update zig-fmt.yml
* Update zig-fmt.yml
* Update zig-fmt.yml
* boop
* Update prettier-fmt.yml
* tag
* newlines
* multiline
* fixup
* Update zig-fmt.yml
* update it
* fixup
* both
* w
* Update prettier-fmt.yml
* prettier all the things
* Update package.json
* zig fmt
* ❌ ✅
* bump
* .
* quotes
* fix prettier ignore
* once more
* Update prettier-fmt.yml
* Update fallback.ts
* consistentcy
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/bun.js/.prettierignore | 2 | ||||
-rw-r--r-- | test/bun.js/baz.js | 1 | ||||
-rw-r--r-- | test/bun.js/buffer.test.js | 5 | ||||
-rw-r--r-- | test/bun.js/bun-server.test.ts | 8 | ||||
-rw-r--r-- | test/bun.js/bun-write.test.js | 2 | ||||
-rw-r--r-- | test/bun.js/disabled-module.test.js | 94 | ||||
-rw-r--r-- | test/bun.js/fetch.test.js | 2 | ||||
-rw-r--r-- | test/bun.js/fetch_headers.test.js | 20 | ||||
-rw-r--r-- | test/bun.js/repro_2005.test.js | 1 | ||||
-rw-r--r-- | test/snippets/code-simplification-neql-define.js | 20 | ||||
-rw-r--r-- | test/snippets/export.js | 5 | ||||
-rw-r--r-- | test/snippets/jsx-entities.jsx | 5 | ||||
-rw-r--r-- | test/snippets/latin1-chars-in-regexp.js | 34 | ||||
-rw-r--r-- | test/snippets/optional-chain-with-function.js | 8 | ||||
-rw-r--r-- | test/snippets/react-context-value-func.tsx | 2 | ||||
-rw-r--r-- | test/snippets/simple-lit-example.ts | 8 | ||||
-rw-r--r-- | test/snippets/spread_with_key.tsx | 7 | ||||
-rw-r--r-- | test/snippets/string-escapes.js | 34 | ||||
-rw-r--r-- | test/snippets/styledcomponents-output.js | 20 | ||||
-rw-r--r-- | test/snippets/template-literal.js | 15 | ||||
-rw-r--r-- | test/snippets/type-only-imports.ts | 3 |
21 files changed, 132 insertions, 164 deletions
diff --git a/test/bun.js/.prettierignore b/test/bun.js/.prettierignore new file mode 100644 index 000000000..91b589eb2 --- /dev/null +++ b/test/bun.js/.prettierignore @@ -0,0 +1,2 @@ +node_modules +third-party diff --git a/test/bun.js/baz.js b/test/bun.js/baz.js index 5837bb3bb..58a9bb4b0 100644 --- a/test/bun.js/baz.js +++ b/test/bun.js/baz.js @@ -1,2 +1,3 @@ // this file is used in resolve.test.js +// export default {}; diff --git a/test/bun.js/buffer.test.js b/test/bun.js/buffer.test.js index 0dcf96816..b8fade4d2 100644 --- a/test/bun.js/buffer.test.js +++ b/test/bun.js/buffer.test.js @@ -2552,7 +2552,10 @@ it("should not perform out-of-bound access on invalid UTF-8 byte sequence", () = }); it("repro #2063", () => { - const buf = Buffer.from("eyJlbWFpbCI6Ijg3MTg4NDYxN0BxcS5jb20iLCJpZCI6OCwicm9sZSI6Im5vcm1hbCIsImlhdCI6MTY3NjI4NDQyMSwiZXhwIjoxNjc2ODg5MjIxfQ", 'base64'); + const buf = Buffer.from( + "eyJlbWFpbCI6Ijg3MTg4NDYxN0BxcS5jb20iLCJpZCI6OCwicm9sZSI6Im5vcm1hbCIsImlhdCI6MTY3NjI4NDQyMSwiZXhwIjoxNjc2ODg5MjIxfQ", + "base64", + ); expect(buf.length).toBe(85); expect(buf[82]).toBe(50); expect(buf[83]).toBe(49); diff --git a/test/bun.js/bun-server.test.ts b/test/bun.js/bun-server.test.ts index 6e0eab6fd..52574d2a3 100644 --- a/test/bun.js/bun-server.test.ts +++ b/test/bun.js/bun-server.test.ts @@ -131,14 +131,16 @@ describe("Server", () => { return new Response( new ReadableStream({ async pull(controller) { + console.trace("here"); abortController.abort(); const buffer = await Bun.file(import.meta.dir + "/fixture.html.gz").arrayBuffer(); + console.trace("here"); controller.enqueue(buffer); + console.trace("here"); //wait to detect the connection abortion await Bun.sleep(15); - controller.close(); }, }), @@ -155,11 +157,15 @@ describe("Server", () => { }); try { + console.trace("here"); await fetch(`http://${server.hostname}:${server.port}`, { signal: abortController.signal }); } catch {} await Bun.sleep(10); + console.trace("here"); expect(signalOnServer).toBe(true); + console.trace("here"); server.stop(true); + console.trace("here"); } }); }); diff --git a/test/bun.js/bun-write.test.js b/test/bun.js/bun-write.test.js index 68e221d51..c324d36a0 100644 --- a/test/bun.js/bun-write.test.js +++ b/test/bun.js/bun-write.test.js @@ -142,7 +142,7 @@ it("Bun.file", async () => { it("Bun.file empty file", async () => { const file = path.join(import.meta.dir, "emptyFile"); await gcTick(); - const buffer = await Bun.file(file).arrayBuffer() + const buffer = await Bun.file(file).arrayBuffer(); expect(buffer.byteLength).toBe(0); await gcTick(); }); diff --git a/test/bun.js/disabled-module.test.js b/test/bun.js/disabled-module.test.js index c12676959..61411aa44 100644 --- a/test/bun.js/disabled-module.test.js +++ b/test/bun.js/disabled-module.test.js @@ -1,38 +1,72 @@ import { expect, test } from "bun:test"; -test("not implemented yet module masquerades as undefined and throws an error", () => { - const worker_threads = import.meta.require("worker_threads"); +// test("not implemented yet module masquerades as undefined and throws an error", () => { +// const worker_threads = import.meta.require("worker_threads"); - expect(typeof worker_threads).toBe("undefined"); - expect(typeof worker_threads.getEnvironmentData).toBe("undefined"); +// expect(typeof worker_threads).toBe("undefined"); +// expect(typeof worker_threads.getEnvironmentData).toBe("undefined"); +// }); + +test("AsyncContext", async done => { + const { AsyncContext } = import.meta.require("async_hooks"); + console.log("here"); + const ctx = new AsyncContext(); + ctx + .run(1234, async () => { + expect(ctx.get()).toBe(1234); + console.log("here"); + await 1; + console.log("ctx", ctx.get()); + const setTimeoutResult = await ctx.run( + 2345, + () => + new Promise(resolve => { + queueMicrotask(() => { + console.log("queueMicrotask", ctx.get()); + resolve(ctx.get()); + }); + }), + ); + expect(setTimeoutResult).toBe(2345); + expect(ctx.get()).toBe(1234); + return "final result"; + }) + .then(result => { + expect(result).toBe("final result"); + // The code that generated the Promise has access to the 1234 + // value provided to ctx.run above, but consumers of the Promise + // do not automatically inherit it. + expect(ctx.get()).toBeUndefined(); + done(); + }); }); -test("AsyncLocalStorage polyfill", () => { - const { AsyncLocalStorage } = import.meta.require("async_hooks"); +// test("AsyncLocalStorage polyfill", () => { +// const { AsyncLocalStorage } = import.meta.require("async_hooks"); - const store = new AsyncLocalStorage(); - var called = false; - expect(store.getStore()).toBe(null); - store.run({ foo: "bar" }, () => { - expect(store.getStore()).toEqual({ foo: "bar" }); - called = true; - }); - expect(store.getStore()).toBe(null); - expect(called).toBe(true); -}); +// const store = new AsyncLocalStorage(); +// var called = false; +// expect(store.getStore()).toBe(null); +// store.run({ foo: "bar" }, () => { +// expect(store.getStore()).toEqual({ foo: "bar" }); +// called = true; +// }); +// expect(store.getStore()).toBe(null); +// expect(called).toBe(true); +// }); -test("AsyncResource polyfill", () => { - const { AsyncResource } = import.meta.require("async_hooks"); +// test("AsyncResource polyfill", () => { +// const { AsyncResource } = import.meta.require("async_hooks"); - const resource = new AsyncResource("test"); - var called = false; - resource.runInAsyncScope( - () => { - called = true; - }, - null, - "foo", - "bar", - ); - expect(called).toBe(true); -}); +// const resource = new AsyncResource("test"); +// var called = false; +// resource.runInAsyncScope( +// () => { +// called = true; +// }, +// null, +// "foo", +// "bar", +// ); +// expect(called).toBe(true); +// }); diff --git a/test/bun.js/fetch.test.js b/test/bun.js/fetch.test.js index e0f4c7d43..be64a0109 100644 --- a/test/bun.js/fetch.test.js +++ b/test/bun.js/fetch.test.js @@ -554,7 +554,7 @@ describe("Bun.file", () => { testBlobInterface(data => { const blob = new Blob([data]); const buffer = Bun.peek(blob.arrayBuffer()); - const path = join(tempdir , "tmp-" + callCount++ + ".bytes"); + const path = join(tempdir, "tmp-" + callCount++ + ".bytes"); require("fs").writeFileSync(path, buffer); const file = Bun.file(path); expect(blob.size).toBe(file.size); diff --git a/test/bun.js/fetch_headers.test.js b/test/bun.js/fetch_headers.test.js index 7f8fab188..2e5b9fa52 100644 --- a/test/bun.js/fetch_headers.test.js +++ b/test/bun.js/fetch_headers.test.js @@ -19,17 +19,17 @@ describe("Headers", async () => { }); it("Headers should work", async () => { - expect(await fetchContent({"x-test": "header 1"})).toBe("header 1"); + expect(await fetchContent({ "x-test": "header 1" })).toBe("header 1"); }); it("Header names must be valid", async () => { - expect(() => fetch(url, {headers: {"a\tb:c": "foo" }})).toThrow("Invalid header name: 'a\tb:c'"); - expect(() => fetch(url, {headers: {"❤️": "foo" }})).toThrow("Invalid header name: '❤️'"); + expect(() => fetch(url, { headers: { "a\tb:c": "foo" } })).toThrow("Invalid header name: 'a\tb:c'"); + expect(() => fetch(url, { headers: { "❤️": "foo" } })).toThrow("Invalid header name: '❤️'"); }); it("Header values must be valid", async () => { - expect(() => fetch(url, {headers: {"x-test": "\0" }})).toThrow("Header 'x-test' has invalid value: '\0'"); - expect(() => fetch(url, {headers: {"x-test": "❤️" }})).toThrow("Header 'x-test' has invalid value: '❤️'"); + expect(() => fetch(url, { headers: { "x-test": "\0" } })).toThrow("Header 'x-test' has invalid value: '\0'"); + expect(() => fetch(url, { headers: { "x-test": "❤️" } })).toThrow("Header 'x-test' has invalid value: '❤️'"); }); it("repro 1602", async () => { @@ -42,17 +42,13 @@ describe("Headers", async () => { expect(roundTripString).toBe(origString); // This one will pass - expect(await fetchContent({"x-test": roundTripString})).toBe(roundTripString); + expect(await fetchContent({ "x-test": roundTripString })).toBe(roundTripString); // This would hang - expect(await fetchContent({"x-test": origString})).toBe(origString); + expect(await fetchContent({ "x-test": origString })).toBe(origString); }); }); async function fetchContent(headers) { - const res = await fetch( - url, - { headers: headers }, - { verbose: true } - ); + const res = await fetch(url, { headers: headers }, { verbose: true }); return await res.text(); } diff --git a/test/bun.js/repro_2005.test.js b/test/bun.js/repro_2005.test.js index bd80ab7dd..dc0cd9a97 100644 --- a/test/bun.js/repro_2005.test.js +++ b/test/bun.js/repro_2005.test.js @@ -8,5 +8,4 @@ it("regex literal with non-Latin1 should work", () => { //Incorrect result: 这是一段要替换的文字 expect(text.replace(/要替换/, "")).toBe("这是一段的文字"); - }); diff --git a/test/snippets/code-simplification-neql-define.js b/test/snippets/code-simplification-neql-define.js index c7676dc9b..bd7ab9207 100644 --- a/test/snippets/code-simplification-neql-define.js +++ b/test/snippets/code-simplification-neql-define.js @@ -2,7 +2,7 @@ var testFailed = false; const invariant = () => { testFailed = true; }; -var $$m = (arg) => { +var $$m = arg => { var module = { exports: {} }, exports = module.exports; return arg(module, exports); @@ -12,31 +12,19 @@ var size = 100, export var $f332019d = $$m( { - "relay-runtime/lib/network/RelayQueryResponseCache.js": ( - module, - exports, - ) => { + "relay-runtime/lib/network/RelayQueryResponseCache.js": (module, exports) => { var RelayQueryResponseCache = function () { var foo = function RelayQueryResponseCache(_ref) { var size = _ref.size, ttl = _ref.ttl; !(size > 0) ? process.env.NODE_ENV !== "production" - ? invariant( - false, - "RelayQueryResponseCache: Expected the max cache size to be > 0, got " + - "`%s`.", - size, - ) + ? invariant(false, "RelayQueryResponseCache: Expected the max cache size to be > 0, got " + "`%s`.", size) : invariant(false) : void 0; !(ttl > 0) ? process.env.NODE_ENV !== "production" - ? invariant( - false, - "RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.", - ttl, - ) + ? invariant(false, "RelayQueryResponseCache: Expected the max ttl to be > 0, got `%s`.", ttl) : invariant(false) : void 0; }; diff --git a/test/snippets/export.js b/test/snippets/export.js index 2a757269f..bf334f025 100644 --- a/test/snippets/export.js +++ b/test/snippets/export.js @@ -21,9 +21,6 @@ export function test() { if (where.default !== "hi") { throw new Error(`_auth import is incorrect.`); } - console.assert( - powerLevel.description === "9001", - "Symbol is not exported correctly", - ); + console.assert(powerLevel.description === "9001", "Symbol is not exported correctly"); return testDone(import.meta.url); } diff --git a/test/snippets/jsx-entities.jsx b/test/snippets/jsx-entities.jsx index ac5d32225..7123fd674 100644 --- a/test/snippets/jsx-entities.jsx +++ b/test/snippets/jsx-entities.jsx @@ -926,10 +926,7 @@ export function test() { key = txt.value; } - console.assert( - elements[rawKey] === key.codePointAt(0), - `${key} is not ${elements[rawKey]}`, - ); + console.assert(elements[rawKey] === key.codePointAt(0), `${key} is not ${elements[rawKey]}`); } return testDone(import.meta.url); diff --git a/test/snippets/latin1-chars-in-regexp.js b/test/snippets/latin1-chars-in-regexp.js index 1a533b1e1..0ba85d100 100644 --- a/test/snippets/latin1-chars-in-regexp.js +++ b/test/snippets/latin1-chars-in-regexp.js @@ -10,40 +10,24 @@ export var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; export var re_btou = new RegExp( - [ - "[\xC0-\xDF][\x80-\xBF]", - "[\xE0-\xEF][\x80-\xBF]{2}", - "[\xF0-\xF7][\x80-\xBF]{3}", - ].join("|"), + ["[\xC0-\xDF][\x80-\xBF]", "[\xE0-\xEF][\x80-\xBF]{2}", "[\xF0-\xF7][\x80-\xBF]{3}"].join("|"), "g", ); const encoder = new TextEncoder(); -const realLines = [ - "[\xC0-\xDF][\x80-\xBF]", - "[\xE0-\xEF][\x80-\xBF]{2}", - "[\xF0-\xF7][\x80-\xBF]{3}", -]; -const real = realLines.map((input) => Array.from(encoder.encode(input))); +const realLines = ["[\xC0-\xDF][\x80-\xBF]", "[\xE0-\xEF][\x80-\xBF]{2}", "[\xF0-\xF7][\x80-\xBF]{3}"]; +const real = realLines.map(input => Array.from(encoder.encode(input))); const expected = [ [91, 195, 128, 45, 195, 159, 93, 91, 194, 128, 45, 194, 191, 93], - [ - 91, 195, 160, 45, 195, 175, 93, 91, 194, 128, 45, 194, 191, 93, 123, 50, - 125, - ], - [ - 91, 195, 176, 45, 195, 183, 93, 91, 194, 128, 45, 194, 191, 93, 123, 51, - 125, - ], + [91, 195, 160, 45, 195, 175, 93, 91, 194, 128, 45, 194, 191, 93, 123, 50, 125], + [91, 195, 176, 45, 195, 183, 93, 91, 194, 128, 45, 194, 191, 93, 123, 51, 125], ]; const newlinePreserved = `\n`; export function test() { - if ( - !real.every((point, i) => point.every((val, j) => val === expected[i][j])) - ) { + if (!real.every((point, i) => point.every((val, j) => val === expected[i][j]))) { throw new Error( `test failed ${JSON.stringify({ expected, real }, null, 2)}`, @@ -55,11 +39,7 @@ ${JSON.stringify({ expected, real }, null, 2)}`, } const decoder = new TextDecoder("utf8"); - if ( - !realLines.every( - (line, i) => decoder.decode(Uint8Array.from(expected[i])) === line, - ) - ) { + if (!realLines.every((line, i) => decoder.decode(Uint8Array.from(expected[i])) === line)) { throw new Error( `test failed. Lines did not match. ${JSON.stringify({ expected, real }, null, 2)}`, diff --git a/test/snippets/optional-chain-with-function.js b/test/snippets/optional-chain-with-function.js index 82ad51d46..841c8a584 100644 --- a/test/snippets/optional-chain-with-function.js +++ b/test/snippets/optional-chain-with-function.js @@ -3,10 +3,10 @@ export function test() { const multipleSecondaryValues = undefined; const ratings = ["123"]; - var bar = multipleSecondaryValues?.map((value) => false); - bar = bar?.multipleSecondaryValues?.map((value) => false); - bar = bar?.bar?.multipleSecondaryValues?.map((value) => false); - bar = {}?.bar?.multipleSecondaryValues?.map((value) => false); + var bar = multipleSecondaryValues?.map(value => false); + bar = bar?.multipleSecondaryValues?.map(value => false); + bar = bar?.bar?.multipleSecondaryValues?.map(value => false); + bar = {}?.bar?.multipleSecondaryValues?.map(value => false); } catch (e) { throw e; } diff --git a/test/snippets/react-context-value-func.tsx b/test/snippets/react-context-value-func.tsx index e7ced1292..800ad428d 100644 --- a/test/snippets/react-context-value-func.tsx +++ b/test/snippets/react-context-value-func.tsx @@ -12,7 +12,7 @@ const ContextProvider = ({ children }) => { const ContextValue = ({}) => ( <Context.Consumer> - {(foo) => { + {foo => { if (foo) { return <div>Worked!</div>; } diff --git a/test/snippets/simple-lit-example.ts b/test/snippets/simple-lit-example.ts index 3c53f03ab..1b10b61db 100644 --- a/test/snippets/simple-lit-example.ts +++ b/test/snippets/simple-lit-example.ts @@ -3,7 +3,7 @@ import { LitElement, html, css } from "lit"; import { customElement, property, eventOptions } from "lit/decorators.js"; var loadedResolve; -var loadedPromise = new Promise((resolve) => { +var loadedPromise = new Promise(resolve => { loadedResolve = resolve; }); @@ -35,11 +35,7 @@ export class MyElement extends LitElement { @property() planet = "Earth"; render() { - return html` - <span @click=${this.togglePlanet} class="planet" id="planet-id" - >${this.planet}</span - > - `; + return html` <span @click=${this.togglePlanet} class="planet" id="planet-id">${this.planet}</span> `; } @eventOptions({ once: true }) diff --git a/test/snippets/spread_with_key.tsx b/test/snippets/spread_with_key.tsx index d9f842d27..2dc0c7072 100644 --- a/test/snippets/spread_with_key.tsx +++ b/test/snippets/spread_with_key.tsx @@ -4,12 +4,7 @@ import React from "react"; export function SpreadWithTheKey({ className }: Props) { const rest = {}; return ( - <div - className={className} - key="spread-with-the-key" - {...rest} - onClick={() => console.log("click")} - > + <div className={className} key="spread-with-the-key" {...rest} onClick={() => console.log("click")}> Rendered component containing warning </div> ); diff --git a/test/snippets/string-escapes.js b/test/snippets/string-escapes.js index 436140939..5fbc8da6c 100644 --- a/test/snippets/string-escapes.js +++ b/test/snippets/string-escapes.js @@ -30,31 +30,23 @@ const encoder = new TextEncoder(); const encodedObj = encoder.encode(JSON.stringify(obj)); // ------------------------------------------------------------ const correctEncodedObj = [ - 123, 34, 92, 114, 92, 110, 34, 58, 34, 92, 114, 92, 110, 34, 44, 34, 92, 110, - 34, 58, 34, 92, 110, 34, 44, 34, 92, 116, 34, 58, 34, 92, 116, 34, 44, 34, 92, - 102, 34, 58, 34, 92, 102, 34, 44, 34, 92, 117, 48, 48, 48, 98, 34, 58, 34, 92, - 117, 48, 48, 48, 98, 34, 44, 34, 226, 128, 168, 34, 58, 34, 226, 128, 168, 34, - 44, 34, 226, 128, 169, 34, 58, 34, 226, 128, 169, 34, 44, 34, 92, 117, 48, 48, - 48, 48, 34, 58, 34, 92, 117, 48, 48, 48, 48, 194, 160, 110, 117, 108, 108, 32, - 98, 121, 116, 101, 34, 44, 34, 240, 159, 152, 138, 34, 58, 34, 240, 159, 152, - 138, 34, 44, 34, 240, 159, 152, 131, 34, 58, 34, 240, 159, 152, 131, 34, 44, - 34, 240, 159, 149, 181, 240, 159, 143, 189, 226, 128, 141, 226, 153, 130, 239, - 184, 143, 34, 58, 34, 240, 159, 149, 181, 240, 159, 143, 189, 226, 128, 141, - 226, 153, 130, 239, 184, 143, 34, 44, 34, 227, 139, 161, 34, 58, 34, 227, 139, - 161, 34, 44, 34, 226, 152, 186, 34, 58, 34, 226, 152, 186, 34, 44, 34, 227, - 130, 183, 34, 58, 34, 227, 130, 183, 34, 44, 34, 240, 159, 145, 139, 34, 58, - 34, 240, 159, 145, 139, 34, 44, 34, 102, 34, 58, 34, 226, 130, 135, 34, 44, - 34, 226, 152, 185, 34, 58, 34, 226, 152, 185, 34, 44, 34, 226, 152, 187, 34, - 58, 34, 226, 152, 187, 34, 44, 34, 99, 104, 105, 108, 100, 114, 101, 110, 34, - 58, 49, 50, 51, 125, + 123, 34, 92, 114, 92, 110, 34, 58, 34, 92, 114, 92, 110, 34, 44, 34, 92, 110, 34, 58, 34, 92, 110, 34, 44, 34, 92, + 116, 34, 58, 34, 92, 116, 34, 44, 34, 92, 102, 34, 58, 34, 92, 102, 34, 44, 34, 92, 117, 48, 48, 48, 98, 34, 58, 34, + 92, 117, 48, 48, 48, 98, 34, 44, 34, 226, 128, 168, 34, 58, 34, 226, 128, 168, 34, 44, 34, 226, 128, 169, 34, 58, 34, + 226, 128, 169, 34, 44, 34, 92, 117, 48, 48, 48, 48, 34, 58, 34, 92, 117, 48, 48, 48, 48, 194, 160, 110, 117, 108, 108, + 32, 98, 121, 116, 101, 34, 44, 34, 240, 159, 152, 138, 34, 58, 34, 240, 159, 152, 138, 34, 44, 34, 240, 159, 152, 131, + 34, 58, 34, 240, 159, 152, 131, 34, 44, 34, 240, 159, 149, 181, 240, 159, 143, 189, 226, 128, 141, 226, 153, 130, 239, + 184, 143, 34, 58, 34, 240, 159, 149, 181, 240, 159, 143, 189, 226, 128, 141, 226, 153, 130, 239, 184, 143, 34, 44, 34, + 227, 139, 161, 34, 58, 34, 227, 139, 161, 34, 44, 34, 226, 152, 186, 34, 58, 34, 226, 152, 186, 34, 44, 34, 227, 130, + 183, 34, 58, 34, 227, 130, 183, 34, 44, 34, 240, 159, 145, 139, 34, 58, 34, 240, 159, 145, 139, 34, 44, 34, 102, 34, + 58, 34, 226, 130, 135, 34, 44, 34, 226, 152, 185, 34, 58, 34, 226, 152, 185, 34, 44, 34, 226, 152, 187, 34, 58, 34, + 226, 152, 187, 34, 44, 34, 99, 104, 105, 108, 100, 114, 101, 110, 34, 58, 49, 50, 51, 125, ]; export const jsxVariants = ( <> - "\r\n": "\r\n", "\n": "\n", "\t": "\t", "\f": "\f", "\v": "\v", "\u2028": - "\u2028", "\u2029": "\u2029", "😊": "😊", "😃": "😃", "🕵🏽♂️": "🕵🏽♂️", "㋡": - "㋡", "☺": "☺", シ: "シ", "👋": "👋", f: f, "☹": "☹", "☻": "☻", children: - 123, + "\r\n": "\r\n", "\n": "\n", "\t": "\t", "\f": "\f", "\v": "\v", "\u2028": "\u2028", "\u2029": "\u2029", "😊": "😊", + "😃": "😃", "🕵🏽♂️": "🕵🏽♂️", "㋡": "㋡", "☺": "☺", シ: "シ", "👋": "👋", f: f, "☹": "☹", "☻": "☻", children: 123, <div data="\r\n" /> <div data="\n" /> <div data="\t" /> diff --git a/test/snippets/styledcomponents-output.js b/test/snippets/styledcomponents-output.js index fca6e8407..91c871770 100644 --- a/test/snippets/styledcomponents-output.js +++ b/test/snippets/styledcomponents-output.js @@ -3,8 +3,7 @@ import React from "react"; import ReactDOM from "react-dom"; const ErrorScreenRoot = styled.div` - font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, - sans-serif; + font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; position: fixed; top: 0; left: 0; @@ -18,8 +17,7 @@ const ErrorScreenRoot = styled.div` text-align: center; background-color: #0b2988; color: #fff; - font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, - sans-serif; + font-family: "Muli", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; line-height: 1.5em; & > p { @@ -35,23 +33,15 @@ export function test() { if (typeof window !== "undefined") { const reactEl = document.createElement("div"); document.body.appendChild(reactEl); - ReactDOM.render( - <ErrorScreenRoot id="error-el"> - The react child should have this text - </ErrorScreenRoot>, - reactEl, - ); + ReactDOM.render(<ErrorScreenRoot id="error-el">The react child should have this text</ErrorScreenRoot>, reactEl); const style = document.querySelector("style[data-styled]"); console.assert(style, "style tag should exist"); console.assert( - style.textContent.split("").every((a) => a.codePointAt(0) < 128), + style.textContent.split("").every(a => a.codePointAt(0) < 128), "style tag should not contain invalid unicode codepoints", ); - console.assert( - document.querySelector("#error-el").textContent === - "The react child should have this text", - ); + console.assert(document.querySelector("#error-el").textContent === "The react child should have this text"); ReactDOM.unmountComponentAtNode(reactEl); reactEl.remove(); diff --git a/test/snippets/template-literal.js b/test/snippets/template-literal.js index a5749a555..8d8f64917 100644 --- a/test/snippets/template-literal.js +++ b/test/snippets/template-literal.js @@ -1,4 +1,4 @@ -const css = (templ) => templ.toString(); +const css = templ => templ.toString(); const fooNoBracesUTF8 = css` before @@ -25,8 +25,7 @@ const fooUTF16 = css` `; -const templateLiteralWhichDefinesAFunction = ((...args) => - args[args.length - 1]().toString())` +const templateLiteralWhichDefinesAFunction = ((...args) => args[args.length - 1]().toString())` before 🙃 ${() => true} after @@ -35,17 +34,11 @@ const templateLiteralWhichDefinesAFunction = ((...args) => export function test() { for (let foo of [fooNoBracesUT16, fooNoBracesUTF8, fooUTF16, fooUTF8]) { - console.assert( - foo.includes("before"), - `Expected ${foo} to include "before"`, - ); + console.assert(foo.includes("before"), `Expected ${foo} to include "before"`); console.assert(foo.includes("after"), `Expected ${foo} to include "after"`); } - console.assert( - templateLiteralWhichDefinesAFunction.includes("true"), - "Expected fooFunction to include 'true'", - ); + console.assert(templateLiteralWhichDefinesAFunction.includes("true"), "Expected fooFunction to include 'true'"); return testDone(import.meta.url); } diff --git a/test/snippets/type-only-imports.ts b/test/snippets/type-only-imports.ts index c43fcf278..38d02c743 100644 --- a/test/snippets/type-only-imports.ts +++ b/test/snippets/type-only-imports.ts @@ -3,8 +3,7 @@ import type Bacon from "tree"; import type { SilentSymbolCollisionsAreOkayInTypeScript } from "./app"; export const baconator: Bacon = true; -export const SilentSymbolCollisionsAreOkayInTypeScript: SilentSymbolCollisionsAreOkayInTypeScript = - true; +export const SilentSymbolCollisionsAreOkayInTypeScript: SilentSymbolCollisionsAreOkayInTypeScript = true; export function test() { console.assert(SilentSymbolCollisionsAreOkayInTypeScript); |