Skip to content

Commit 885047a

Browse files
committed
test: workaround npm cleanup for ng add tailwind E2E
Add an explicit removal of previous `tailwindcss` at the start of the `commands/add/add-tailwindcss.ts` E2E test to workaround issues with npm not fully uninstalling the package from previous tests.
1 parent 301b50d commit 885047a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/legacy-cli/e2e/tests/commands/add/add-tailwindcss.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
import { expectFileToExist, expectFileToMatch } from '../../../utils/fs';
2-
import { uninstallPackage } from '../../../utils/packages';
1+
import { expectFileToExist, expectFileToMatch, rimraf } from '../../../utils/fs';
2+
import { getActivePackageManager, uninstallPackage } from '../../../utils/packages';
33
import { ng } from '../../../utils/process';
44

55
export default async function () {
6+
// In case a previous test installed tailwindcss, clear it.
7+
// (we don't clear node module directories between tests)
8+
// npm does not appear to fully uninstall sometimes
9+
if (getActivePackageManager() === 'npm') {
10+
await rimraf('node_modules/tailwindcss');
11+
}
12+
613
try {
714
await ng('add', 'tailwindcss', '--skip-confirmation');
815
await expectFileToExist('.postcssrc.json');

0 commit comments

Comments
 (0)