dougmoscrop / serverless-plugin-include-dependencies

MIT License
184 stars 40 forks source link

Feature/fix dependencies #99

Open phoenix741 opened 3 months ago

phoenix741 commented 3 months ago

I propose this PR to fix #98.

There is two modification :

phoenix741 commented 3 months ago

My modification will break this TU:


test('enables caching', t => {
  const instance = createTestInstance({ 
    serverless: {
      service: { custom: { includeDependencies: { enableCaching: true } } }
    }
  });
  const cacheEnabled = instance.cacheEnabled;
  t.true(cacheEnabled);
  const file = path.join(__dirname, 'fixtures', 'thing.js');
  const list1 = instance.getDependencies(file, [], cacheEnabled);
  const list2 = instance.getDependencies(file, [], cacheEnabled);

  console.log(list1);
  console.log(list2);
  t.true(list2.length < list1.length);
});

I'm not sur why because we read two time the same file, and the test thing to have two different result, but with the global cache, i have always the same result.