|
31 | 31 |
|
32 | 32 | import net.jcip.annotations.NotThreadSafe; |
33 | 33 | import org.apache.commons.io.FileUtils; |
| 34 | +import org.junit.Assert; |
34 | 35 | import org.junit.jupiter.api.BeforeEach; |
35 | 36 | import org.junit.jupiter.api.Test; |
36 | 37 | import org.junit.jupiter.api.io.TempDir; |
@@ -1589,6 +1590,72 @@ void pnpmIsInUse_pwaOfflineDisabledAfterEnabled_flattenedOverridesRemoved() |
1589 | 1590 | } |
1590 | 1591 | } |
1591 | 1592 |
|
| 1593 | + /** |
| 1594 | + * This tests that other systems generate the same hash as we get for a |
| 1595 | + * Windows machine. There was an issue in the jackson indenter that used |
| 1596 | + * different line separators on windows (\r\n) and linux (\n). |
| 1597 | + */ |
| 1598 | + @Test |
| 1599 | + void windowsHashedPackageJson_otherSystemsGetSameHash() { |
| 1600 | + var json = """ |
| 1601 | + { |
| 1602 | + "name": "no-name", |
| 1603 | + "license": "UNLICENSED", |
| 1604 | + "type": "module", |
| 1605 | + "dependencies": { |
| 1606 | + "@vaadin/common-frontend": "0.0.22", |
| 1607 | + "@vaadin/react-components": "25.1.2", |
| 1608 | + "@vaadin/vaadin-development-mode-detector": "2.0.7", |
| 1609 | + "adaptivecards": "1.2.6", |
| 1610 | + "brace": "0.11.1", |
| 1611 | + "date-fns": "4.1.0", |
| 1612 | + "lit": "3.3.2", |
| 1613 | + "react": "19.2.4", |
| 1614 | + "react-dom": "19.2.4", |
| 1615 | + "react-router": "7.13.1" |
| 1616 | + }, |
| 1617 | + "devDependencies": { |
| 1618 | + "@babel/plugin-proposal-object-rest-spread": "7.20.7", |
| 1619 | + "@types/node": "25.5.0", |
| 1620 | + "@types/react": "19.2.14", |
| 1621 | + "@types/react-dom": "19.2.3", |
| 1622 | + "typescript": "5.9.3", |
| 1623 | + "vite": "7.3.2", |
| 1624 | + "vite-plugin-checker": "0.12.0" |
| 1625 | + }, |
| 1626 | + "vaadin": { |
| 1627 | + "dependencies": { |
| 1628 | + "@vaadin/common-frontend": "0.0.22", |
| 1629 | + "@vaadin/react-components": "25.1.2", |
| 1630 | + "@vaadin/vaadin-development-mode-detector": "2.0.7", |
| 1631 | + "adaptivecards": "1.2.6", |
| 1632 | + "brace": "0.11.1", |
| 1633 | + "date-fns": "4.1.0", |
| 1634 | + "lit": "3.3.2", |
| 1635 | + "react": "19.2.4", |
| 1636 | + "react-dom": "19.2.4", |
| 1637 | + "react-router": "7.13.1" |
| 1638 | + }, |
| 1639 | + "devDependencies": { |
| 1640 | + "@babel/plugin-proposal-object-rest-spread": "7.20.7", |
| 1641 | + "@types/node": "25.5.0", |
| 1642 | + "@types/react": "19.2.14", |
| 1643 | + "@types/react-dom": "19.2.3", |
| 1644 | + "typescript": "5.9.3", |
| 1645 | + "vite": "7.3.2", |
| 1646 | + "vite-plugin-checker": "0.12.0" |
| 1647 | + }, |
| 1648 | + "hash": "a4b492aecb32fe13902befbcc4ad0efbe6417273e8ca60346c4839973ae8242c" |
| 1649 | + } |
| 1650 | + } |
| 1651 | + """; |
| 1652 | + |
| 1653 | + var packageJson = JacksonUtils.readTree(json); |
| 1654 | + var hash = TaskUpdatePackages.generatePackageJsonHash(packageJson); |
| 1655 | + Assert.assertEquals(packageJson.get("vaadin").get("hash").asString(), |
| 1656 | + hash); |
| 1657 | + } |
| 1658 | + |
1592 | 1659 | @Test |
1593 | 1660 | void generatePackageJsonHash_pnpmOverrides_includedInHash() |
1594 | 1661 | throws IOException { |
|
0 commit comments