Skip to content

Commit

Permalink
test(Plugins): Ensure to not leave broken symlinks in a setup fixture
Browse files Browse the repository at this point in the history
Otherwise it leaves a broken symlink of which copying crashes `fse.copy`
  • Loading branch information
medikoo committed Nov 17, 2021
1 parent eca599d commit b8d3865
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/fixtures/programmatic/curated-plugins/_setup.js
Expand Up @@ -3,7 +3,12 @@
const path = require('path');
const fsp = require('fs').promises;

const slsDependencyDir = path.resolve(__dirname, 'node_modules/serverless');
const nodeModulesDir = path.resolve(__dirname, 'node_modules');

// Ensure to remove "serverless" installed as peer-dependency to avoid local fallback
module.exports = async () => fsp.rm(slsDependencyDir, { recursive: true, force: true });
module.exports = async () =>
Promise.all([
fsp.rm(path.resolve(nodeModulesDir, 'serverless'), { recursive: true, force: true }),
fsp.unlink(path.resolve(nodeModulesDir, '.bin/serverless')).catch(() => {}),
fsp.unlink(path.resolve(nodeModulesDir, '.bin/sls')).catch(() => {}),
]);

0 comments on commit b8d3865

Please sign in to comment.