Skip to content

Commit

Permalink
fixup: fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
geeksilva97 committed Jan 12, 2025
1 parent 01ee4c0 commit bd43083
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
19 changes: 8 additions & 11 deletions src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class BackupJob : public ThreadPoolWork {
Local<Object> e = Local<Object>();

if (backup_status_ != SQLITE_OK) {
CreateSQLiteError(isolate, pDest_).ToLocal(&e);
e = CreateSQLiteError(isolate, pDest_).ToLocalChecked();

Cleanup();

Expand All @@ -195,7 +195,7 @@ class BackupJob : public ThreadPoolWork {
pDest_, dest_db_.c_str(), source_->Connection(), source_db_.c_str());

if (pBackup_ == nullptr) {
CreateSQLiteError(isolate, pDest_).ToLocal(&e);
e = CreateSQLiteError(isolate, pDest_).ToLocalChecked();

sqlite3_close(pDest_);

Expand All @@ -209,8 +209,6 @@ class BackupJob : public ThreadPoolWork {

void DoThreadPoolWork() override {
backup_status_ = sqlite3_backup_step(pBackup_, pages_);

const char* errstr = sqlite3_errstr(backup_status_);
}

void AfterThreadPoolWork(int status) override {
Expand All @@ -227,9 +225,8 @@ class BackupJob : public ThreadPoolWork {

if (!(backup_status_ == SQLITE_OK || backup_status_ == SQLITE_DONE ||
backup_status_ == SQLITE_BUSY || backup_status_ == SQLITE_LOCKED)) {
Local<Object> e = Local<Object>();

CreateSQLiteError(env()->isolate(), backup_status_).ToLocal(&e);
Local<Object> e =
CreateSQLiteError(env()->isolate(), backup_status_).ToLocalChecked();

Cleanup();

Expand Down Expand Up @@ -275,8 +272,8 @@ class BackupJob : public ThreadPoolWork {
env()->isolate(), "Backup completed", NewStringType::kNormal)
.ToLocalChecked();

Local<Object> e = Local<Object>();
CreateSQLiteError(env()->isolate(), pDest_).ToLocal(&e);
Local<Object> e =
CreateSQLiteError(env()->isolate(), pDest_).ToLocalChecked();

Cleanup();

Expand Down Expand Up @@ -826,8 +823,8 @@ void DatabaseSync::Backup(const FunctionCallbackInfo<Value>& args) {
}

Local<Promise::Resolver> resolver = Promise::Resolver::New(env->context())
.ToLocalChecked()
.As<Promise::Resolver>();
.ToLocalChecked()
.As<Promise::Resolver>();

args.GetReturnValue().Set(resolver->GetPromise());

Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-sqlite-backup.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import common from '../common/index.js';
import * as common from '../common/index.mjs';

Check failure on line 1 in test/parallel/test-sqlite-backup.mjs

View workflow job for this annotation

GitHub Actions / test-linux

--- stderr --- (node:174760) ExperimentalWarning: SQLite is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) --- stdout --- ::debug::starting to run throws exception when trying to start backup from a closed database ::debug::completed running throws exception when trying to start backup from a closed database ::debug::starting to run database backup ::debug::completed running database backup ::debug::starting to run database backup fails when dest file is not writable ::debug::completed running database backup fails when dest file is not writable ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::tests 3 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::suites 0 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::pass 3 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::fail 0 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::cancelled 0 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::skipped 0 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::todo 0 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::duration_ms 119.513746 ::group::Test results (3 passed, 0 failed) ::notice:: ::endgroup:: Command: out/Release/node --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout --test-reporter=./tools/github_reporter/index.js --test-reporter-destination=stdout /home/runner/work/node/node/node/test/parallel/test-sqlite-backup.mjs --- CRASHED (Signal: 11) ---

Check failure on line 1 in test/parallel/test-sqlite-backup.mjs

View workflow job for this annotation

GitHub Actions / test-macOS (macos-14)

--- stderr --- (node:87287) ExperimentalWarning: SQLite is an experimental feature and might change at any time (Use `node --trace-warnings ...` to show where the warning was created) --- stdout --- ::debug::starting to run throws exception when trying to start backup from a closed database ::debug::completed running throws exception when trying to start backup from a closed database ::debug::starting to run database backup ::debug::completed running database backup ::debug::starting to run database backup fails when dest file is not writable ::debug::completed running database backup fails when dest file is not writable ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::tests 3 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::suites 0 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::pass 3 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::fail 0 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::cancelled 0 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::skipped 0 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::todo 0 ::notice file=node/test/parallel/test-sqlite-backup.mjs,line=1,col=1::duration_ms 53.601708 ::group::Test results (3 passed, 0 failed) ::notice:: ::endgroup:: Command: out/Release/node --test-reporter=./test/common/test-error-reporter.js --test-reporter-destination=stdout --test-reporter=./tools/github_reporter/index.js --test-reporter-destination=stdout /Users/runner/work/node/node/node/test/parallel/test-sqlite-backup.mjs --- CRASHED (Signal: 11) ---
import tmpdir from '../common/tmpdir.js';
import { join } from 'path';
import { DatabaseSync } from 'node:sqlite';
Expand Down Expand Up @@ -58,7 +58,8 @@ test('database backup', async (t) => {
const backup = new DatabaseSync(destDb);
const rows = backup.prepare('SELECT * FROM data').all();

// The source database has two pages - using the default page size -, so the progress function should be called once (the last call is not made since
// The source database has two pages - using the default page size -,
// so the progress function should be called once (the last call is not made since
// the promise resolves)
t.assert.strictEqual(progressFn.mock.calls.length, 1);
t.assert.deepStrictEqual(rows, [
Expand All @@ -80,4 +81,3 @@ test('database backup fails when dest file is not writable', (t) => {
message: 'attempt to write a readonly database'
}));
});

0 comments on commit bd43083

Please sign in to comment.