From dede1996241133e8a75aebb27c02bd70c55c54fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Fontcuberta?= Date: Tue, 7 Mar 2023 09:01:31 +0100 Subject: [PATCH] fix: Update workflow to release 5.x --- .github/workflows/validate.yml | 12 +++++++----- src/__tests__/about-vue-router-mocha.js | 18 ++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 5cfb6db..4caf22a 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -4,6 +4,7 @@ on: branches: [ '+([0-9])?(.{+([0-9]),x}).x', + '5.x', 'main', 'next', 'next-major', @@ -44,16 +45,16 @@ jobs: runs-on: ubuntu-latest if: ${{ github.repository == 'testing-library/vue-testing-library' && - contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha', + contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha,refs/heads/5.x', github.ref) && github.event_name == 'push' }} steps: - name: ⬇️ Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: ⎔ Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 16 - name: 📥 Download deps uses: bahmutov/npm-install@v1 @@ -64,12 +65,13 @@ jobs: run: npm run build - name: 🚀 Release - uses: cycjimmy/semantic-release-action@v2 + uses: cycjimmy/semantic-release-action@v3 with: semantic_version: 17 branches: | [ '+([0-9])?(.{+([0-9]),x}).x', + '5.x', 'main', 'next', 'next-major', diff --git a/src/__tests__/about-vue-router-mocha.js b/src/__tests__/about-vue-router-mocha.js index c7eb8a2..9f42cf5 100644 --- a/src/__tests__/about-vue-router-mocha.js +++ b/src/__tests__/about-vue-router-mocha.js @@ -1,22 +1,24 @@ /* eslint-disable jest/no-conditional-in-test */ +/* eslint-disable jest/no-conditional-expect */ + import '@testing-library/jest-dom' import {render} from '@testing-library/vue' -import semver from 'semver' import About from './components/Router/About.vue' const routes = [] test('uses require("vue-router").default when require("vue-router") is undefined (useful for mocha users)', () => { + expect.assertions(2) + // Test for fix https://github.com/testing-library/vue-testing-library/issues/119 jest.mock('vue-router', () => { return undefined }) - expect(() => render(About, {routes})).toThrowError( - new TypeError( - semver.gte(process.version, '16.0.0') - ? "Cannot read properties of undefined (reading 'default')" - : "Cannot read property 'default' of undefined", - ), - ) + try { + render(About, {routes}) + } catch (error) { + expect(error).toBeInstanceOf(TypeError) + expect(error.message).toEqual(expect.stringContaining('default')) + } })