Skip to content
This repository was archived by the owner on Jul 5, 2025. It is now read-only.

Commit 40c5c8b

Browse files
committed
minor #4 Removing dist/ & testing against Stimulus 3 (weaverryan)
This PR was squashed before being merged into the main branch. Discussion ---------- Removing dist/ & testing against Stimulus 3 Hi! This was mainly motivated to add support for Stimulus 3... but I think the library already supports it just fine, as this library never actually *imports* Stimulus itself (other than in a test file). So, this PR includes a number of other "chores" that we should handle: * The `dist/` directory is not needed, because this is used purely as a node package. Babel IS still there, because it's used by jest to transform the test controller file. * The `src/setup.js` file was missing (there was a `dist/setup.js` file but the original source file was missing - but easily reproduceable). * We're now testing against Stimulus 3. Commits ------- 3c7697a Removing dist/ & testing against Stimulus 3
2 parents 12edab3 + 3c7697a commit 40c5c8b

File tree

8 files changed

+15
-56
lines changed

8 files changed

+15
-56
lines changed

.babelrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"presets": ["@babel/env"],
3-
"plugins": ["@babel/plugin-proposal-class-properties"]
2+
"presets": ["@babel/env"]
43
}

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
- uses: actions/checkout@master
1010
- name: Prettier
1111
run: |
12-
yarn global add prettier@^2.2.0
13-
~/.yarn/bin/prettier --check src/**/*.js --config .prettierrc.json
12+
yarn add prettier@^2.2.0
13+
yarn run prettier --check {src,test}/**/*.js --config .prettierrc.json
1414
1515
tests:
1616
runs-on: ubuntu-latest

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
Symfony UX Stimulus testing is a low-level package to help write tests for Stimulus controllers
44
in applications and reusable packages.
55

6-
**If you are developing a project with Symfony Flex, you should probably use the ux-test-pack
7-
instead**. The pack includes this package and configures it automatically in your application.
8-
96
Symfony UX Stimulus testing is currently considered **experimental**.
107

118
## Installation
@@ -50,12 +47,13 @@ module.exports = {
5047
{
5148
"presets": ["@babel/env"],
5249
"plugins": ["@babel/plugin-proposal-class-properties"]
50+
}
5351
```
5452

5553
5. Finally, create your first test, for instance `hello_controller.test.js`:
5654

5755
```js
58-
import { Application } from 'stimulus';
56+
import { Application } from '@hotwired/stimulus';
5957
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
6058
import HelloController from '../controllers/hello_controller.js';
6159

dist/index.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@
22
"name": "@symfony/stimulus-testing",
33
"description": "@testing-library integration for Symfony UX",
44
"version": "1.1.0",
5-
"main": "dist/index.js",
5+
"main": "src/index.js",
66
"license": "MIT",
77
"author": "Titouan Galopin <[email protected]>",
88
"engines": {
99
"node": "^10.13.0 || >=12.0.0"
1010
},
1111
"scripts": {
12-
"build": "babel src -d dist",
13-
"test": "babel src -d dist && jest"
14-
},
15-
"peerDependencies": {
16-
"stimulus": "^2.0"
12+
"test": "jest"
1713
},
1814
"dependencies": {
1915
"@testing-library/dom": "^7.28.1",
@@ -25,11 +21,9 @@
2521
"regenerator-runtime": "^0.13.7"
2622
},
2723
"devDependencies": {
28-
"@babel/cli": "^7.12.1",
2924
"@babel/core": "^7.12.3",
30-
"@babel/plugin-proposal-class-properties": "^7.12.1",
3125
"@babel/preset-env": "^7.12.7",
32-
"stimulus": "^2.0.0"
26+
"@hotwired/stimulus": "^3.0.0"
3327
},
3428
"jest": {
3529
"testRegex": "test/.*\\.test.js",
@@ -39,7 +33,6 @@
3933
},
4034
"files": [
4135
"src/",
42-
"dist/",
4336
"setup.js"
4437
]
4538
}

setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
require('./dist/setup.js');
1+
require('./src/setup.js');

dist/setup.js renamed to src/setup.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
* For the full copyright and license information, please view the LICENSE
77
* file that was distributed with this source code.
88
*/
9-
'use strict';
10-
11-
require("mutationobserver-shim");
129

13-
require("regenerator-runtime/runtime.js");
10+
'use strict';
1411

15-
require("@testing-library/jest-dom");
12+
require('mutationobserver-shim');
13+
require('regenerator-runtime/runtime.js');
14+
require('@testing-library/jest-dom');

test/controller.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
'use strict';
1111

12-
import { Application, Controller } from 'stimulus';
12+
import { Application, Controller } from '@hotwired/stimulus';
1313
import { getByTestId, waitFor } from '@testing-library/dom';
14-
import { clearDOM, mountDOM } from '../dist/index';
14+
import { clearDOM, mountDOM } from '../src/index';
1515

1616
// Controller used to check the actual controller was properly booted
1717
class AppController extends Controller {

0 commit comments

Comments
 (0)