Skip to content

Commit 75e02a2

Browse files
committed
small fixes
1 parent fa46f24 commit 75e02a2

File tree

4 files changed

+77
-30
lines changed

4 files changed

+77
-30
lines changed

backend/catalog/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
"build": "tsc",
1010
"test": "jest",
1111
"setup": "./scripts/setup.sh",
12-
"renovate": "if [ \"$npm_config_live\" ]; then DRY_RUN_FLAG=\"\"; echo 'LIVE MODE: Will create actual pull requests'; else DRY_RUN_FLAG=\"--dry-run=full\"; echo 'DRY RUN MODE: No pull requests will be created (use --live to create PRs)'; fi && RENOVATE_TOKEN=$GH_CLI_TOKEN LOG_LEVEL=debug renovate --platform=github $DRY_RUN_FLAG gitpod-samples/gitpodflix-demo > renovate_debug.txt 2>&1 && echo 'Renovate scan complete! Check renovate_debug.txt for full output' && if [ \"$npm_config_filter\" ]; then echo 'Filtering results for:' $npm_config_filter && grep -i -A 20 -B 5 \"$npm_config_filter\" renovate_debug.txt; else echo 'Use --filter=<package> to filter results for specific dependency'; fi",
13-
"renovate:jest": "echo 'Creating Jest v30 pull request...' && echo '{\"extends\":[],\"enabledManagers\":[\"npm\"],\"includePaths\":[\"backend/catalog/package.json\"],\"packageRules\":[{\"matchPackageNames\":[\"jest\",\"@types/jest\"],\"enabled\":true}],\"prConcurrentLimit\":0,\"prHourlyLimit\":0,\"branchConcurrentLimit\":0}' > renovate-jest-only.json && RENOVATE_TOKEN=$GH_CLI_TOKEN RENOVATE_CONFIG_FILE=renovate-jest-only.json renovate --platform=github gitpod-samples/gitpodflix-demo && rm renovate-jest-only.json"
12+
"renovate:jest": "echo 'Creating Jest v30 pull request...' && cd /workspaces/gitpodflix-demo && RENOVATE_TOKEN=$GH_CLI_TOKEN renovate --platform=github gitpod-samples/gitpodflix-demo"
1413
},
1514
"dependencies": {
1615
"express": "^4.18.2",

backend/catalog/src/__tests__/deprecated-matchers.test.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
// This test file uses Jest v29 deprecated matcher syntax that will break in v30
21
describe('Jest v29 Deprecated Matchers Demo', () => {
32
describe('Mock function matchers that will break in Jest v30', () => {
43
it('uses toBeCalled instead of toHaveBeenCalled', () => {
54
const mockFn = jest.fn();
65
mockFn('test');
76

8-
// This will break in Jest v30 - should be toHaveBeenCalled()
97
expect(mockFn).toBeCalled();
108
});
119

@@ -14,15 +12,13 @@ describe('Jest v29 Deprecated Matchers Demo', () => {
1412
mockFn('first');
1513
mockFn('second');
1614

17-
// This will break in Jest v30 - should be toHaveBeenCalledTimes()
1815
expect(mockFn).toBeCalledTimes(2);
1916
});
2017

2118
it('uses toBeCalledWith instead of toHaveBeenCalledWith', () => {
2219
const mockFn = jest.fn();
2320
mockFn('test-arg');
2421

25-
// This will break in Jest v30 - should be toHaveBeenCalledWith()
2622
expect(mockFn).toBeCalledWith('test-arg');
2723
});
2824

@@ -31,7 +27,6 @@ describe('Jest v29 Deprecated Matchers Demo', () => {
3127
mockFn('first');
3228
mockFn('last');
3329

34-
// This will break in Jest v30 - should be toHaveBeenLastCalledWith()
3530
expect(mockFn).lastCalledWith('last');
3631
});
3732

@@ -40,7 +35,6 @@ describe('Jest v29 Deprecated Matchers Demo', () => {
4035
mockFn('first');
4136
mockFn('second');
4237

43-
// This will break in Jest v30 - should be toHaveBeenNthCalledWith()
4438
expect(mockFn).nthCalledWith(1, 'first');
4539
expect(mockFn).nthCalledWith(2, 'second');
4640
});
@@ -51,7 +45,6 @@ describe('Jest v29 Deprecated Matchers Demo', () => {
5145
const mockFn = jest.fn().mockReturnValue('result');
5246
mockFn();
5347

54-
// This will break in Jest v30 - should be toHaveReturned()
5548
expect(mockFn).toReturn();
5649
});
5750

@@ -60,15 +53,13 @@ describe('Jest v29 Deprecated Matchers Demo', () => {
6053
mockFn();
6154
mockFn();
6255

63-
// This will break in Jest v30 - should be toHaveReturnedTimes()
6456
expect(mockFn).toReturnTimes(2);
6557
});
6658

6759
it('uses toReturnWith instead of toHaveReturnedWith', () => {
6860
const mockFn = jest.fn().mockReturnValue('specific-result');
6961
mockFn();
7062

71-
// This will break in Jest v30 - should be toHaveReturnedWith()
7263
expect(mockFn).toReturnWith('specific-result');
7364
});
7465

@@ -79,7 +70,6 @@ describe('Jest v29 Deprecated Matchers Demo', () => {
7970
mockFn();
8071
mockFn();
8172

82-
// This will break in Jest v30 - should be toHaveLastReturnedWith()
8373
expect(mockFn).lastReturnedWith('last');
8474
});
8575

@@ -90,7 +80,6 @@ describe('Jest v29 Deprecated Matchers Demo', () => {
9080
mockFn();
9181
mockFn();
9282

93-
// This will break in Jest v30 - should be toHaveNthReturnedWith()
9483
expect(mockFn).nthReturnedWith(1, 'first');
9584
expect(mockFn).nthReturnedWith(2, 'second');
9685
});
@@ -102,7 +91,6 @@ describe('Jest v29 Deprecated Matchers Demo', () => {
10291
throw new Error('Test error');
10392
};
10493

105-
// This will break in Jest v30 - should be toThrow()
10694
expect(errorFn).toThrowError('Test error');
10795
});
10896

@@ -111,7 +99,6 @@ describe('Jest v29 Deprecated Matchers Demo', () => {
11199
throw new Error('Any error');
112100
};
113101

114-
// This will break in Jest v30 - should be toThrow()
115102
expect(errorFn).toThrowError();
116103
});
117104
});
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Fixing Renovate Dependencies Demo
2+
3+
This demo shows how to use Renovate to create pull requests for dependency updates and then use AI assistance to resolve any breaking changes.
4+
5+
## Prerequisites
6+
7+
- Access to a Gitpod environment with this repository
8+
- GitHub CLI token configured (`GH_CLI_TOKEN` environment variable)
9+
- Renovate CLI installed (included in the devcontainer)
10+
11+
## Steps to Replicate
12+
13+
### 1. Create a Renovate Pull Request
14+
15+
Navigate to the catalog service directory and run the renovate Jest command:
16+
17+
```bash
18+
cd backend/catalog
19+
npm run renovate:jest
20+
```
21+
22+
This command will:
23+
24+
- Use the existing `renovate.json` configuration
25+
- Create a pull request specifically for Jest dependency updates
26+
- Target Jest upgrades that may introduce breaking changes
27+
28+
### 2. Review the Pull Request
29+
30+
After the command completes, check the GitHub repository for the newly created pull request. The PR will contain:
31+
32+
- Updated Jest dependencies
33+
- Breaking changes that need to be addressed
34+
35+
### 3. Resolve Breaking Changes with AI
36+
37+
You have several options to get AI assistance for resolving the breaking changes:
38+
39+
#### Option A: Using GitHub CLI
40+
41+
```bash
42+
# Get PR details and diff
43+
gh pr view <PR_NUMBER> --json body,title,files
44+
gh pr diff <PR_NUMBER>
45+
46+
# Use this information to prompt your AI assistant
47+
```
48+
49+
#### Option B: Manual Context Gathering
50+
51+
1. Copy the PR description and diff manually
52+
2. Include relevant test files that might be affected
53+
3. Construct a prompt asking for help with Jest migration
54+
55+
#### Option C: Direct File Analysis
56+
57+
1. Review the failing tests after merging the PR
58+
2. Copy error messages and affected code
59+
3. Ask AI to help fix the deprecated Jest matchers
60+
61+
## Example AI Prompt
62+
63+
```
64+
I have a Jest upgrade from v29 to v30 that's causing test failures due to deprecated matchers. Here are the failing tests:
65+
66+
[Include test file contents and error messages]
67+
68+
Please help me update the deprecated Jest matchers to their v30 equivalents.
69+
```

renovate.json

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": [
4-
"config:base"
5-
],
3+
"extends": [],
4+
"enabledManagers": ["npm"],
5+
"includePaths": ["backend/catalog/package.json"],
66
"packageRules": [
77
{
8-
"matchPackageNames": ["jest"],
8+
"matchPackageNames": ["jest", "@types/jest"],
99
"enabled": true
1010
}
1111
],
12-
"prConcurrentLimit": 1,
13-
"prHourlyLimit": 1,
14-
"timezone": "UTC",
15-
"schedule": ["at any time"],
16-
"dependencyDashboard": true,
17-
"dependencyDashboardTitle": "Renovate Dashboard",
18-
"commitMessagePrefix": "chore(deps): ",
19-
"commitMessageAction": "update",
20-
"commitMessageTopic": "{{depName}}",
21-
"commitMessageExtra": "to {{newVersion}}",
22-
"semanticCommits": "enabled"
12+
"prConcurrentLimit": 0,
13+
"prHourlyLimit": 0,
14+
"branchConcurrentLimit": 0
2315
}

0 commit comments

Comments
 (0)