mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-09 17:36:15 -08:00
fix(nx): validate duplicate root declarations
This commit is contained in:
1 parent
8742089ad5
commit
4798a27f37
2 files changed
+25
-1
No files matched your search
@@ -31,7 +31,7 @@ export function validateNxVersionSync({ packageJson, lockfile }) {
|
||||
const section = packageJson[sectionName] ?? {};
|
||||
for (const [packageName, specifier] of Object.entries(section)) {
|
||||
if (
|
||||
packageName.startsWith('@nx/') &&
|
||||
(packageName === 'nx' || packageName.startsWith('@nx/')) &&
|
||||
specifier !== expectedVersion
|
||||
) {
|
||||
diagnostics.push(
|
||||
|
||||
@@ -110,6 +110,30 @@ test('rejects a direct official Nx peer dependency mismatch', async (t) => {
|
||||
);
|
||||
});
|
||||
|
||||
test('rejects an extra direct Nx declaration mismatch', async (t) => {
|
||||
const rootDir = await createFixture(t, {
|
||||
packageJson: {
|
||||
devDependencies: {
|
||||
nx: '22.7.2',
|
||||
},
|
||||
optionalDependencies: {
|
||||
nx: '22.7.1',
|
||||
},
|
||||
},
|
||||
packages: {
|
||||
'nx@22.7.2': {},
|
||||
},
|
||||
});
|
||||
|
||||
const result = runValidator(rootDir);
|
||||
|
||||
assert.equal(result.status, 1);
|
||||
assert.match(
|
||||
result.stderr,
|
||||
/optionalDependencies\["nx"\] must match nx@22\.7\.2, found "22\.7\.1"/
|
||||
);
|
||||
});
|
||||
|
||||
test('rejects a non-exact root Nx version', async (t) => {
|
||||
const rootDir = await createFixture(t, {
|
||||
packageJson: {
|
||||
|
||||
Reference in new issue
Block a user