Skip to content

Commit c1db340

Browse files
committed
Fixing problem where Stimulus sometimes continued after the test
Fixes: Error: Uncaught [ReferenceError: Node is not defined]
1 parent 10c5591 commit c1db340

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/LiveComponent/assets/test/tools.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ let activeTests: FunctionalTest[] = [];
1313
let application: Application;
1414

1515
export function shutdownTests() {
16+
if (application) {
17+
application.stop();
18+
}
19+
1620
if (activeTests.length === 0) {
1721
// no test was run, apparently
1822
return;
@@ -366,7 +370,9 @@ export function createTestForExistingComponent(component: Component): Functional
366370

367371
export async function startStimulus(element: string|HTMLElement) {
368372
// start the Stimulus app just once per test suite
369-
if (!application) {
373+
if (application) {
374+
await application.start();
375+
} else {
370376
application = Application.start();
371377
application.register('live', LiveController);
372378
}

0 commit comments

Comments
 (0)