Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15,541 changes: 15,504 additions & 37 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"@commitlint/travis-cli": "^16.2.4",
"@types/async": "^3.2.13",
"@types/bl": "^5.0.2",
"@types/chai": "^4.3.1",
"@types/depd": "^1.1.32",
"@types/lru-cache": "^5.1.0",
"@types/mocha": "^9.1.1",
Expand Down
18 changes: 9 additions & 9 deletions test/integration/bulk-load-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('BulkLoad', function() {
it('fails if the column definition does not match the target table format', function(done) {
const bulkLoad = connection.newBulkLoad('#tmpTestTable2', (err, rowCount) => {
assert.instanceOf(err, RequestError, 'An error should have been thrown to indicate the incorrect table format.');
assert.strictEqual(/** @type {RequestError} */(err).message, 'An unknown error has occurred. This is likely because the schema of the BulkLoad does not match the schema of the table you are attempting to insert into.');
assert.strictEqual(err.message, 'An unknown error has occurred. This is likely because the schema of the BulkLoad does not match the schema of the table you are attempting to insert into.');

assert.isUndefined(rowCount);

Expand Down Expand Up @@ -376,7 +376,7 @@ describe('BulkLoad', function() {
].join(' ');

assert.instanceOf(err, RequestError);
assert.strictEqual(/** @type {RequestError} */(err).message, expectedMessage);
assert.strictEqual(err.message, expectedMessage);

assert.strictEqual(rowCount, 0);

Expand Down Expand Up @@ -486,7 +486,7 @@ describe('BulkLoad', function() {
it('does not insert any rows if `cancel` is called immediately after executing the bulk load', function(done) {
const bulkLoad = connection.newBulkLoad('#tmpTestTable5', { keepNulls: true }, (err, rowCount) => {
assert.instanceOf(err, RequestError);
assert.strictEqual(/** @type {RequestError} */(err).message, 'Canceled.');
assert.strictEqual(err.message, 'Canceled.');

assert.isUndefined(rowCount);

Expand Down Expand Up @@ -1154,7 +1154,7 @@ describe('BulkLoad', function() {
*/
function completeBulkLoad(err, rowCount) {
assert.instanceOf(err, RequestError);
assert.strictEqual(/** @type {RequestError} */(err).message, 'Canceled.');
assert.strictEqual(err.message, 'Canceled.');

assert.strictEqual(rowCount, 0);
startVerifyTableContent();
Expand Down Expand Up @@ -1199,7 +1199,7 @@ describe('BulkLoad', function() {

const bulkLoad = connection.newBulkLoad('#stream_test', (err, rowCount) => {
assert.instanceOf(err, RequestError);
assert.strictEqual(/** @type {RequestError} */(err).message, 'Canceled.');
assert.strictEqual(err.message, 'Canceled.');

assert.strictEqual(rowCount, 0);
});
Expand Down Expand Up @@ -1238,7 +1238,7 @@ describe('BulkLoad', function() {
it('cancels any bulk load that takes longer than the given timeout', function(done) {
const bulkLoad = connection.newBulkLoad('#tmpTestTable5', { keepNulls: true }, (err, rowCount) => {
assert.instanceOf(err, RequestError);
assert.strictEqual(/** @type {RequestError} */(err).message, 'Timeout: Request failed to complete in 10ms');
assert.strictEqual(err.message, 'Timeout: Request failed to complete in 10ms');

done();
});
Expand Down Expand Up @@ -1339,7 +1339,7 @@ describe('BulkLoad', function() {
*/
function completeBulkLoad(err, rowCount) {
assert.instanceOf(err, RequestError);
assert.strictEqual(/** @type {RequestError} */(err).message, 'Timeout: Request failed to complete in 200ms');
assert.strictEqual(err.message, 'Timeout: Request failed to complete in 200ms');

assert.strictEqual(rowCount, 0);

Expand Down Expand Up @@ -1526,7 +1526,7 @@ describe('BulkLoad', function() {
*/
function completeBulkLoad(err, rowCount) {
assert.instanceOf(err, TypeError);
assert.strictEqual(/** @type {TypeError} */(err).message, 'Invalid date.');
assert.strictEqual(err.message, 'Invalid date.');

done();
}
Expand All @@ -1546,7 +1546,7 @@ describe('BulkLoad', function() {
*/
function completeBulkLoad(err, rowCount) {
assert.instanceOf(err, TypeError);
assert.strictEqual(/** @type {TypeError} */(err).message, 'Invalid date.');
assert.strictEqual(err.message, 'Invalid date.');

assert.strictEqual(rowCount, 0);

Expand Down
15 changes: 8 additions & 7 deletions test/integration/connection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ describe('Initiate Connect Test', function() {
const connection = new Connection(config);
connection.connect(function(err) {
assert.instanceOf(err, ConnectionError);
assert.strictEqual(/** @type {ConnectionError} */(err).code, 'ESOCKET');
assert.strictEqual(err.code, 'ESOCKET');
});

connection.on('end', function() {
Expand Down Expand Up @@ -385,7 +385,7 @@ describe('Initiate Connect Test', function() {
conn.close();

assert.instanceOf(err, Error);
assert.strictEqual(/** @type {Error} */(err).message, 'Failed to connect to 192.0.2.1:1433 in 3000ms');
assert.strictEqual(err.message, 'Failed to connect to 192.0.2.1:1433 in 3000ms');

done();
});
Expand Down Expand Up @@ -867,7 +867,7 @@ describe('Insertion Tests', function() {

const request = new Request('select 8 as C1', function(err, rowCount) {
assert.instanceOf(err, RequestError);
assert.strictEqual(/** @type {RequestError} */(err).code, 'ECLOSE');
assert.strictEqual(err.code, 'ECLOSE');
});

const connection = new Connection(config);
Expand Down Expand Up @@ -1202,7 +1202,7 @@ describe('Insertion Tests', function() {

const request = new Request("select 1 as C1; waitfor delay '00:00:05'; select 2 as C2", (err, rowCount, rows) => {
assert.instanceOf(err, Error);
assert.strictEqual(/** @type {Error} */(err).message, 'Canceled.');
assert.strictEqual(err.message, 'Canceled.');

assert.isUndefined(rowCount);

Expand Down Expand Up @@ -1274,7 +1274,8 @@ describe('Insertion Tests', function() {
const request = new Request(
"select 1 as C1;waitfor delay '00:00:05';select 2 as C2",
function(err, rowCount, rows) {
assert.equal(/** @type {Error} */(err).message, 'Timeout: Request failed to complete in 1000ms');
assert.instanceOf(err, RequestError);
assert.equal(err.message, 'Timeout: Request failed to complete in 1000ms');

connection.close();
}
Expand Down Expand Up @@ -1369,9 +1370,9 @@ describe('Advanced Input Test', function() {
const config = getConfig();
config.options.enableAnsiNullDefault = false;

runSqlBatch(done, config, sql, function(/** @type {Error | null | undefined} */err) {
runSqlBatch(done, config, sql, function(err) {
assert.instanceOf(err, RequestError);
assert.strictEqual(/** @type {RequestError} */(err).number, 515);
assert.strictEqual(err.number, 515);
}); // Cannot insert the value NULL
});
});
Expand Down
32 changes: 14 additions & 18 deletions test/integration/errors-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ describe('Errors Test', function() {
`;

execSql(done, sql, function(err) {
assert.ok(err instanceof RequestError);
assert.strictEqual(/** @type {RequestError} */(err).number, 2627);
assert.instanceOf(err, RequestError);
assert.strictEqual(err.number, 2627);
});
});

Expand All @@ -83,8 +83,8 @@ describe('Errors Test', function() {
`;

execSql(done, sql, function(err) {
assert.ok(err instanceof RequestError);
assert.strictEqual(/** @type {RequestError} */(err).number, 515);
assert.instanceOf(err, RequestError);
assert.strictEqual(err.number, 515);
});
});

Expand All @@ -94,8 +94,8 @@ describe('Errors Test', function() {
';

execSql(done, sql, function(err) {
assert.ok(err instanceof RequestError);
assert.strictEqual(/** @type {RequestError} */(err).number, 3701);
assert.instanceOf(err, RequestError);
assert.strictEqual(err.number, 3701);
});
});

Expand All @@ -108,24 +108,20 @@ describe('Errors Test', function() {
const connection = new Connection(config);

const execProc = new Request('#testExtendedErrorInfo', function(err) {
if (!err) {
assert.fail('Expected `err` to not be undefined');
}

const requestError = /** @type {RequestError} */(err);
assert.instanceOf(err, RequestError);

assert.strictEqual(requestError.number, 50000);
assert.strictEqual(requestError.state, 42);
assert.strictEqual(requestError.class, 14);
assert.strictEqual(err.number, 50000);
assert.strictEqual(err.state, 42);
assert.strictEqual(err.class, 14);

assert.exists(requestError.serverName);
assert.exists(requestError.procName);
assert.exists(err.serverName);
assert.exists(err.procName);

// The procedure name will actually be padded to 128 chars with underscores and
// some random hexadecimal digits.
assert.match(/** @type {string} */(requestError.procName), /^#testExtendedErrorInfo/);
assert.match(err.procName, /^#testExtendedErrorInfo/);

assert.strictEqual(requestError.lineNumber, 1);
assert.strictEqual(err.lineNumber, 1);

connection.close();
});
Expand Down
2 changes: 1 addition & 1 deletion test/integration/invalid-packet-stream-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Connecting to a server that sends invalid packet data', function() {

connection.connect((err) => {
assert.instanceOf(err, ConnectionError);
assert.equal(/** @type {ConnectionError} */(err).message, 'Connection lost - Unable to process incoming packet');
assert.equal(err.message, 'Connection lost - Unable to process incoming packet');

done();
});
Expand Down
2 changes: 1 addition & 1 deletion test/integration/pause-resume-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('Pause-Resume Test', function() {

const request = new Request(sql, (error) => {
assert.instanceOf(error, RequestError);
assert.strictEqual(/** @type {RequestError} */(error).code, 'ECANCEL');
assert.strictEqual(error.code, 'ECANCEL');

next();
});
Expand Down
Loading