Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Apr 11, 2024
1 parent 2482924 commit 0036299
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/js/internal-for-testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ export const shellInternals = {
* const isDisabled = builtinDisabled("cp")
* ```
*/
builtinDisabled: $newZigFunction("shell.zig", "TestingAPIs.disabledOnThisPlatform", 1)
builtinDisabled: $newZigFunction("shell.zig", "TestingAPIs.disabledOnThisPlatform", 1),
};
4 changes: 2 additions & 2 deletions test/js/bun/shell/commands/cp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { sortedShellOutput } from "../util";
import { tempDirWithFiles } from "harness";
import fs from "fs";
import { shellInternals } from "bun:internal-for-testing";
const { builtinDisabled } = shellInternals
const { builtinDisabled } = shellInternals;

const p = process.platform === 'win32' ? (s: string) => s.replaceAll('/', '\\') : (s: string) => s;
const p = process.platform === "win32" ? (s: string) => s.replaceAll("/", "\\") : (s: string) => s;
// const p = (s: string) => s;

describe.if(!builtinDisabled("cp"))("bunshell cp", async () => {
Expand Down
16 changes: 8 additions & 8 deletions test/js/bun/shell/test_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class TestBuilder {

private tempdir: string | undefined = undefined;
private _env: { [key: string]: string } | undefined = undefined;
private _cwd: string | undefined = undefined
private _cwd: string | undefined = undefined;

private __todo: boolean | string = false;

Expand Down Expand Up @@ -58,7 +58,7 @@ export class TestBuilder {

cwd(path: string): this {
this._cwd = path;
return this
return this;
}

directory(path: string): this {
Expand Down Expand Up @@ -137,7 +137,7 @@ export class TestBuilder {
*/
ensureTempDir(str?: string): this {
if (str !== undefined) {
this.setTempdir(str)
this.setTempdir(str);
} else this.getTempDir();

return this;
Expand Down Expand Up @@ -212,10 +212,10 @@ export class TestBuilder {
return undefined;
}

let finalPromise = this.promise.val
let finalPromise = this.promise.val;
if (this._cwd) finalPromise = finalPromise.cwd(this._cwd);
if (this._env) finalPromise = finalPromise.env(this._env);
const output = await finalPromise
const output = await finalPromise;

const { stdout, stderr, exitCode } = output!;
const tempdir = this.tempdir || "NO_TEMP_DIR";
Expand All @@ -229,15 +229,15 @@ export class TestBuilder {
if (this.expected_stderr !== undefined) {
if (typeof this.expected_stderr === "string") {
expect(stderr.toString()).toEqual(this.expected_stderr.replaceAll("$TEMP_DIR", tempdir));
} else if (typeof this.expected_stderr === 'function') {
} else if (typeof this.expected_stderr === "function") {
this.expected_stderr(stderr.toString(), tempdir);
} else {
expect(stderr.toString()).toContain(this.expected_stderr.contains)
expect(stderr.toString()).toContain(this.expected_stderr.contains);
}
}
if (this.expected_exit_code !== undefined) expect(exitCode).toEqual(this.expected_exit_code);

console.log('Checking files')
console.log("Checking files");
for (const [filename, expected] of Object.entries(this.file_equals)) {
const actual = await Bun.file(join(this.tempdir!, filename)).text();
expect(actual).toEqual(expected);
Expand Down

0 comments on commit 0036299

Please sign in to comment.