fix(linter): ensure tslint converter works with pnp (#18323)
This commit is contained in:
parent
eb392109f7
commit
f4b7ec2c0d
@ -14,7 +14,17 @@ import { conversionGenerator } from './convert-tslint-to-eslint';
|
||||
/**
|
||||
* Don't run actual child_process implementation of installPackagesTask()
|
||||
*/
|
||||
jest.mock('child_process');
|
||||
jest.mock('child_process', () => {
|
||||
return {
|
||||
...jest.requireActual<any>('child_process'),
|
||||
execSync: jest.fn((command: string) => {
|
||||
if (command.includes('pnpm --version')) {
|
||||
return '8.2.0';
|
||||
}
|
||||
return;
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
const appProjectName = 'angular-app-1';
|
||||
const appProjectRoot = `apps/${appProjectName}`;
|
||||
|
||||
@ -13,7 +13,17 @@ import { conversionGenerator } from './convert-tslint-to-eslint';
|
||||
/**
|
||||
* Don't run actual child_process implementation of installPackagesTask()
|
||||
*/
|
||||
jest.mock('child_process');
|
||||
jest.mock('child_process', () => {
|
||||
return {
|
||||
...jest.requireActual<any>('child_process'),
|
||||
execSync: jest.fn((command: string) => {
|
||||
if (command.includes('pnpm --version')) {
|
||||
return '8.2.0';
|
||||
}
|
||||
return;
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
const projectName = 'e2e-app-1';
|
||||
const projectRoot = `apps/${projectName}`;
|
||||
|
||||
@ -103,8 +103,9 @@ export async function convertToESLintConfig(
|
||||
*/
|
||||
writeJsonFile(pathToTslintJson, updatedTSLintJson);
|
||||
}
|
||||
const pm = getPackageManagerCommand();
|
||||
const reportedConfiguration = await findReportedConfiguration(
|
||||
'npx tslint --print-config',
|
||||
`${pm.exec} tslint --print-config`,
|
||||
pathToTslintJson
|
||||
);
|
||||
|
||||
@ -121,8 +122,7 @@ export async function convertToESLintConfig(
|
||||
* This error could occur if, for example, the user does not have a TSLint plugin installed correctly that they
|
||||
* reference in their config.
|
||||
*/
|
||||
const printConfigFailureMessageStart =
|
||||
'Command failed: npx tslint --print-config "tslint.json"';
|
||||
const printConfigFailureMessageStart = `Command failed: ${pm.exec} tslint --print-config "tslint.json"`;
|
||||
if (
|
||||
reportedConfiguration.message.startsWith(printConfigFailureMessageStart)
|
||||
) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user