Skip to content

Commit

Permalink
chore: update npm test loader
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperchupuDev authored Oct 16, 2024
1 parent bb7a304 commit a9a7f71
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions test/test-79-npm/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const UPM = process.env.USE_PREINSTALLED_MODULES || false; // USE_PREINSTALLED_M
const fs = require('fs');
const path = require('path');
const assert = require('assert');
const globby = require('globby');
const { globSync } = require('tinyglobby');
const utils = require('../utils.js');

assert(!module.parent);
Expand Down Expand Up @@ -126,19 +126,12 @@ if (!UPM) {
})();

// note to developpers:
// you can set the env variable FILTER to something like "better-sqlite3/*.js"
// you can set the env variable FILTER to something like "better-sqlite3/*.js"
// to restrict this test to this single test case
const inputs = globby
.sync([
process.env.FILTER || './*/*.js',
'!./*/*.config.js',
'!./*/*.meta.js',
'!./*/gulpfile.js',
'!./*/*fixture*',
])
.map(function (result) {
return path.resolve(result);
});
const inputs = globSync([process.env.FILTER || '*/*.js'], {
absolute: true,
ignore: ['*/*.config.js', '*/*.meta.js', '*/gulpfile.js', '*/*fixture*'],
});

let times = {};
const ci = process.env.CI;
Expand Down Expand Up @@ -308,14 +301,14 @@ inputs.some(function (input) {
const deployFiles = [];

if (!meta.deployFiles && !meta.deployFilesFrom) {
globby
.sync(path.join(foldy, 'node_modules', '**', '*.node'))
.some(function (deployFrom) {
globSync(path.join(foldy, 'node_modules', '**', '*.node')).some(
function (deployFrom) {
deployFiles.push([
deployFrom,
path.join(path.dirname(output), path.basename(deployFrom)),
]);
});
},
);
}

const deployFilesRelative = [];
Expand Down Expand Up @@ -361,9 +354,8 @@ inputs.some(function (input) {
if (statFrom.isFile()) {
deployFiles.push([deployFrom, deployTo]);
} else {
globby
.sync(path.join(deployFrom, '**', '*'))
.some(function (deployFrom2) {
globSync(path.join(deployFrom, '**', '*')).some(
function (deployFrom2) {
const r = path.relative(deployFrom, deployFrom2);
const deployTo2 = path.join(deployTo, r);
if (fs.existsSync(deployFrom2)) {
Expand All @@ -372,7 +364,8 @@ inputs.some(function (input) {
deployFiles.push([deployFrom2, deployTo2]);
}
}
});
},
);
}
}
});
Expand Down Expand Up @@ -410,7 +403,7 @@ inputs.some(function (input) {
}
}

const rubbishes = globby.sync(path.join(path.dirname(output), '**', '*'));
const rubbishes = globSync(path.join(path.dirname(output), '**', '*'));

rubbishes.some(function (rubbish) {
utils.vacuum.sync(rubbish);
Expand Down

0 comments on commit a9a7f71

Please sign in to comment.