index.js 440 B

123456789101112131415161718
  1. const fs = require('fs');
  2. const path = require('path');
  3. function kv(f) {
  4. return `require('./tests/${f}')`;
  5. }
  6. module.exports = function() {
  7. const files = fs
  8. .readdirSync(path.join(__dirname, 'tests'))
  9. .filter(p => /\.js$/.test(p));
  10. const code = "require('fast-text-encoding');\n" + files.map(kv).join(';\n');
  11. return {
  12. code,
  13. dependencies: files.map(f => require.resolve('./tests/' + f)),
  14. cacheable: true
  15. };
  16. };