Mariusz Nowak b8d386547f test(Plugins): Ensure to not leave broken symlinks in a setup fixture
Otherwise it leaves a broken symlink of which copying crashes `fse.copy`
2021-11-17 09:07:28 +01:00

15 lines
529 B
JavaScript

'use strict';
const path = require('path');
const fsp = require('fs').promises;
const nodeModulesDir = path.resolve(__dirname, 'node_modules');
// Ensure to remove "serverless" installed as peer-dependency to avoid local fallback
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(() => {}),
]);