Skip to content

Commit 88f9d4b

Browse files
authored
Merge pull request #2 from sourceallies/require-at-least-node-20
Updates to require at least Node 20.
2 parents 8e3d981 + ead6659 commit 88f9d4b

File tree

6 files changed

+407
-152
lines changed

6 files changed

+407
-152
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
node-version: [18.x, 20.x, 22.x]
15+
node-version: [20.x, 22.x, 24.x]
1616

1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v5
1919

2020
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v4
21+
uses: actions/setup-node@v6
2222
with:
2323
node-version: ${{ matrix.node-version }}
2424
cache: 'npm'

.github/workflows/publish.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,28 @@ on:
44
release:
55
types: [created]
66

7+
permissions:
8+
contents: read
9+
id-token: write
10+
711
jobs:
812
publish:
913
runs-on: ubuntu-latest
1014

11-
permissions:
12-
contents: read
13-
id-token: write
14-
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717

18-
- name: Use Node.js 20.x
19-
uses: actions/setup-node@v4
18+
- name: Use Node.js 24.x
19+
uses: actions/setup-node@v6
2020
with:
21-
node-version: 20.x
21+
node-version: 24.x
2222
registry-url: 'https://registry.npmjs.org'
2323
cache: 'npm'
2424

25+
# Ensure npm 11.5.1 or later is installed
26+
- name: Update npm
27+
run: npm install -g npm@latest
28+
2529
- name: Install dependencies
2630
run: npm ci
2731

@@ -32,6 +36,4 @@ jobs:
3236
run: npm run build
3337

3438
- name: Publish to NPM
35-
run: npm publish --provenance --access public
36-
env:
37-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
run: npm publish --access public

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.11.1

README.md

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,32 @@ Build the TypeScript source to JavaScript:
4848
npm run build
4949
```
5050

51+
### Local testing of stub functions using another project
52+
53+
Ensure package is not already installed in the project testing the changes.
54+
55+
```bash
56+
npm uninstall @sourceallies/vue-testing-library-stubs
57+
```
58+
59+
Ensure Vue Testing Library Stubs project is using the same node version as the project testing the changes.
60+
61+
```bash
62+
node -v
63+
```
64+
65+
Create a symlink for the project testing the changes to connect to.
66+
67+
```bash
68+
npm link
69+
```
70+
71+
In project testing the changes link the package
72+
73+
```bash
74+
npm link @sourceallies/vue-testing-library-stubs
75+
```
76+
5177
The compiled output will be in the `dist/` directory.
5278

5379
### Project Structure
@@ -70,7 +96,7 @@ Create a simple stub component for testing:
7096

7197
```typescript
7298
import { mount } from '@vue/test-utils';
73-
import { getStub } from 'vue-testing-library-stubs';
99+
import { getStub } from '@sourceallies/vue-testing-library-stubs';
74100

75101
const wrapper = mount(MyParentComponent, {
76102
global: {
@@ -88,7 +114,7 @@ expect(wrapper.text()).toContain('ChildComponent-stub');
88114

89115
```typescript
90116
import { render, screen } from '@testing-library/vue';
91-
import { getStub } from 'vue-testing-library-stubs';
117+
import { getStub } from '@sourceallies/vue-testing-library-stubs';
92118

93119
render(MyParentComponent, {
94120
global: {
@@ -110,7 +136,7 @@ Test components that pass props to child components:
110136

111137
```typescript
112138
import { mount } from '@vue/test-utils';
113-
import { getStubWithProps } from 'vue-testing-library-stubs';
139+
import { getStubWithProps } from '@sourceallies/vue-testing-library-stubs';
114140

115141
const wrapper = mount(MyParentComponent, {
116142
global: {
@@ -129,7 +155,7 @@ expect(wrapper.text()).toContain('count-42');
129155

130156
```typescript
131157
import { render, screen } from '@testing-library/vue';
132-
import { getStubWithProps } from 'vue-testing-library-stubs';
158+
import { getStubWithProps } from '@sourceallies/vue-testing-library-stubs';
133159

134160
render(MyParentComponent, {
135161
global: {
@@ -152,7 +178,7 @@ Test components that listen to child component events:
152178

153179
```typescript
154180
import { mount } from '@vue/test-utils';
155-
import { getEmittingStub } from 'vue-testing-library-stubs';
181+
import { getEmittingStub } from '@sourceallies/vue-testing-library-stubs';
156182

157183
const wrapper = mount(MyParentComponent, {
158184
global: {
@@ -176,7 +202,7 @@ expect(wrapper.emitted('save')?.[0]).toEqual([{ id: 123 }]);
176202
```typescript
177203
import { render, screen } from '@testing-library/vue';
178204
import userEvent from '@testing-library/user-event';
179-
import { getEmittingStub } from 'vue-testing-library-stubs';
205+
import { getEmittingStub } from '@sourceallies/vue-testing-library-stubs';
180206

181207
const { emitted } = render(MyParentComponent, {
182208
global: {
@@ -203,7 +229,7 @@ Combine props and event emission:
203229

204230
```typescript
205231
import { mount } from '@vue/test-utils';
206-
import { getEmittingStubWithProps } from 'vue-testing-library-stubs';
232+
import { getEmittingStubWithProps } from '@sourceallies/vue-testing-library-stubs';
207233

208234
const wrapper = mount(MyParentComponent, {
209235
global: {
@@ -233,7 +259,7 @@ expect(wrapper.emitted('update')?.[0]).toEqual([{ newValue: 'test' }]);
233259
```typescript
234260
import { render, screen } from '@testing-library/vue';
235261
import userEvent from '@testing-library/user-event';
236-
import { getEmittingStubWithProps } from 'vue-testing-library-stubs';
262+
import { getEmittingStubWithProps } from '@sourceallies/vue-testing-library-stubs';
237263

238264
const { emitted } = render(MyParentComponent, {
239265
global: {
@@ -269,7 +295,7 @@ Test components with multiple event handlers:
269295

270296
```typescript
271297
import { mount } from '@vue/test-utils';
272-
import { getMultiEmittingStubWithProps, type EmittedEvent } from 'vue-testing-library-stubs';
298+
import { getMultiEmittingStubWithProps, type EmittedEvent } from '@sourceallies/vue-testing-library-stubs';
273299

274300
const events: EmittedEvent[] = [
275301
{ name: 'save', value: { id: 1 } },
@@ -302,7 +328,7 @@ expect(wrapper.emitted('cancel')?.[0]).toEqual([undefined]);
302328
```typescript
303329
import { render, screen } from '@testing-library/vue';
304330
import userEvent from '@testing-library/user-event';
305-
import { getMultiEmittingStubWithProps, type EmittedEvent } from 'vue-testing-library-stubs';
331+
import { getMultiEmittingStubWithProps, type EmittedEvent } from '@sourceallies/vue-testing-library-stubs';
306332

307333
const events: EmittedEvent[] = [
308334
{ name: 'save', value: { id: 1 } },
@@ -339,7 +365,7 @@ Test parent components that call child validation methods:
339365

340366
```typescript
341367
import { mount } from '@vue/test-utils';
342-
import { getExposedValidateStub } from 'vue-testing-library-stubs';
368+
import { getExposedValidateStub } from '@sourceallies/vue-testing-library-stubs';
343369

344370
const wrapper = mount(MyFormComponent, {
345371
global: {
@@ -357,7 +383,7 @@ expect(wrapper.text()).toContain('InputComponent-stub-validated-true');
357383

358384
```typescript
359385
import { render, screen } from '@testing-library/vue';
360-
import { getExposedValidateStub } from 'vue-testing-library-stubs';
386+
import { getExposedValidateStub } from '@sourceallies/vue-testing-library-stubs';
361387

362388
render(MyFormComponent, {
363389
global: {
@@ -379,7 +405,7 @@ Test components that use child component's exposed functions:
379405

380406
```typescript
381407
import { mount } from '@vue/test-utils';
382-
import { getTemplateComponentForExposedFunction } from 'vue-testing-library-stubs';
408+
import { getTemplateComponentForExposedFunction } from '@sourceallies/vue-testing-library-stubs';
383409

384410
const props = { value: 'test', enabled: true };
385411

@@ -402,7 +428,7 @@ await wrapper.find('button').trigger('click');
402428
```typescript
403429
import { render, screen } from '@testing-library/vue';
404430
import userEvent from '@testing-library/user-event';
405-
import { getTemplateComponentForExposedFunction } from 'vue-testing-library-stubs';
431+
import { getTemplateComponentForExposedFunction } from '@sourceallies/vue-testing-library-stubs';
406432

407433
const props = { value: 'test', enabled: true };
408434

0 commit comments

Comments
 (0)