also looking at this
fix(deps-file): anchor the dependency regex to a key, and rewrite each match from its own captures
#1454
3 files
+216
-41
| @@ -126,13 +126,20 @@ devDependencies: | ||
| 126 | 126 | // Pass the content directly to avoid file system corruption |
| 127 | 127 | const updatedContent = await updateDependencyFile(depsPath, depsYaml, updates) |
| 128 | 128 | |
| 129 | // python.org should not be updated because it uses "*" | |
| 129 | // The result has to be YAML before any of the assertions below mean | |
| 130 | // anything. Without this, `toContain('python.org: "*"')` was satisfied by | |
| 131 | // the corrupt line `python.org: "*"3.13.5`, so this test passed for months | |
| 132 | // against output that `Bun.YAML.parse` rejects (stacksjs/buddy#1453). | |
| 133 | expect(() => Bun.YAML.parse(updatedContent)).not.toThrow() | |
| 134 | ||
| 135 | // python.org should not be updated because it uses "*", quoted or not | |
| 130 | 136 | expect(updatedContent).toContain('python.org: "*"') |
| 131 | expect(updatedContent).not.toContain('python.org: "3.13.5"') | |
| 137 | expect(updatedContent).not.toContain('3.13.5') | |
| 132 | 138 | |
| 133 | // typescript should be updated because it uses a specific version | |
| 134 | expect(updatedContent).toContain('typescript: ^5.1.0') | |
| 135 | expect(updatedContent).not.toContain('typescript: ^5.0.0') | |
| 139 | // typescript should be updated because it uses a specific version, and the | |
| 140 | // author's quoting survives the rewrite | |
| 141 | expect(updatedContent).toContain('typescript: "^5.1.0"') | |
| 142 | expect(updatedContent).not.toContain('5.0.0') | |
| 136 | 143 | }) |
| 137 | 144 | |
| 138 | 145 | it('should test CLI respectLatest flag override', async () => { |