Skip to content

Commit

Permalink
fix: Update workflow to release 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
afontcu committed Mar 7, 2023
1 parent c00fe77 commit dede199
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
[
'+([0-9])?(.{+([0-9]),x}).x',
'5.x',
'main',
'next',
'next-major',
Expand Down Expand Up @@ -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
Expand All @@ -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',
Expand Down
18 changes: 10 additions & 8 deletions src/__tests__/about-vue-router-mocha.js
Original file line number Diff line number Diff line change
@@ -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'))
}
})

0 comments on commit dede199

Please sign in to comment.