From 21b5956dd8d3cf68064ea7804f4a86e263276525 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Fri, 21 Oct 2022 17:17:20 +0200 Subject: [PATCH] Use Node 16 --- __tests__/git.test.ts | 2 +- __tests__/helpers/git.ts | 4 ++-- __tests__/helpers/scratch-directory.ts | 2 +- __tests__/main.test.ts | 6 +++--- action.yml | 2 +- package.json | 2 +- yarn.lock | 8 ++++---- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/__tests__/git.test.ts b/__tests__/git.test.ts index 9c9e292c..c98c754c 100644 --- a/__tests__/git.test.ts +++ b/__tests__/git.test.ts @@ -30,7 +30,7 @@ describe('refExists', () => { test('returns true for existing refs', async () => { await execa('git', ['tag', 'a-tag']); expect(await git.refExists('HEAD')).toBe(true); - expect(await git.refExists('master')).toBe(true); + expect(await git.refExists('main')).toBe(true); expect(await git.refExists('a-tag')).toBe(true); }); diff --git a/__tests__/helpers/git.ts b/__tests__/helpers/git.ts index f105c6fa..eb22f92b 100644 --- a/__tests__/helpers/git.ts +++ b/__tests__/helpers/git.ts @@ -6,7 +6,7 @@ export async function initRepository(dir: string): Promise { fs.mkdirSync(dir); } - await execa('git', ['init'], { cwd: dir }); + await execa('git', ['init', '-b', 'main'], { cwd: dir }); await execa('git', ['config', 'user.name', 'Test User'], { cwd: dir }); await execa('git', ['config', 'user.email', 'test@example.com'], { cwd: dir }); await execa('git', ['commit', '--allow-empty', '-m', 'initial commit'], { cwd: dir }); @@ -15,5 +15,5 @@ export async function initRepository(dir: string): Promise { export async function addAndTrackRemote(name: string, url: string): Promise { await execa('git', ['remote', 'add', name, url]); await execa('git', ['fetch', '--all']); - await execa('git', ['branch', '--set-upstream-to', `${name}/master`]); + await execa('git', ['branch', '--set-upstream-to', `${name}/main`]); } diff --git a/__tests__/helpers/scratch-directory.ts b/__tests__/helpers/scratch-directory.ts index e03883f8..f8ef0957 100644 --- a/__tests__/helpers/scratch-directory.ts +++ b/__tests__/helpers/scratch-directory.ts @@ -13,6 +13,6 @@ export function runTestsInScratchDirectory(): void { afterEach(async () => { process.chdir(cwd); - fs.rmdirSync(testDir, { recursive: true }); + fs.rmSync(testDir, { recursive: true, force: true }); }); } diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 41c4db76..11162ab1 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -25,7 +25,7 @@ describe('with a changed version', () => { test('creates a new tag', async () => { let result = await execa.node(`${__dirname}/../lib/main.js`, { env: { - GITHUB_REF: 'master', + GITHUB_REF: 'main', }, }); @@ -46,7 +46,7 @@ describe('with a changed version', () => { test('skips tag creation when configured to', async () => { let result = await execa.node(`${__dirname}/../lib/main.js`, { env: { - GITHUB_REF: 'master', + GITHUB_REF: 'main', 'INPUT_CREATE-TAG': 'false', }, }); @@ -67,7 +67,7 @@ describe('with no version change', () => { let result = await execa.node(`${__dirname}/../lib/main.js`, { env: { - GITHUB_REF: 'master', + GITHUB_REF: 'main', }, }); diff --git a/action.yml b/action.yml index 5f26dd5b..0d262ba8 100644 --- a/action.yml +++ b/action.yml @@ -31,7 +31,7 @@ outputs: tag: description: if a new tag is created, this output will contain its name runs: - using: 'node12' + using: 'node16' main: 'dist/index.js' branding: icon: tag diff --git a/package.json b/package.json index 8b7b1f3f..ed2dc01c 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@types/execa": "^2.0.0", "@types/glob": "^7.1.1", "@types/jest": "^24.0.23", - "@types/node": "^12.7.12", + "@types/node": "^16.0.0", "@typescript-eslint/parser": "^2.8.0", "@zeit/ncc": "^0.20.5", "eslint": "^6.8.0", diff --git a/yarn.lock b/yarn.lock index 91cabf06..b8befa9b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -404,10 +404,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.1.tgz#238eb34a66431b71d2aaddeaa7db166f25971a0d" integrity sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA== -"@types/node@^12.7.12": - version "12.12.27" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.27.tgz#d7506f73160ad30fcebbcf5b8b7d2d976e649e42" - integrity sha512-odQFl/+B9idbdS0e8IxDl2ia/LP8KZLXhV3BUeI98TrZp0uoIzQPhGd+5EtzHmT0SMOIaPd7jfz6pOHLWTtl7A== +"@types/node@^16.0.0": + version "16.11.68" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.68.tgz#30ee923f4d940793e0380f5ce61c0bd4b7196b6c" + integrity sha512-JkRpuVz3xCNCWaeQ5EHLR/6woMbHZz/jZ7Kmc63AkU+1HxnoUugzSWMck7dsR4DvNYX8jp9wTi9K7WvnxOIQZQ== "@types/stack-utils@^1.0.1": version "1.0.1"