Skip to content

Commit

Permalink
feat!: remove node v12 and node v15 support (#12658)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: remove node v12 and v15 support
  • Loading branch information
viceice committed Dec 9, 2021
1 parent ce241e1 commit 7c4a71b
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 5 deletions.
8 changes: 8 additions & 0 deletions lib/platform/github/__snapshots__/index.spec.ts.snap
Expand Up @@ -7156,6 +7156,14 @@ Array [
]
`;
exports[`platform/github/index initPlatform() should support custom endpoint without version 1`] = `
Object {
"endpoint": "https://ghe.renovatebot.com/",
"gitAuthor": "undefined <user@domain.com>",
"renovateUsername": "renovate-bot",
}
`;
exports[`platform/github/index initPlatform() should support default endpoint no email access 1`] = `
Object {
"endpoint": "https://api.github.com/",
Expand Down
24 changes: 24 additions & 0 deletions lib/platform/github/index.spec.ts
Expand Up @@ -132,6 +132,30 @@ describe('platform/github/index', () => {
).toMatchSnapshot();
expect(httpMock.getTrace()).toMatchSnapshot();
});

it('should support custom endpoint without version', async () => {
httpMock
.scope('https://ghe.renovatebot.com')
.head('/')
.reply(200)

.get('/user')
.reply(200, {
login: 'renovate-bot',
})
.get('/user/emails')
.reply(200, [
{
email: 'user@domain.com',
},
]);
expect(
await github.initPlatform({
endpoint: 'https://ghe.renovatebot.com',
token: '123test',
})
).toMatchSnapshot();
});
});

describe('getRepos', () => {
Expand Down
32 changes: 32 additions & 0 deletions lib/util/cache/package/decorator.spec.ts
Expand Up @@ -33,6 +33,25 @@ describe('util/cache/package/decorator', () => {
expect(spy).toHaveBeenCalledTimes(1);
});

it('Do not cache', async () => {
class MyClass {
@cache({ namespace: 'namespace', key: 'key', cacheable: () => false })
public async getString(
cacheKey: string,
test: string | null
): Promise<string | null> {
await spy();
return test;
}
}
const myClass = new MyClass();
expect(await myClass.getString('null', null)).toBeNull();
expect(await myClass.getString('null', null)).toBeNull();
expect(await myClass.getString('test', 'test')).toBe('test');
expect(await myClass.getString('test', 'test')).toBe('test');
expect(spy).toHaveBeenCalledTimes(4);
});

it('Do cache null', async () => {
class MyClass {
@cache({ namespace: 'namespace', key: (cacheKey, test) => cacheKey })
Expand Down Expand Up @@ -88,4 +107,17 @@ describe('util/cache/package/decorator', () => {
expect(await myClass.getNumber(getReleasesConfig)).toBeDefined();
expect(spy).toHaveBeenCalledTimes(1);
});

it('works', async () => {
class MyClass {
public async getNumber(): Promise<number> {
await spy();
return Math.random();
}
}
const decorator = cache({ namespace: 'namespace', key: 'key' });
const getNumber = decorator(MyClass.prototype, 'getNumber', undefined);

expect(await getNumber.value()).toBeNumber();
});
});
1 change: 1 addition & 0 deletions lib/util/cache/package/decorator.ts
Expand Up @@ -34,6 +34,7 @@ function decorate<T>(fn: Handler<T>): Decorator<T> {
const result: Decorator<T> = (
target,
key,
/* TODO: Can descriptor be undefined ? */
descriptor = Object.getOwnPropertyDescriptor(target, key) ?? {
enumerable: true,
configurable: true,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -118,12 +118,12 @@
},
"homepage": "https://renovatebot.com",
"engines": {
"node": "^12.22.0 || >=14.15.0",
"node": "^14.15.0 || >=16.13.0",
"yarn": "^1.17.0"
},
"engines-next": {
"description": "Versions other than the below are deprecated and a warning will be logged",
"node": ">=14.15.0"
"node": "^14.15.0 || >=16.13.0"
},
"dependencies": {
"@aws-sdk/client-ec2": "3.35.0",
Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Expand Up @@ -4,7 +4,8 @@
"noImplicitAny": false /* required for js files */,
"strictNullChecks": false /* required for js files */,
"outDir": "./dist",
"target": "es2018",
/* https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping */
"target": "es2020",
"module": "commonjs",
"sourceMap": true,
"allowSyntheticDefaultImports": true,
Expand All @@ -14,7 +15,7 @@
"noImplicitOverride": true,
"experimentalDecorators": true,
"useUnknownInCatchVariables": false /* we aren't prepared for enabling this by default since ts 4.4*/,
"lib": ["es2018"],
"lib": ["es2020"],
"types": ["node", "jest", "jest-extended", "expect-more-jest"],
"allowJs": true,
"checkJs": true
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.strict.json
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"strictNullChecks": true,
"noImplicitAny": true,
"lib": ["es2019"]
"lib": ["es2020"]
},
"include": [
"lib/config/app-strings.ts",
Expand Down

0 comments on commit 7c4a71b

Please sign in to comment.