Skip to content

Commit

Permalink
update filtersRegistry, generator, integration.test
Browse files Browse the repository at this point in the history
add await
  • Loading branch information
lmgyuan committed May 22, 2024
1 parent a23636a commit 55f9ae7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/filtersRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { isAsyncFunction } = require('./utils');
*/
module.exports.registerFilters = async (nunjucks, templateConfig, templateDir, filtersDir) => {
await registerLocalFilters(nunjucks, templateDir, filtersDir);
registerConfigFilters(nunjucks, templateDir, templateConfig);
await registerConfigFilters(nunjucks, templateDir, templateConfig);
};

/**
Expand All @@ -22,7 +22,7 @@ module.exports.registerFilters = async (nunjucks, templateConfig, templateDir, f
* @param {String} templateDir Directory where template is located.
* @param {String} filtersDir Directory where local filters are located.
*/
function registerLocalFilters(nunjucks, templateDir, filtersDir) {
async function registerLocalFilters(nunjucks, templateDir, filtersDir) {
return new Promise((resolve, reject) => {
const localFilters = path.resolve(templateDir, filtersDir);

Expand Down
1 change: 1 addition & 0 deletions lib/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const log = require('loglevel');
const Arborist = require('@npmcli/arborist');
const Config = require('@npmcli/config');
const requireg = require('requireg');
console.log("requireg.resolve('npm'): ", requireg.resolve('npm'));
const npmPath = requireg.resolve('npm').replace('index.js','');

const { isAsyncAPIDocument } = require('@asyncapi/parser/cjs/document');
Expand Down
10 changes: 5 additions & 5 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ describe('Integration testing generateFromFile() to make sure the result of the
// Check if the log debug message was printed
await expect(log.debug).toHaveBeenCalledWith(`noOverwriteGlobs matched`);
await expect(log.debug).toHaveBeenCalledWith(`Skipping overwrite for: ${testFilePath}`);
console.log('All console.log calls:');
// await console.log('All console.log calls:');

// Print all console.log calls
await log.mock.calls.forEach((call, index) => {
console.log(`${index + 1}:`, call);
});
// // Print all console.log calls
// await log.mock.calls.forEach((call, index) => {
// console.log(`${index + 1}:`, call);
// });

log.mockRestore();
});
Expand Down

0 comments on commit 55f9ae7

Please sign in to comment.