Skip to content

Node.js based forum software built for the modern web

fix: use fs.promises

Julian Lama0a38706111e
diff --git a/test/package-install.js b/test/package-install.js
index 34d256c9f4..630e2932e6 100644
--- a/test/package-install.js
+++ b/test/package-install.js
@@ -2,12 +2,12 @@
const { execSync } = require('child_process');
const path = require('path');
-const { readFileSync } = require('fs');
+const { readFile } = require('fs').promises;
const assert = require('assert');
describe('Package install', () => {
- it('should remove non-`nodebb-` modules not specified in `install/package.json`', () => {
+ it('should remove non-`nodebb-` modules not specified in `install/package.json`', async () => {
const oldValue = process.env.NODE_ENV;
process.env.NODE_ENV = 'development';
const packageFilePath = path.join(__dirname, '../package.json');
@@ -18,15 +18,17 @@ describe('Package install', () => {
execSync('npm install dotenv --save');
// assert it saves in package.json
- const packageWithExtras = JSON.parse(readFileSync(packageFilePath, 'utf8'));
+ const packageWithExtras = JSON.parse(await readFile(packageFilePath, 'utf8'));
assert(packageWithExtras.dependencies.dotenv, 'dependency did not save');
// update the package file
require('../src/cli/package-install').updatePackageFile();
// assert it removed the extra package
- const packageCleaned = JSON.parse(readFileSync(packageFilePath, 'utf8'));
+ const packageCleaned = JSON.parse(await readFile(packageFilePath, 'utf8'));
assert(!packageCleaned.dependencies.dotenv, 'dependency was not removed');
process.env.NODE_ENV = oldValue;
});
+
+ // it('should ')
});