Skip to content

Commit 4fca416

Browse files
THRIFT-5564: Add nodejs tests to github actions
These tests exist, but don't currently run on github actions. This adds a new job to run these. This also fixes the regression in the tests caused by #3014.
1 parent 645467e commit 4fca416

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,32 @@ jobs:
519519
- name: Run make check for python
520520
run: make -C lib/py check
521521

522+
lib-nodejs:
523+
needs: compiler
524+
runs-on: ubuntu-24.04
525+
steps:
526+
- uses: actions/checkout@v4
527+
528+
- name: Run bootstrap
529+
run: ./bootstrap.sh
530+
531+
- name: Run configure
532+
run: |
533+
./configure $(echo $CONFIG_ARGS_FOR_LIBS | sed 's/without-nodejs/with-nodejs/')
534+
535+
- uses: actions/download-artifact@v4
536+
with:
537+
name: thrift-compiler
538+
path: compiler/cpp
539+
540+
- name: Run thrift-compiler
541+
run: |
542+
chmod a+x compiler/cpp/thrift
543+
compiler/cpp/thrift -version
544+
545+
- name: Run tests
546+
run: make -C lib/nodejs check
547+
522548
cross-test:
523549
needs:
524550
- lib-java-kotlin

lib/nodejs/lib/thrift/thrift.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function TApplicationException(type, message) {
8686
};
8787
util.inherits(TApplicationException, TException);
8888

89-
TApplicationException.prototype.read = function(input) {
89+
TApplicationException.prototype[Symbol.for("read")] = TApplicationException.prototype.read = function(input) {
9090
var ftype;
9191
var ret = input.readStructBegin('TApplicationException');
9292

@@ -121,7 +121,7 @@ TApplicationException.prototype.read = function(input) {
121121
input.readStructEnd();
122122
};
123123

124-
TApplicationException.prototype.write = function(output){
124+
TApplicationException.prototype[Symbol.for("write")] = TApplicationException.prototype.write = function(output){
125125
output.writeStructBegin('TApplicationException');
126126

127127
if (this.message) {

lib/nodejs/test/deep-constructor.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function serializeBinary(data) {
2828
buff = msg;
2929
});
3030
const prot = new thrift.TBinaryProtocol(transport);
31-
data.write(prot);
31+
data[Symbol.for("write")](prot);
3232
prot.flush();
3333
return buff;
3434
}
@@ -37,7 +37,7 @@ function deserializeBinary(serialized, type) {
3737
const t = new thrift.TFramedTransport(serialized);
3838
const p = new thrift.TBinaryProtocol(t);
3939
const data = new type();
40-
data.read(p);
40+
data[Symbol.for("read")](p);
4141
return data;
4242
}
4343

@@ -48,7 +48,7 @@ function serializeJSON(data) {
4848
});
4949
const protocol = new thrift.TJSONProtocol(transport);
5050
protocol.writeMessageBegin("", 0, 0);
51-
data.write(protocol);
51+
data[Symbol.for("write")](protocol);
5252
protocol.writeMessageEnd();
5353
protocol.flush();
5454
return buff;
@@ -59,7 +59,7 @@ function deserializeJSON(serialized, type) {
5959
const protocol = new thrift.TJSONProtocol(transport);
6060
protocol.readMessageBegin();
6161
const data = new type();
62-
data.read(protocol);
62+
data[Symbol.for("read")](protocol);
6363
protocol.readMessageEnd();
6464
return data;
6565
}

0 commit comments

Comments
 (0)