Skip to content

Commit

Permalink
try to fix test issue on linux ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Replit user committed Jan 24, 2024
1 parent 556be27 commit 31967b7
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ $RECYCLE.BIN/

/target
Cargo.lock
.cargo/

.pnp.*
.yarn/*
Expand Down
17 changes: 17 additions & 0 deletions .replit
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
run = "bun run build:debug && bun test"
modules = ["bun-1.0:v17-20240117-0bd73cd", "nodejs-20:v24-20240117-0bd73cd", "rust-stable:v4-20240117-0bd73cd"]

disableGuessImports = true
disableInstallBeforeRun = true

[nix]
channel = "stable-23_11"

[rules]

[rules.formatter]

[rules.formatter.fileExtensions]

[rules.formatter.fileExtensions.".ts"]
id = "module:nodejs-20:v24-20240117-0bd73cd/formatter:prettier"
Binary file modified bun.lockb
Binary file not shown.
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,20 @@ switch (platform) {
}
}
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'ruspty.linux-s390x-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./ruspty.linux-s390x-gnu.node')
} else {
nativeBinding = require('@replit/ruspty-linux-s390x-gnu')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`)
}
Expand Down
28 changes: 11 additions & 17 deletions index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("PTY", () => {
expect(err).toBeNull();
expect(exitCode).toBe(0);
done();
}
},
);

const readStream = fs.createReadStream("", { fd: pty.fd });
Expand All @@ -38,7 +38,7 @@ describe("PTY", () => {
expect(err).toBeNull();
expect(exitCode).toBe(17);
done();
}
},
);
});

Expand Down Expand Up @@ -85,19 +85,12 @@ describe("PTY", () => {
writeStream.write("stty size; echo 'done1'\n");
});

test.skip("respects working directory", (done) => {
const pty = new Pty(
"/bin/pwd",
[],
{},
CWD,
[80, 24],
(err, exitCode) => {
expect(err).toBeNull();
expect(exitCode).toBe(0);
done();
}
);
test("respects working directory", (done) => {
const pty = new Pty("/bin/pwd", [], {}, CWD, [80, 24], (err, exitCode) => {
expect(err).toBeNull();
expect(exitCode).toBe(0);
done();
});

const readStream = fs.createReadStream("", { fd: pty.fd });

Expand All @@ -112,7 +105,7 @@ describe("PTY", () => {

const pty = new Pty(
"/bin/sh",
["-c", "echo $ENV_VARIABLE; exit"],
["-c", "sleep 0.1s && echo $ENV_VARIABLE; exit"],
{
ENV_VARIABLE: message,
},
Expand All @@ -122,8 +115,9 @@ describe("PTY", () => {
expect(err).toBeNull();
expect(exitCode).toBe(0);
expect(buffer).toBe(message + "\r\n");

done();
}
},
);

const readStream = fs.createReadStream("", { fd: pty.fd });
Expand Down
3 changes: 3 additions & 0 deletions replit.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ pkgs }: {
deps = [];
}

0 comments on commit 31967b7

Please sign in to comment.