Skip to content

Commit

Permalink
Add nodejs tests to CI
Browse files Browse the repository at this point in the history
These tests exist, but don't currently run on CI. To avoid regressions, this adds a job to run them on CI. Note these do not use make to run them as many of the other tests do.

This also fixes the regression in the tests caused by #3014.
  • Loading branch information
cameron-martin committed Jan 6, 2025
1 parent 645467e commit 44c3f26
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,27 @@ jobs:
- name: Run make check for python
run: make -C lib/py check

lib-nodejs:
needs: compiler
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Run bootstrap
run: ./bootstrap.sh

- name: Run configure
run: |
./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-nodejs/with-nodejs/')
- uses: actions/download-artifact@v4
with:
name: thrift-compiler
path: compiler/cpp

- name: Run tests
run: ./lib/nodejs/test/testAll.sh

cross-test:
needs:
- lib-java-kotlin
Expand Down
4 changes: 2 additions & 2 deletions lib/nodejs/lib/thrift/thrift.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function TApplicationException(type, message) {
};
util.inherits(TApplicationException, TException);

TApplicationException.prototype.read = function(input) {
TApplicationException.prototype[Symbol.for("read")] = TApplicationException.prototype.read = function(input) {
var ftype;
var ret = input.readStructBegin('TApplicationException');

Expand Down Expand Up @@ -121,7 +121,7 @@ TApplicationException.prototype.read = function(input) {
input.readStructEnd();
};

TApplicationException.prototype.write = function(output){
TApplicationException.prototype[Symbol.for("write")] = TApplicationException.prototype.write = function(output){
output.writeStructBegin('TApplicationException');

if (this.message) {
Expand Down
8 changes: 4 additions & 4 deletions lib/nodejs/test/deep-constructor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function serializeBinary(data) {
buff = msg;
});
const prot = new thrift.TBinaryProtocol(transport);
data.write(prot);
data[Symbol.for("write")](prot);
prot.flush();
return buff;
}
Expand All @@ -37,7 +37,7 @@ function deserializeBinary(serialized, type) {
const t = new thrift.TFramedTransport(serialized);
const p = new thrift.TBinaryProtocol(t);
const data = new type();
data.read(p);
data[Symbol.for("read")](p);
return data;
}

Expand All @@ -48,7 +48,7 @@ function serializeJSON(data) {
});
const protocol = new thrift.TJSONProtocol(transport);
protocol.writeMessageBegin("", 0, 0);
data.write(protocol);
data[Symbol.for("write")](protocol);
protocol.writeMessageEnd();
protocol.flush();
return buff;
Expand All @@ -59,7 +59,7 @@ function deserializeJSON(serialized, type) {
const protocol = new thrift.TJSONProtocol(transport);
protocol.readMessageBegin();
const data = new type();
data.read(protocol);
data[Symbol.for("read")](protocol);
protocol.readMessageEnd();
return data;
}
Expand Down

0 comments on commit 44c3f26

Please sign in to comment.