jac-client 0.2.6__py3-none-any.whl → 0.2.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jac_client/examples/all-in-one/{src/button.jac → button.jac} +4 -3
- jac_client/examples/all-in-one/components/CategoryFilter.jac +47 -0
- jac_client/examples/all-in-one/components/Header.jac +17 -0
- jac_client/examples/all-in-one/components/ProfitOverview.jac +64 -0
- jac_client/examples/all-in-one/components/Summary.jac +76 -0
- jac_client/examples/all-in-one/components/TransactionForm.jac +188 -0
- jac_client/examples/all-in-one/components/TransactionItem.jac +62 -0
- jac_client/examples/all-in-one/components/TransactionList.jac +44 -0
- jac_client/examples/all-in-one/components/button.jac +8 -0
- jac_client/examples/all-in-one/components/navigation.jac +126 -0
- jac_client/examples/all-in-one/constants/categories.jac +36 -0
- jac_client/examples/all-in-one/constants/clients.jac +12 -0
- jac_client/examples/all-in-one/context/BudgetContext.jac +31 -0
- jac_client/examples/all-in-one/hooks/useBudget.jac +122 -0
- jac_client/examples/all-in-one/hooks/useLocalStorage.jac +37 -0
- jac_client/examples/all-in-one/main.jac +542 -0
- jac_client/examples/all-in-one/pages/BudgetPlanner.jac +140 -0
- jac_client/examples/all-in-one/pages/FeaturesTest.jac +157 -0
- jac_client/examples/all-in-one/pages/LandingPage.jac +124 -0
- jac_client/examples/all-in-one/pages/budget_planner_ui.cl.jac +65 -0
- jac_client/examples/all-in-one/pages/features_test_ui.cl.jac +675 -0
- jac_client/examples/all-in-one/pages/loginPage.jac +127 -0
- jac_client/examples/all-in-one/pages/nestedDemo.jac +54 -0
- jac_client/examples/all-in-one/pages/notFound.jac +18 -0
- jac_client/examples/all-in-one/pages/signupPage.jac +127 -0
- jac_client/examples/all-in-one/utils/formatters.jac +49 -0
- jac_client/examples/asset-serving/css-with-image/main.jac +92 -0
- jac_client/examples/asset-serving/image-asset/main.jac +56 -0
- jac_client/examples/asset-serving/import-alias/main.jac +109 -0
- jac_client/examples/basic/main.jac +23 -0
- jac_client/examples/basic-auth/main.jac +363 -0
- jac_client/examples/basic-auth-with-router/main.jac +451 -0
- jac_client/examples/basic-full-stack/main.jac +362 -0
- jac_client/examples/css-styling/js-styling/main.jac +63 -0
- jac_client/examples/css-styling/material-ui/main.jac +122 -0
- jac_client/examples/css-styling/pure-css/main.jac +55 -0
- jac_client/examples/css-styling/sass-example/main.jac +55 -0
- jac_client/examples/css-styling/styled-components/main.jac +62 -0
- jac_client/examples/css-styling/tailwind-example/main.jac +74 -0
- jac_client/examples/full-stack-with-auth/main.jac +696 -0
- jac_client/examples/little-x/main.jac +681 -0
- jac_client/examples/little-x/src/submit-button.jac +15 -14
- jac_client/examples/nested-folders/nested-advance/main.jac +26 -0
- jac_client/examples/nested-folders/nested-advance/src/ButtonRoot.jac +4 -6
- jac_client/examples/nested-folders/nested-advance/src/level1/ButtonSecondL.jac +9 -13
- jac_client/examples/nested-folders/nested-advance/src/level1/Card.jac +29 -32
- jac_client/examples/nested-folders/nested-advance/src/level1/level2/ButtonThirdL.jac +12 -18
- jac_client/examples/nested-folders/nested-basic/{src/app.jac → main.jac} +7 -5
- jac_client/examples/nested-folders/nested-basic/src/button.jac +4 -3
- jac_client/examples/nested-folders/nested-basic/src/components/button.jac +4 -3
- jac_client/examples/ts-support/main.jac +35 -0
- jac_client/examples/with-router/main.jac +286 -0
- jac_client/plugin/cli.jac +507 -470
- jac_client/plugin/client.jac +30 -12
- jac_client/plugin/client_runtime.cl.jac +25 -15
- jac_client/plugin/impl/client.impl.jac +126 -26
- jac_client/plugin/impl/client_runtime.impl.jac +182 -10
- jac_client/plugin/plugin_config.jac +216 -34
- jac_client/plugin/src/__init__.jac +0 -2
- jac_client/plugin/src/compiler.jac +2 -2
- jac_client/plugin/src/config_loader.jac +1 -0
- jac_client/plugin/src/desktop_config.jac +31 -0
- jac_client/plugin/src/impl/compiler.impl.jac +99 -30
- jac_client/plugin/src/impl/config_loader.impl.jac +8 -0
- jac_client/plugin/src/impl/desktop_config.impl.jac +191 -0
- jac_client/plugin/src/impl/jac_to_js.impl.jac +5 -1
- jac_client/plugin/src/impl/package_installer.impl.jac +20 -20
- jac_client/plugin/src/impl/vite_bundler.impl.jac +384 -144
- jac_client/plugin/src/package_installer.jac +1 -1
- jac_client/plugin/src/targets/desktop/sidecar/main.py +144 -0
- jac_client/plugin/src/targets/desktop_target.jac +37 -0
- jac_client/plugin/src/targets/impl/desktop_target.impl.jac +2347 -0
- jac_client/plugin/src/targets/impl/registry.impl.jac +64 -0
- jac_client/plugin/src/targets/impl/web_target.impl.jac +157 -0
- jac_client/plugin/src/targets/register.jac +21 -0
- jac_client/plugin/src/targets/registry.jac +87 -0
- jac_client/plugin/src/targets/web_target.jac +35 -0
- jac_client/plugin/src/vite_bundler.jac +15 -1
- jac_client/plugin/utils/__init__.jac +3 -0
- jac_client/plugin/utils/bun_installer.jac +16 -0
- jac_client/plugin/utils/impl/bun_installer.impl.jac +99 -0
- jac_client/templates/client.jacpack +72 -0
- jac_client/templates/fullstack.jacpack +61 -0
- jac_client/tests/conftest.py +110 -52
- jac_client/tests/fixtures/spawn_test/app.jac +64 -70
- jac_client/tests/fixtures/with-ts/app.jac +28 -28
- jac_client/tests/test_cli.py +280 -113
- jac_client/tests/test_e2e.py +232 -0
- jac_client/tests/test_helpers.py +58 -0
- jac_client/tests/test_it.py +325 -154
- jac_client/tests/test_it_desktop.py +891 -0
- {jac_client-0.2.6.dist-info → jac_client-0.2.11.dist-info}/METADATA +20 -11
- jac_client-0.2.11.dist-info/RECORD +113 -0
- {jac_client-0.2.6.dist-info → jac_client-0.2.11.dist-info}/WHEEL +1 -1
- jac_client/examples/all-in-one/src/app.jac +0 -841
- jac_client/examples/all-in-one/src/components/button.jac +0 -7
- jac_client/examples/asset-serving/css-with-image/src/app.jac +0 -88
- jac_client/examples/asset-serving/image-asset/src/app.jac +0 -55
- jac_client/examples/asset-serving/import-alias/src/app.jac +0 -111
- jac_client/examples/basic/src/app.jac +0 -21
- jac_client/examples/basic-auth/src/app.jac +0 -377
- jac_client/examples/basic-auth-with-router/src/app.jac +0 -464
- jac_client/examples/basic-full-stack/src/app.jac +0 -365
- jac_client/examples/css-styling/js-styling/src/app.jac +0 -84
- jac_client/examples/css-styling/material-ui/src/app.jac +0 -122
- jac_client/examples/css-styling/pure-css/src/app.jac +0 -64
- jac_client/examples/css-styling/sass-example/src/app.jac +0 -64
- jac_client/examples/css-styling/styled-components/src/app.jac +0 -71
- jac_client/examples/css-styling/tailwind-example/src/app.jac +0 -63
- jac_client/examples/full-stack-with-auth/src/app.jac +0 -722
- jac_client/examples/little-x/src/app.jac +0 -719
- jac_client/examples/nested-folders/nested-advance/src/app.jac +0 -35
- jac_client/examples/ts-support/src/app.jac +0 -35
- jac_client/examples/with-router/src/app.jac +0 -323
- jac_client/plugin/src/babel_processor.jac +0 -18
- jac_client/plugin/src/impl/babel_processor.impl.jac +0 -84
- jac_client-0.2.6.dist-info/RECORD +0 -74
- {jac_client-0.2.6.dist-info → jac_client-0.2.11.dist-info}/entry_points.txt +0 -0
- {jac_client-0.2.6.dist-info → jac_client-0.2.11.dist-info}/top_level.txt +0 -0
jac_client/tests/test_cli.py
CHANGED
|
@@ -7,7 +7,7 @@ from subprocess import PIPE, Popen, run
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def test_create_jac_app() -> None:
|
|
10
|
-
"""Test jac create --
|
|
10
|
+
"""Test jac create --use client command."""
|
|
11
11
|
test_project_name = "test-jac-app"
|
|
12
12
|
|
|
13
13
|
# Create a temporary directory for testing
|
|
@@ -17,9 +17,9 @@ def test_create_jac_app() -> None:
|
|
|
17
17
|
# Change to temp directory
|
|
18
18
|
os.chdir(temp_dir)
|
|
19
19
|
|
|
20
|
-
# Run jac create --
|
|
20
|
+
# Run jac create --use client command
|
|
21
21
|
process = Popen(
|
|
22
|
-
["jac", "create", "--
|
|
22
|
+
["jac", "create", "--use", "client", test_project_name],
|
|
23
23
|
stdin=PIPE,
|
|
24
24
|
stdout=PIPE,
|
|
25
25
|
stderr=PIPE,
|
|
@@ -30,15 +30,19 @@ def test_create_jac_app() -> None:
|
|
|
30
30
|
|
|
31
31
|
# Check that command succeeded
|
|
32
32
|
assert result_code == 0
|
|
33
|
-
|
|
33
|
+
# Check for success message (handles both old and new console formats)
|
|
34
|
+
assert (
|
|
35
|
+
f"Project '{test_project_name}' created successfully!" in stdout
|
|
36
|
+
or f"Project '{test_project_name}' created" in stdout
|
|
37
|
+
)
|
|
34
38
|
|
|
35
39
|
# Verify project directory was created
|
|
36
40
|
project_path = os.path.join(temp_dir, test_project_name)
|
|
37
41
|
assert os.path.exists(project_path)
|
|
38
42
|
assert os.path.isdir(project_path)
|
|
39
43
|
|
|
40
|
-
# Verify
|
|
41
|
-
app_jac_path = os.path.join(project_path, "
|
|
44
|
+
# Verify main.jac file was created at project root
|
|
45
|
+
app_jac_path = os.path.join(project_path, "main.jac")
|
|
42
46
|
assert os.path.exists(app_jac_path)
|
|
43
47
|
|
|
44
48
|
with open(app_jac_path) as f:
|
|
@@ -54,7 +58,7 @@ def test_create_jac_app() -> None:
|
|
|
54
58
|
readme_content = f.read()
|
|
55
59
|
|
|
56
60
|
assert f"# {test_project_name}" in readme_content
|
|
57
|
-
assert "jac
|
|
61
|
+
assert "jac start main.jac" in readme_content
|
|
58
62
|
|
|
59
63
|
# Verify jac.toml was created
|
|
60
64
|
jac_toml_path = os.path.join(project_path, "jac.toml")
|
|
@@ -65,6 +69,10 @@ def test_create_jac_app() -> None:
|
|
|
65
69
|
|
|
66
70
|
assert config_data["project"]["name"] == test_project_name
|
|
67
71
|
|
|
72
|
+
# Verify serve config includes base_route_app for CL apps
|
|
73
|
+
assert "serve" in config_data
|
|
74
|
+
assert config_data["serve"]["base_route_app"] == "app"
|
|
75
|
+
|
|
68
76
|
# Verify .gitignore was created with correct content
|
|
69
77
|
gitignore_path = os.path.join(project_path, ".gitignore")
|
|
70
78
|
assert os.path.exists(gitignore_path)
|
|
@@ -74,13 +82,13 @@ def test_create_jac_app() -> None:
|
|
|
74
82
|
|
|
75
83
|
assert "node_modules" in gitignore_content
|
|
76
84
|
|
|
77
|
-
# Verify
|
|
78
|
-
components_dir = os.path.join(project_path, "
|
|
85
|
+
# Verify components directory exists at project root
|
|
86
|
+
components_dir = os.path.join(project_path, "components")
|
|
79
87
|
assert os.path.exists(components_dir)
|
|
80
88
|
|
|
81
89
|
# Verify default packages installation (package.json should be generated)
|
|
82
90
|
package_json_path = os.path.join(
|
|
83
|
-
project_path, ".client
|
|
91
|
+
project_path, ".jac", "client", "configs", "package.json"
|
|
84
92
|
)
|
|
85
93
|
# Note: packages may or may not be installed depending on npm availability
|
|
86
94
|
# but package.json should be generated with default packages
|
|
@@ -91,9 +99,8 @@ def test_create_jac_app() -> None:
|
|
|
91
99
|
package_data = json.load(f)
|
|
92
100
|
|
|
93
101
|
# Verify default dependencies are in package.json
|
|
94
|
-
assert "
|
|
95
|
-
assert "
|
|
96
|
-
assert "vite" in package_data.get("devDependencies", {})
|
|
102
|
+
assert "jac-client-node" in package_data.get("dependencies", {})
|
|
103
|
+
assert "@jac-client/dev-deps" in package_data.get("devDependencies", {})
|
|
97
104
|
|
|
98
105
|
finally:
|
|
99
106
|
# Return to original directory
|
|
@@ -101,24 +108,29 @@ def test_create_jac_app() -> None:
|
|
|
101
108
|
|
|
102
109
|
|
|
103
110
|
def test_create_jac_app_invalid_name() -> None:
|
|
104
|
-
"""Test jac create --
|
|
111
|
+
"""Test jac create --use client command with project names containing spaces.
|
|
112
|
+
|
|
113
|
+
Note: The current implementation allows names with spaces. This test
|
|
114
|
+
verifies that such projects are created successfully.
|
|
115
|
+
"""
|
|
105
116
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
106
117
|
original_cwd = os.getcwd()
|
|
107
118
|
try:
|
|
108
119
|
os.chdir(temp_dir)
|
|
109
120
|
|
|
110
|
-
# Test with
|
|
121
|
+
# Test with name containing spaces (currently allowed)
|
|
111
122
|
result = run(
|
|
112
|
-
["jac", "create", "--
|
|
123
|
+
["jac", "create", "--use", "client", "--skip", "name with spaces"],
|
|
113
124
|
capture_output=True,
|
|
114
125
|
text=True,
|
|
115
126
|
)
|
|
116
127
|
|
|
117
|
-
#
|
|
118
|
-
assert result.returncode
|
|
128
|
+
# Currently succeeds - names with spaces are allowed
|
|
129
|
+
assert result.returncode == 0
|
|
130
|
+
# Check for success message (handles both old and new console formats)
|
|
119
131
|
assert (
|
|
120
|
-
"Project name
|
|
121
|
-
in result.
|
|
132
|
+
"Project 'name with spaces' created successfully!" in result.stdout
|
|
133
|
+
or "Project 'name with spaces' created" in result.stdout
|
|
122
134
|
)
|
|
123
135
|
|
|
124
136
|
finally:
|
|
@@ -126,7 +138,7 @@ def test_create_jac_app_invalid_name() -> None:
|
|
|
126
138
|
|
|
127
139
|
|
|
128
140
|
def test_create_jac_app_existing_directory() -> None:
|
|
129
|
-
"""Test jac create --
|
|
141
|
+
"""Test jac create --use client command when directory already exists."""
|
|
130
142
|
test_project_name = "existing-test-app"
|
|
131
143
|
|
|
132
144
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
@@ -139,7 +151,7 @@ def test_create_jac_app_existing_directory() -> None:
|
|
|
139
151
|
|
|
140
152
|
# Try to create app with same name
|
|
141
153
|
process = Popen(
|
|
142
|
-
["jac", "create", "--
|
|
154
|
+
["jac", "create", "--use", "client", test_project_name],
|
|
143
155
|
stdin=PIPE,
|
|
144
156
|
stdout=PIPE,
|
|
145
157
|
stderr=PIPE,
|
|
@@ -156,9 +168,9 @@ def test_create_jac_app_existing_directory() -> None:
|
|
|
156
168
|
os.chdir(original_cwd)
|
|
157
169
|
|
|
158
170
|
|
|
159
|
-
def
|
|
160
|
-
"""Test jac create --
|
|
161
|
-
test_project_name = "test-jac-app-
|
|
171
|
+
def test_create_jac_app_with_button_component() -> None:
|
|
172
|
+
"""Test jac create --use client command creates Button.cl.jac component."""
|
|
173
|
+
test_project_name = "test-jac-app-component"
|
|
162
174
|
|
|
163
175
|
# Create a temporary directory for testing
|
|
164
176
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
@@ -167,9 +179,9 @@ def test_create_jac_app_with_typescript() -> None:
|
|
|
167
179
|
# Change to temp directory
|
|
168
180
|
os.chdir(temp_dir)
|
|
169
181
|
|
|
170
|
-
# Run jac create --
|
|
182
|
+
# Run jac create --use client command
|
|
171
183
|
process = Popen(
|
|
172
|
-
["jac", "create", "--
|
|
184
|
+
["jac", "create", "--use", "client", test_project_name],
|
|
173
185
|
stdin=PIPE,
|
|
174
186
|
stdout=PIPE,
|
|
175
187
|
stderr=PIPE,
|
|
@@ -180,7 +192,11 @@ def test_create_jac_app_with_typescript() -> None:
|
|
|
180
192
|
|
|
181
193
|
# Check that command succeeded
|
|
182
194
|
assert result_code == 0
|
|
183
|
-
|
|
195
|
+
# Check for success message (handles both old and new console formats)
|
|
196
|
+
assert (
|
|
197
|
+
f"Project '{test_project_name}' created successfully!" in stdout
|
|
198
|
+
or f"Project '{test_project_name}' created" in stdout
|
|
199
|
+
)
|
|
184
200
|
|
|
185
201
|
# Verify project directory was created
|
|
186
202
|
project_path = os.path.join(temp_dir, test_project_name)
|
|
@@ -196,45 +212,47 @@ def test_create_jac_app_with_typescript() -> None:
|
|
|
196
212
|
|
|
197
213
|
assert config_data["project"]["name"] == test_project_name
|
|
198
214
|
|
|
199
|
-
# Verify
|
|
200
|
-
|
|
215
|
+
# Verify serve config includes base_route_app for CL apps
|
|
216
|
+
assert "serve" in config_data
|
|
217
|
+
assert config_data["serve"]["base_route_app"] == "app"
|
|
218
|
+
|
|
219
|
+
# Verify components directory and Button.cl.jac were created at project root
|
|
220
|
+
components_dir = os.path.join(project_path, "components")
|
|
201
221
|
assert os.path.exists(components_dir)
|
|
202
222
|
assert os.path.isdir(components_dir)
|
|
203
223
|
|
|
204
|
-
|
|
205
|
-
assert os.path.exists(
|
|
224
|
+
button_jac_path = os.path.join(components_dir, "Button.cl.jac")
|
|
225
|
+
assert os.path.exists(button_jac_path)
|
|
206
226
|
|
|
207
|
-
with open(
|
|
227
|
+
with open(button_jac_path) as f:
|
|
208
228
|
button_content = f.read()
|
|
209
229
|
|
|
210
|
-
assert "
|
|
211
|
-
assert "
|
|
230
|
+
assert "def:pub Button" in button_content
|
|
231
|
+
assert "base_styles" in button_content
|
|
212
232
|
|
|
213
|
-
# Verify
|
|
214
|
-
app_jac_path = os.path.join(project_path, "
|
|
233
|
+
# Verify main.jac includes Jac component import
|
|
234
|
+
app_jac_path = os.path.join(project_path, "main.jac")
|
|
215
235
|
assert os.path.exists(app_jac_path)
|
|
216
236
|
|
|
217
237
|
with open(app_jac_path) as f:
|
|
218
238
|
app_jac_content = f.read()
|
|
219
239
|
|
|
220
|
-
assert
|
|
221
|
-
'cl import from ".components/Button.tsx" { Button }' in app_jac_content
|
|
222
|
-
)
|
|
240
|
+
assert "cl import from .components.Button { Button }" in app_jac_content
|
|
223
241
|
assert "<Button" in app_jac_content
|
|
224
242
|
|
|
225
|
-
# Verify README.md includes
|
|
243
|
+
# Verify README.md includes component information
|
|
226
244
|
readme_path = os.path.join(project_path, "README.md")
|
|
227
245
|
assert os.path.exists(readme_path)
|
|
228
246
|
|
|
229
247
|
with open(readme_path) as f:
|
|
230
248
|
readme_content = f.read()
|
|
231
249
|
|
|
232
|
-
assert "
|
|
233
|
-
assert "
|
|
250
|
+
assert "Components" in readme_content
|
|
251
|
+
assert "Button.cl.jac" in readme_content
|
|
234
252
|
|
|
235
253
|
# Verify default packages installation (package.json should be generated)
|
|
236
254
|
package_json_path = os.path.join(
|
|
237
|
-
project_path, ".client
|
|
255
|
+
project_path, ".jac", "client", "configs", "package.json"
|
|
238
256
|
)
|
|
239
257
|
# Note: packages may or may not be installed depending on npm availability
|
|
240
258
|
# but package.json should be generated with default packages
|
|
@@ -245,10 +263,8 @@ def test_create_jac_app_with_typescript() -> None:
|
|
|
245
263
|
package_data = json.load(f)
|
|
246
264
|
|
|
247
265
|
# Verify default dependencies are in package.json
|
|
248
|
-
assert "
|
|
249
|
-
assert "
|
|
250
|
-
assert "vite" in package_data.get("devDependencies", {})
|
|
251
|
-
assert "typescript" in package_data.get("devDependencies", {})
|
|
266
|
+
assert "jac-client-node" in package_data.get("dependencies", {})
|
|
267
|
+
assert "@jac-client/dev-deps" in package_data.get("devDependencies", {})
|
|
252
268
|
|
|
253
269
|
finally:
|
|
254
270
|
# Return to original directory
|
|
@@ -256,7 +272,7 @@ def test_create_jac_app_with_typescript() -> None:
|
|
|
256
272
|
|
|
257
273
|
|
|
258
274
|
def test_create_jac_app_with_skip_flag() -> None:
|
|
259
|
-
"""Test jac create --
|
|
275
|
+
"""Test jac create --use client --skip command skips package installation."""
|
|
260
276
|
test_project_name = "test-jac-app-skip"
|
|
261
277
|
|
|
262
278
|
# Create a temporary directory for testing
|
|
@@ -266,9 +282,9 @@ def test_create_jac_app_with_skip_flag() -> None:
|
|
|
266
282
|
# Change to temp directory
|
|
267
283
|
os.chdir(temp_dir)
|
|
268
284
|
|
|
269
|
-
# Run jac create --
|
|
285
|
+
# Run jac create --use client --skip command
|
|
270
286
|
process = Popen(
|
|
271
|
-
["jac", "create", "--
|
|
287
|
+
["jac", "create", "--use", "client", "--skip", test_project_name],
|
|
272
288
|
stdin=PIPE,
|
|
273
289
|
stdout=PIPE,
|
|
274
290
|
stderr=PIPE,
|
|
@@ -279,7 +295,11 @@ def test_create_jac_app_with_skip_flag() -> None:
|
|
|
279
295
|
|
|
280
296
|
# Check that command succeeded
|
|
281
297
|
assert result_code == 0
|
|
282
|
-
|
|
298
|
+
# Check for success message (handles both old and new console formats)
|
|
299
|
+
assert (
|
|
300
|
+
f"Project '{test_project_name}' created successfully!" in stdout
|
|
301
|
+
or f"Project '{test_project_name}' created" in stdout
|
|
302
|
+
)
|
|
283
303
|
|
|
284
304
|
# Verify project directory was created
|
|
285
305
|
project_path = os.path.join(temp_dir, test_project_name)
|
|
@@ -300,7 +320,7 @@ def test_create_jac_app_with_skip_flag() -> None:
|
|
|
300
320
|
|
|
301
321
|
|
|
302
322
|
def test_create_jac_app_installs_default_packages() -> None:
|
|
303
|
-
"""Test jac create --
|
|
323
|
+
"""Test jac create --use client command attempts to install default packages."""
|
|
304
324
|
test_project_name = "test-jac-app-install"
|
|
305
325
|
|
|
306
326
|
# Create a temporary directory for testing
|
|
@@ -310,9 +330,9 @@ def test_create_jac_app_installs_default_packages() -> None:
|
|
|
310
330
|
# Change to temp directory
|
|
311
331
|
os.chdir(temp_dir)
|
|
312
332
|
|
|
313
|
-
# Run jac create --
|
|
333
|
+
# Run jac create --use client command
|
|
314
334
|
process = Popen(
|
|
315
|
-
["jac", "create", "--
|
|
335
|
+
["jac", "create", "--use", "client", test_project_name],
|
|
316
336
|
stdin=PIPE,
|
|
317
337
|
stdout=PIPE,
|
|
318
338
|
stderr=PIPE,
|
|
@@ -323,18 +343,23 @@ def test_create_jac_app_installs_default_packages() -> None:
|
|
|
323
343
|
|
|
324
344
|
# Check that command succeeded
|
|
325
345
|
assert result_code == 0
|
|
326
|
-
|
|
346
|
+
# Check for success message (handles both old and new console formats)
|
|
347
|
+
assert (
|
|
348
|
+
f"Project '{test_project_name}' created successfully!" in stdout
|
|
349
|
+
or f"Project '{test_project_name}' created" in stdout
|
|
350
|
+
)
|
|
327
351
|
|
|
328
352
|
# Verify project directory was created
|
|
329
353
|
project_path = os.path.join(temp_dir, test_project_name)
|
|
330
354
|
assert os.path.exists(project_path)
|
|
331
355
|
|
|
332
|
-
# Verify that
|
|
333
|
-
|
|
356
|
+
# Verify that package.json was generated - this confirms the setup worked
|
|
357
|
+
# Note: Package installation output may go to stderr or use rich formatting
|
|
358
|
+
# that doesn't capture cleanly in subprocess output
|
|
334
359
|
|
|
335
360
|
# Verify package.json was generated (even if npm install failed)
|
|
336
361
|
package_json_path = os.path.join(
|
|
337
|
-
project_path, ".client
|
|
362
|
+
project_path, ".jac", "client", "configs", "package.json"
|
|
338
363
|
)
|
|
339
364
|
# package.json should be generated with default packages
|
|
340
365
|
if os.path.exists(package_json_path):
|
|
@@ -343,17 +368,9 @@ def test_create_jac_app_installs_default_packages() -> None:
|
|
|
343
368
|
with open(package_json_path) as f:
|
|
344
369
|
package_data = json.load(f)
|
|
345
370
|
|
|
346
|
-
# Verify default dependencies are in package.
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
assert "react" in deps
|
|
351
|
-
assert "react-dom" in deps
|
|
352
|
-
assert "react-router-dom" in deps
|
|
353
|
-
assert "vite" in dev_deps
|
|
354
|
-
assert "@babel/core" in dev_deps
|
|
355
|
-
assert "typescript" in dev_deps
|
|
356
|
-
assert "@types/react" in dev_deps
|
|
371
|
+
# Verify default dependencies are in package.
|
|
372
|
+
assert "jac-client-node" in package_data.get("dependencies", {})
|
|
373
|
+
assert "@jac-client/dev-deps" in package_data.get("devDependencies", {})
|
|
357
374
|
|
|
358
375
|
finally:
|
|
359
376
|
# Return to original directory
|
|
@@ -428,29 +445,31 @@ entry-point = "app.jac"
|
|
|
428
445
|
|
|
429
446
|
|
|
430
447
|
def test_install_without_cl_flag() -> None:
|
|
431
|
-
"""Test add command without --
|
|
448
|
+
"""Test add command without --npm flag should skip silently when no jac.toml exists."""
|
|
432
449
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
433
450
|
original_cwd = os.getcwd()
|
|
434
451
|
try:
|
|
435
452
|
os.chdir(temp_dir)
|
|
436
453
|
|
|
437
|
-
# Run add command without --
|
|
454
|
+
# Run add command without --npm flag and without jac.toml
|
|
438
455
|
result = run(
|
|
439
456
|
["jac", "add", "lodash"],
|
|
440
457
|
capture_output=True,
|
|
441
458
|
text=True,
|
|
442
459
|
)
|
|
443
460
|
|
|
444
|
-
# Should
|
|
445
|
-
assert result.returncode
|
|
446
|
-
|
|
461
|
+
# Should skip silently (return 0) when no jac.toml exists
|
|
462
|
+
assert result.returncode == 0
|
|
463
|
+
# No error message should be printed
|
|
464
|
+
assert "No jac.toml found" not in result.stderr
|
|
465
|
+
assert "No jac.toml found" not in result.stdout
|
|
447
466
|
|
|
448
467
|
finally:
|
|
449
468
|
os.chdir(original_cwd)
|
|
450
469
|
|
|
451
470
|
|
|
452
471
|
def test_install_all_packages() -> None:
|
|
453
|
-
"""Test add --
|
|
472
|
+
"""Test add --npm command installs all packages from jac.toml."""
|
|
454
473
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
455
474
|
original_cwd = os.getcwd()
|
|
456
475
|
try:
|
|
@@ -459,24 +478,31 @@ def test_install_all_packages() -> None:
|
|
|
459
478
|
# Create jac.toml with some dependencies
|
|
460
479
|
_create_jac_toml(temp_dir, deps='lodash = "^4.17.21"')
|
|
461
480
|
|
|
462
|
-
# Run add --
|
|
481
|
+
# Run add --npm command without package name
|
|
463
482
|
result = run(
|
|
464
|
-
["jac", "add", "--
|
|
483
|
+
["jac", "add", "--npm"],
|
|
465
484
|
capture_output=True,
|
|
466
485
|
text=True,
|
|
467
486
|
)
|
|
468
487
|
|
|
469
488
|
# Should succeed
|
|
470
489
|
assert result.returncode == 0
|
|
471
|
-
|
|
472
|
-
assert
|
|
490
|
+
# Check for install messages (handles both old and new console formats)
|
|
491
|
+
assert (
|
|
492
|
+
"Installing all npm packages" in result.stdout
|
|
493
|
+
or "Installing all npm packages" in result.stdout.lower()
|
|
494
|
+
)
|
|
495
|
+
assert (
|
|
496
|
+
"Installed all npm packages successfully" in result.stdout
|
|
497
|
+
or "Installed all npm packages" in result.stdout
|
|
498
|
+
)
|
|
473
499
|
|
|
474
500
|
finally:
|
|
475
501
|
os.chdir(original_cwd)
|
|
476
502
|
|
|
477
503
|
|
|
478
504
|
def test_install_package_to_dependencies() -> None:
|
|
479
|
-
"""Test add --
|
|
505
|
+
"""Test add --npm command adds package to dependencies."""
|
|
480
506
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
481
507
|
original_cwd = os.getcwd()
|
|
482
508
|
try:
|
|
@@ -485,17 +511,25 @@ def test_install_package_to_dependencies() -> None:
|
|
|
485
511
|
# Create jac.toml
|
|
486
512
|
config_path = _create_jac_toml(temp_dir)
|
|
487
513
|
|
|
488
|
-
# Run add --
|
|
514
|
+
# Run add --npm command with package name
|
|
489
515
|
result = run(
|
|
490
|
-
["jac", "add", "--
|
|
516
|
+
["jac", "add", "--npm", "lodash"],
|
|
491
517
|
capture_output=True,
|
|
492
518
|
text=True,
|
|
493
519
|
)
|
|
494
520
|
|
|
495
521
|
# Should succeed
|
|
496
522
|
assert result.returncode == 0
|
|
497
|
-
|
|
498
|
-
assert
|
|
523
|
+
# Check for package add messages (handles both old and new console formats)
|
|
524
|
+
assert (
|
|
525
|
+
"Adding lodash (npm)" in result.stdout
|
|
526
|
+
or "lodash" in result.stdout.lower()
|
|
527
|
+
)
|
|
528
|
+
assert (
|
|
529
|
+
"Added 1 package(s) to [dependencies.npm]" in result.stdout
|
|
530
|
+
or "Updated jac.toml" in result.stdout
|
|
531
|
+
or "dependencies.npm" in result.stdout
|
|
532
|
+
)
|
|
499
533
|
|
|
500
534
|
# Verify package was added to jac.toml
|
|
501
535
|
with open(config_path, "rb") as f:
|
|
@@ -508,7 +542,7 @@ def test_install_package_to_dependencies() -> None:
|
|
|
508
542
|
|
|
509
543
|
|
|
510
544
|
def test_install_package_with_version() -> None:
|
|
511
|
-
"""Test add --
|
|
545
|
+
"""Test add --npm command with specific version."""
|
|
512
546
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
513
547
|
original_cwd = os.getcwd()
|
|
514
548
|
try:
|
|
@@ -517,17 +551,25 @@ def test_install_package_with_version() -> None:
|
|
|
517
551
|
# Create jac.toml
|
|
518
552
|
config_path = _create_jac_toml(temp_dir)
|
|
519
553
|
|
|
520
|
-
# Run add --
|
|
554
|
+
# Run add --npm command with package and version
|
|
521
555
|
result = run(
|
|
522
|
-
["jac", "add", "--
|
|
556
|
+
["jac", "add", "--npm", "lodash@^4.17.21"],
|
|
523
557
|
capture_output=True,
|
|
524
558
|
text=True,
|
|
525
559
|
)
|
|
526
560
|
|
|
527
561
|
# Should succeed
|
|
528
562
|
assert result.returncode == 0
|
|
529
|
-
|
|
530
|
-
assert
|
|
563
|
+
# Check for package add messages (handles both old and new console formats)
|
|
564
|
+
assert (
|
|
565
|
+
"Adding lodash (npm)" in result.stdout
|
|
566
|
+
or "lodash" in result.stdout.lower()
|
|
567
|
+
)
|
|
568
|
+
assert (
|
|
569
|
+
"Added 1 package(s) to [dependencies.npm]" in result.stdout
|
|
570
|
+
or "Updated jac.toml" in result.stdout
|
|
571
|
+
or "dependencies.npm" in result.stdout
|
|
572
|
+
)
|
|
531
573
|
|
|
532
574
|
# Verify package was added with correct version
|
|
533
575
|
with open(config_path, "rb") as f:
|
|
@@ -540,7 +582,7 @@ def test_install_package_with_version() -> None:
|
|
|
540
582
|
|
|
541
583
|
|
|
542
584
|
def test_install_package_to_devdependencies() -> None:
|
|
543
|
-
"""Test add --
|
|
585
|
+
"""Test add --npm -d command adds package to dev-dependencies."""
|
|
544
586
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
545
587
|
original_cwd = os.getcwd()
|
|
546
588
|
try:
|
|
@@ -549,9 +591,9 @@ def test_install_package_to_devdependencies() -> None:
|
|
|
549
591
|
# Create jac.toml
|
|
550
592
|
config_path = _create_jac_toml(temp_dir)
|
|
551
593
|
|
|
552
|
-
# Run add --
|
|
594
|
+
# Run add --npm -d command
|
|
553
595
|
run(
|
|
554
|
-
["jac", "add", "--
|
|
596
|
+
["jac", "add", "--npm", "-d", "@types/react"],
|
|
555
597
|
capture_output=True,
|
|
556
598
|
text=True,
|
|
557
599
|
)
|
|
@@ -571,15 +613,15 @@ def test_install_package_to_devdependencies() -> None:
|
|
|
571
613
|
|
|
572
614
|
|
|
573
615
|
def test_install_without_config_json() -> None:
|
|
574
|
-
"""Test add --
|
|
616
|
+
"""Test add --npm command when jac.toml doesn't exist."""
|
|
575
617
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
576
618
|
original_cwd = os.getcwd()
|
|
577
619
|
try:
|
|
578
620
|
os.chdir(temp_dir)
|
|
579
621
|
|
|
580
|
-
# Run add --
|
|
622
|
+
# Run add --npm command without jac.toml
|
|
581
623
|
result = run(
|
|
582
|
-
["jac", "add", "--
|
|
624
|
+
["jac", "add", "--npm", "lodash"],
|
|
583
625
|
capture_output=True,
|
|
584
626
|
text=True,
|
|
585
627
|
)
|
|
@@ -593,13 +635,13 @@ def test_install_without_config_json() -> None:
|
|
|
593
635
|
|
|
594
636
|
|
|
595
637
|
def test_uninstall_without_cl_flag() -> None:
|
|
596
|
-
"""Test remove command without --
|
|
638
|
+
"""Test remove command without --npm flag should fail when no jac.toml exists."""
|
|
597
639
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
598
640
|
original_cwd = os.getcwd()
|
|
599
641
|
try:
|
|
600
642
|
os.chdir(temp_dir)
|
|
601
643
|
|
|
602
|
-
# Run remove command without --
|
|
644
|
+
# Run remove command without --npm flag and without jac.toml
|
|
603
645
|
result = run(
|
|
604
646
|
["jac", "remove", "lodash"],
|
|
605
647
|
capture_output=True,
|
|
@@ -615,7 +657,7 @@ def test_uninstall_without_cl_flag() -> None:
|
|
|
615
657
|
|
|
616
658
|
|
|
617
659
|
def test_uninstall_without_package_name() -> None:
|
|
618
|
-
"""Test remove --
|
|
660
|
+
"""Test remove --npm command without package name should fail."""
|
|
619
661
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
620
662
|
original_cwd = os.getcwd()
|
|
621
663
|
try:
|
|
@@ -624,9 +666,9 @@ def test_uninstall_without_package_name() -> None:
|
|
|
624
666
|
# Create jac.toml
|
|
625
667
|
_create_jac_toml(temp_dir)
|
|
626
668
|
|
|
627
|
-
# Run remove --
|
|
669
|
+
# Run remove --npm command without package name
|
|
628
670
|
result = run(
|
|
629
|
-
["jac", "remove", "--
|
|
671
|
+
["jac", "remove", "--npm"],
|
|
630
672
|
capture_output=True,
|
|
631
673
|
text=True,
|
|
632
674
|
)
|
|
@@ -640,7 +682,7 @@ def test_uninstall_without_package_name() -> None:
|
|
|
640
682
|
|
|
641
683
|
|
|
642
684
|
def test_uninstall_package_from_dependencies() -> None:
|
|
643
|
-
"""Test remove --
|
|
685
|
+
"""Test remove --npm command removes package from dependencies."""
|
|
644
686
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
645
687
|
original_cwd = os.getcwd()
|
|
646
688
|
try:
|
|
@@ -649,9 +691,9 @@ def test_uninstall_package_from_dependencies() -> None:
|
|
|
649
691
|
# Create jac.toml with a package
|
|
650
692
|
config_path = _create_jac_toml(temp_dir, deps='lodash = "^4.17.21"')
|
|
651
693
|
|
|
652
|
-
# Run remove --
|
|
694
|
+
# Run remove --npm command
|
|
653
695
|
result = run(
|
|
654
|
-
["jac", "remove", "--
|
|
696
|
+
["jac", "remove", "--npm", "lodash"],
|
|
655
697
|
capture_output=True,
|
|
656
698
|
text=True,
|
|
657
699
|
)
|
|
@@ -674,7 +716,7 @@ def test_uninstall_package_from_dependencies() -> None:
|
|
|
674
716
|
|
|
675
717
|
|
|
676
718
|
def test_uninstall_package_from_devdependencies() -> None:
|
|
677
|
-
"""Test remove --
|
|
719
|
+
"""Test remove --npm -d command removes package from dev-dependencies."""
|
|
678
720
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
679
721
|
original_cwd = os.getcwd()
|
|
680
722
|
try:
|
|
@@ -685,9 +727,9 @@ def test_uninstall_package_from_devdependencies() -> None:
|
|
|
685
727
|
temp_dir, dev_deps='"@types/react" = "^18.0.0"'
|
|
686
728
|
)
|
|
687
729
|
|
|
688
|
-
# Run remove --
|
|
730
|
+
# Run remove --npm -d command
|
|
689
731
|
result = run(
|
|
690
|
-
["jac", "remove", "--
|
|
732
|
+
["jac", "remove", "--npm", "-d", "@types/react"],
|
|
691
733
|
capture_output=True,
|
|
692
734
|
text=True,
|
|
693
735
|
)
|
|
@@ -709,7 +751,7 @@ def test_uninstall_package_from_devdependencies() -> None:
|
|
|
709
751
|
|
|
710
752
|
|
|
711
753
|
def test_uninstall_nonexistent_package() -> None:
|
|
712
|
-
"""Test remove --
|
|
754
|
+
"""Test remove --npm command with non-existent package should fail."""
|
|
713
755
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
714
756
|
original_cwd = os.getcwd()
|
|
715
757
|
try:
|
|
@@ -718,9 +760,9 @@ def test_uninstall_nonexistent_package() -> None:
|
|
|
718
760
|
# Create jac.toml without the package
|
|
719
761
|
_create_jac_toml(temp_dir)
|
|
720
762
|
|
|
721
|
-
# Run remove --
|
|
763
|
+
# Run remove --npm command with non-existent package
|
|
722
764
|
result = run(
|
|
723
|
-
["jac", "remove", "--
|
|
765
|
+
["jac", "remove", "--npm", "nonexistent-package"],
|
|
724
766
|
capture_output=True,
|
|
725
767
|
text=True,
|
|
726
768
|
)
|
|
@@ -734,15 +776,15 @@ def test_uninstall_nonexistent_package() -> None:
|
|
|
734
776
|
|
|
735
777
|
|
|
736
778
|
def test_uninstall_without_config_toml() -> None:
|
|
737
|
-
"""Test remove --
|
|
779
|
+
"""Test remove --npm command when jac.toml doesn't exist."""
|
|
738
780
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
739
781
|
original_cwd = os.getcwd()
|
|
740
782
|
try:
|
|
741
783
|
os.chdir(temp_dir)
|
|
742
784
|
|
|
743
|
-
# Run remove --
|
|
785
|
+
# Run remove --npm command without jac.toml
|
|
744
786
|
result = run(
|
|
745
|
-
["jac", "remove", "--
|
|
787
|
+
["jac", "remove", "--npm", "lodash"],
|
|
746
788
|
capture_output=True,
|
|
747
789
|
text=True,
|
|
748
790
|
)
|
|
@@ -753,3 +795,128 @@ def test_uninstall_without_config_toml() -> None:
|
|
|
753
795
|
|
|
754
796
|
finally:
|
|
755
797
|
os.chdir(original_cwd)
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
def test_config_files_from_jac_toml() -> None:
|
|
801
|
+
"""Test that [plugins.client.configs] in jac.toml generates config files."""
|
|
802
|
+
with tempfile.TemporaryDirectory() as temp_dir:
|
|
803
|
+
original_cwd = os.getcwd()
|
|
804
|
+
try:
|
|
805
|
+
os.chdir(temp_dir)
|
|
806
|
+
|
|
807
|
+
# Create jac.toml with postcss and tailwind configs
|
|
808
|
+
toml_content = """[project]
|
|
809
|
+
name = "test-configs"
|
|
810
|
+
version = "1.0.0"
|
|
811
|
+
description = "Test project"
|
|
812
|
+
entry-point = "main.jac"
|
|
813
|
+
|
|
814
|
+
[plugins.client.configs.postcss]
|
|
815
|
+
plugins = ["tailwindcss", "autoprefixer"]
|
|
816
|
+
|
|
817
|
+
[plugins.client.configs.tailwind]
|
|
818
|
+
content = ["./**/*.jac", "./.jac/client/**/*.{js,jsx}"]
|
|
819
|
+
plugins = []
|
|
820
|
+
|
|
821
|
+
[plugins.client.configs.tailwind.theme.extend]
|
|
822
|
+
colors = { primary = "#3490dc" }
|
|
823
|
+
"""
|
|
824
|
+
config_path = os.path.join(temp_dir, "jac.toml")
|
|
825
|
+
with open(config_path, "w") as f:
|
|
826
|
+
f.write(toml_content)
|
|
827
|
+
|
|
828
|
+
# Import and use ViteBundler to generate config files
|
|
829
|
+
from pathlib import Path
|
|
830
|
+
|
|
831
|
+
from jac_client.plugin.src.vite_bundler import ViteBundler
|
|
832
|
+
|
|
833
|
+
bundler = ViteBundler(Path(temp_dir))
|
|
834
|
+
created_files = bundler.create_config_files()
|
|
835
|
+
|
|
836
|
+
# Verify two config files were created
|
|
837
|
+
assert len(created_files) == 2
|
|
838
|
+
|
|
839
|
+
# Verify postcss.config.js was created with correct content
|
|
840
|
+
configs_dir = os.path.join(temp_dir, ".jac", "client", "configs")
|
|
841
|
+
postcss_config = os.path.join(configs_dir, "postcss.config.js")
|
|
842
|
+
assert os.path.exists(postcss_config)
|
|
843
|
+
|
|
844
|
+
with open(postcss_config) as f:
|
|
845
|
+
postcss_content = f.read()
|
|
846
|
+
|
|
847
|
+
assert "module.exports" in postcss_content
|
|
848
|
+
assert "tailwindcss" in postcss_content
|
|
849
|
+
assert "autoprefixer" in postcss_content
|
|
850
|
+
|
|
851
|
+
# Verify tailwind.config.js was created with correct content
|
|
852
|
+
tailwind_config = os.path.join(configs_dir, "tailwind.config.js")
|
|
853
|
+
assert os.path.exists(tailwind_config)
|
|
854
|
+
|
|
855
|
+
with open(tailwind_config) as f:
|
|
856
|
+
tailwind_content = f.read()
|
|
857
|
+
|
|
858
|
+
assert "module.exports" in tailwind_content
|
|
859
|
+
assert "./**/*.jac" in tailwind_content
|
|
860
|
+
assert "#3490dc" in tailwind_content
|
|
861
|
+
|
|
862
|
+
finally:
|
|
863
|
+
os.chdir(original_cwd)
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
def test_create_cl_and_run_no_root_files() -> None:
|
|
867
|
+
"""Test that jac create --use client + jac run doesn't create files outside .jac/ directory."""
|
|
868
|
+
test_project_name = "test-cl-no-root-files"
|
|
869
|
+
|
|
870
|
+
with tempfile.TemporaryDirectory() as temp_dir:
|
|
871
|
+
original_cwd = os.getcwd()
|
|
872
|
+
try:
|
|
873
|
+
os.chdir(temp_dir)
|
|
874
|
+
|
|
875
|
+
# Run jac create --use client command
|
|
876
|
+
process = Popen(
|
|
877
|
+
["jac", "create", "--use", "client", test_project_name],
|
|
878
|
+
stdin=PIPE,
|
|
879
|
+
stdout=PIPE,
|
|
880
|
+
stderr=PIPE,
|
|
881
|
+
text=True,
|
|
882
|
+
)
|
|
883
|
+
stdout, stderr = process.communicate()
|
|
884
|
+
assert process.returncode == 0, f"jac create --use client failed: {stderr}"
|
|
885
|
+
|
|
886
|
+
project_path = os.path.join(temp_dir, test_project_name)
|
|
887
|
+
|
|
888
|
+
# Record files after create (before run), excluding .jac directory
|
|
889
|
+
def get_root_files(path: str) -> set[str]:
|
|
890
|
+
"""Get files/dirs in project root, excluding .jac directory."""
|
|
891
|
+
items = set()
|
|
892
|
+
for item in os.listdir(path):
|
|
893
|
+
if item != ".jac":
|
|
894
|
+
items.add(item)
|
|
895
|
+
return items
|
|
896
|
+
|
|
897
|
+
files_before_run = get_root_files(project_path)
|
|
898
|
+
|
|
899
|
+
# Run jac run main.jac
|
|
900
|
+
process = Popen(
|
|
901
|
+
["jac", "run", "main.jac"],
|
|
902
|
+
cwd=project_path,
|
|
903
|
+
stdin=PIPE,
|
|
904
|
+
stdout=PIPE,
|
|
905
|
+
stderr=PIPE,
|
|
906
|
+
text=True,
|
|
907
|
+
)
|
|
908
|
+
stdout, stderr = process.communicate()
|
|
909
|
+
assert process.returncode == 0, f"jac run failed: {stderr}"
|
|
910
|
+
|
|
911
|
+
# Record files after run
|
|
912
|
+
files_after_run = get_root_files(project_path)
|
|
913
|
+
|
|
914
|
+
# Check no new files were created in project root
|
|
915
|
+
new_files = files_after_run - files_before_run
|
|
916
|
+
assert not new_files, (
|
|
917
|
+
f"jac run created unexpected files in project root: {new_files}. "
|
|
918
|
+
"All runtime files should be in .jac/ directory."
|
|
919
|
+
)
|
|
920
|
+
|
|
921
|
+
finally:
|
|
922
|
+
os.chdir(original_cwd)
|