Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: require descriptive snapshot hints (#10892)

Shahmir Varqha3bea4391af90
diff --git a/frontend/.oxlintrc.json b/frontend/.oxlintrc.json
index 83f2f769bc..3c4caad1fc 100644
--- a/frontend/.oxlintrc.json
+++ b/frontend/.oxlintrc.json
@@ -72,8 +72,6 @@
"error",
{ "additionalTestBlockFunctions": ["beforeEach"] }
],
- "vitest/prefer-snapshot-hint": "off",
-
// === Core rules ===
"no-var": "error",
"no-console": "error",
diff --git a/frontend/src/components/editor/connections/database/__tests__/__snapshots__/as-code.test.ts.snap b/frontend/src/components/editor/connections/database/__tests__/__snapshots__/as-code.test.ts.snap
index 64b3298186..d482b88d2f 100644
--- a/frontend/src/components/editor/connections/database/__tests__/__snapshots__/as-code.test.ts.snap
+++ b/frontend/src/components/editor/connections/database/__tests__/__snapshots__/as-code.test.ts.snap
@@ -1,6 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
-exports[`generateDatabaseCode > basic connections > bigquery 1`] = `
+exports[`generateDatabaseCode > basic connections > bigquery > generated code 1`] = `
"import json
import sqlmodel
@@ -8,13 +8,13 @@ credentials = json.loads(r"""{"type": "service_account", "project_id": "test"}""
engine = sqlmodel.create_engine(f"bigquery://my-project/my_dataset", credentials_info=credentials)"
`;
-exports[`generateDatabaseCode > basic connections > chdb 1`] = `
+exports[`generateDatabaseCode > basic connections > chdb > generated code 1`] = `
"import chdb
engine = chdb.connect("file:///path/to/db.chdb", read_only=False)"
`;
-exports[`generateDatabaseCode > basic connections > clickhouse 1`] = `
+exports[`generateDatabaseCode > basic connections > clickhouse > generated code 1`] = `
"import clickhouse_connect
import os
@@ -28,7 +28,7 @@ engine = clickhouse_connect.get_client(
)"
`;
-exports[`generateDatabaseCode > basic connections > databricks 1`] = `
+exports[`generateDatabaseCode > basic connections > databricks > generated code 1`] = `
"import os
import sqlalchemy
@@ -39,7 +39,7 @@ DATABASE_URL = f"databricks://token:{_access_token}@{_server_hostname}?http_path
engine = sqlalchemy.create_engine(DATABASE_URL)"
`;
-exports[`generateDatabaseCode > basic connections > databricks with catalog and schema 1`] = `
+exports[`generateDatabaseCode > basic connections > databricks with catalog and schema > generated code 1`] = `
"import os
import sqlalchemy
@@ -50,7 +50,7 @@ DATABASE_URL = f"databricks://token:{_access_token}@{_server_hostname}?http_path
engine = sqlalchemy.create_engine(DATABASE_URL)"
`;
-exports[`generateDatabaseCode > basic connections > databricks with ibis 1`] = `
+exports[`generateDatabaseCode > basic connections > databricks with ibis > generated code 1`] = `
"import ibis
import os
@@ -64,14 +64,14 @@ engine = ibis.databricks.connect(
)"
`;
-exports[`generateDatabaseCode > basic connections > datafusion 1`] = `
+exports[`generateDatabaseCode > basic connections > datafusion > generated code 1`] = `
"from datafusion import SessionContext
import ibis
con = ibis.datafusion.connect()"
`;
-exports[`generateDatabaseCode > basic connections > datafusion with session 1`] = `
+exports[`generateDatabaseCode > basic connections > datafusion with session > generated code 1`] = `
"from datafusion import SessionContext
import ibis
@@ -82,20 +82,20 @@ _ = ctx.from_pydict({"a": [1, 2, 3]}, "my_table")
con = ibis.datafusion.connect(ctx)"
`;
-exports[`generateDatabaseCode > basic connections > duckdb 1`] = `
+exports[`generateDatabaseCode > basic connections > duckdb > generated code 1`] = `
"import duckdb
DATABASE_URL = "data.duckdb"
engine = duckdb.connect(DATABASE_URL, read_only=True)"
`;
-exports[`generateDatabaseCode > basic connections > iceberg configured catalog 1`] = `
+exports[`generateDatabaseCode > basic connections > iceberg configured catalog > generated code 1`] = `
"from pyiceberg.catalog import load_catalog
catalog = load_catalog("my_catalog")"
`;
-exports[`generateDatabaseCode > basic connections > iceberg dynamodb 1`] = `
+exports[`generateDatabaseCode > basic connections > iceberg dynamodb > generated code 1`] = `
"from pyiceberg.catalog.dynamodb import DynamoDBCatalog
catalog = DynamoDBCatalog(
@@ -110,7 +110,7 @@ catalog = DynamoDBCatalog(
)"
`;
-exports[`generateDatabaseCode > basic connections > iceberg glue 1`] = `
+exports[`generateDatabaseCode > basic connections > iceberg glue > generated code 1`] = `
"from pyiceberg.catalog.glue import GlueCatalog
catalog = GlueCatalog(
@@ -121,7 +121,7 @@ catalog = GlueCatalog(
)"
`;
-exports[`generateDatabaseCode > basic connections > iceberg hive 1`] = `
+exports[`generateDatabaseCode > basic connections > iceberg hive > generated code 1`] = `
"from pyiceberg.catalog.hive import HiveCatalog
catalog = HiveCatalog(
@@ -133,7 +133,7 @@ catalog = HiveCatalog(
)"
`;
-exports[`generateDatabaseCode > basic connections > iceberg rest 1`] = `
+exports[`generateDatabaseCode > basic connections > iceberg rest > generated code 1`] = `
"from pyiceberg.catalog.rest import RestCatalog
catalog = RestCatalog(
@@ -145,7 +145,7 @@ catalog = RestCatalog(
)"
`;
-exports[`generateDatabaseCode > basic connections > iceberg sql 1`] = `
+exports[`generateDatabaseCode > basic connections > iceberg sql > generated code 1`] = `
"from pyiceberg.catalog.sql import SqlCatalog
catalog = SqlCatalog(
@@ -157,7 +157,7 @@ catalog = SqlCatalog(
)"
`;
-exports[`generateDatabaseCode > basic connections > motherduck 1`] = `
+exports[`generateDatabaseCode > basic connections > motherduck > generated code 1`] = `
"import duckdb
import os
@@ -165,7 +165,7 @@ _password = os.environ.get("MOTHERDUCK_TOKEN", "my_token")
conn = duckdb.connect("md:my_db", config={"motherduck_token": _password})"
`;
-exports[`generateDatabaseCode > basic connections > mysql with SQLAlchemy 1`] = `
+exports[`generateDatabaseCode > basic connections > mysql with SQLAlchemy > generated code 1`] = `
"import os
import sqlalchemy
@@ -174,7 +174,7 @@ DATABASE_URL = f"mysql+pymysql://user:{_password}@localhost:3306/test"
engine = sqlalchemy.create_engine(DATABASE_URL, connect_args={'ssl': {'ssl-mode': 'preferred'}})"
`;
-exports[`generateDatabaseCode > basic connections > mysql with SQLModel 1`] = `
+exports[`generateDatabaseCode > basic connections > mysql with SQLModel > generated code 1`] = `
"import os
import sqlmodel
@@ -183,7 +183,7 @@ DATABASE_URL = f"mysql+pymysql://user:{_password}@localhost:3306/test"
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'ssl': {'ssl-mode': 'preferred'}})"
`;
-exports[`generateDatabaseCode > basic connections > postgres with SQLAlchemy 1`] = `
+exports[`generateDatabaseCode > basic connections > postgres with SQLAlchemy > generated code 1`] = `
"import os
import sqlalchemy
@@ -192,7 +192,7 @@ DATABASE_URL = f"postgresql://user:{_password}@localhost:5432/test"
engine = sqlalchemy.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > basic connections > postgres with SQLModel 1`] = `
+exports[`generateDatabaseCode > basic connections > postgres with SQLModel > generated code 1`] = `
"import os
import sqlmodel
@@ -201,14 +201,14 @@ DATABASE_URL = f"postgresql://user:{_password}@localhost:5432/test"
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > basic connections > pyspark 1`] = `
+exports[`generateDatabaseCode > basic connections > pyspark > generated code 1`] = `
"from pyspark.sql import SparkSession
import ibis
con = ibis.pyspark.connect()"
`;
-exports[`generateDatabaseCode > basic connections > pyspark with session 1`] = `
+exports[`generateDatabaseCode > basic connections > pyspark with session > generated code 1`] = `
"from pyspark.sql import SparkSession
import ibis
@@ -216,7 +216,7 @@ session = SparkSession.builder.remote(f"sc://localhost:15002").getOrCreate()
con = ibis.pyspark.connect(session)"
`;
-exports[`generateDatabaseCode > basic connections > redshift with DB credentials 1`] = `
+exports[`generateDatabaseCode > basic connections > redshift with DB credentials > generated code 1`] = `
"import os
import redshift_connector
@@ -230,7 +230,7 @@ con = redshift_connector.connect(
)"
`;
-exports[`generateDatabaseCode > basic connections > redshift with IAM credentials 1`] = `
+exports[`generateDatabaseCode > basic connections > redshift with IAM credentials > generated code 1`] = `
"import redshift_connector
con = redshift_connector.connect(
@@ -245,7 +245,7 @@ con = redshift_connector.connect(
)"
`;
-exports[`generateDatabaseCode > basic connections > snowflake 1`] = `
+exports[`generateDatabaseCode > basic connections > snowflake > generated code 1`] = `
"from snowflake.sqlalchemy import URL
import os
import sqlmodel
@@ -264,7 +264,7 @@ engine = sqlmodel.create_engine(
)"
`;
-exports[`generateDatabaseCode > basic connections > snowflake with MFA 1`] = `
+exports[`generateDatabaseCode > basic connections > snowflake with MFA > generated code 1`] = `
"from snowflake.sqlalchemy import URL
import os
import sqlmodel
@@ -284,7 +284,7 @@ engine = sqlmodel.create_engine(
)"
`;
-exports[`generateDatabaseCode > basic connections > snowflake with OAuth/PAT 1`] = `
+exports[`generateDatabaseCode > basic connections > snowflake with OAuth/PAT > generated code 1`] = `
"from snowflake.sqlalchemy import URL
import os
import sqlmodel
@@ -303,7 +303,7 @@ engine = sqlmodel.create_engine(
)"
`;
-exports[`generateDatabaseCode > basic connections > snowflake with SSO 1`] = `
+exports[`generateDatabaseCode > basic connections > snowflake with SSO > generated code 1`] = `
"from snowflake.sqlalchemy import URL
import sqlmodel
@@ -320,7 +320,7 @@ engine = sqlmodel.create_engine(
)"
`;
-exports[`generateDatabaseCode > basic connections > snowflake with key pair 1`] = `
+exports[`generateDatabaseCode > basic connections > snowflake with key pair > generated code 1`] = `
"from snowflake.sqlalchemy import URL
import os
import sqlmodel
@@ -343,14 +343,14 @@ engine = sqlmodel.create_engine(
)"
`;
-exports[`generateDatabaseCode > basic connections > sqlite 1`] = `
+exports[`generateDatabaseCode > basic connections > sqlite > generated code 1`] = `
"import sqlmodel
DATABASE_URL = "sqlite:////path/to/db.sqlite"
engine = sqlmodel.create_engine(DATABASE_URL)"
`;
-exports[`generateDatabaseCode > basic connections > supabase with SQLModel 1`] = `
+exports[`generateDatabaseCode > basic connections > supabase with SQLModel > generated code 1`] = `
"import os
import sqlmodel
@@ -359,7 +359,7 @@ DATABASE_URL = f"postgresql+psycopg2://postgres:{_password}@db.example.supabase.
engine = sqlmodel.create_engine(DATABASE_URL)"
`;
-exports[`generateDatabaseCode > basic connections > supabase with client-side pooling disabled 1`] = `
+exports[`generateDatabaseCode > basic connections > supabase with client-side pooling disabled > generated code 1`] = `
"from sqlalchemy.pool import NullPool
import os
import sqlalchemy
@@ -369,7 +369,7 @@ DATABASE_URL = f"postgresql+psycopg2://postgres.session:{_password}@db.example.s
engine = sqlalchemy.create_engine(DATABASE_URL, poolclass=NullPool)"
`;
-exports[`generateDatabaseCode > basic connections > timeplus 1`] = `
+exports[`generateDatabaseCode > basic connections > timeplus > generated code 1`] = `
"import os
import sqlalchemy
@@ -378,7 +378,7 @@ DATABASE_URL = f"timeplus://default:{_password}@localhost:8123"
engine = sqlalchemy.create_engine(DATABASE_URL)"
`;
-exports[`generateDatabaseCode > basic connections > trino 1`] = `
+exports[`generateDatabaseCode > basic connections > trino > generated code 1`] = `
"import os
import sqlmodel
import trino.sqlalchemy
@@ -387,7 +387,7 @@ _password = os.environ.get("TRINO_PASSWORD", "pass")
engine = sqlmodel.create_engine(f"trino://user:{_password}@localhost:8080/test")"
`;
-exports[`generateDatabaseCode > connections with secrets > bigquery with credentials as secret 1`] = `
+exports[`generateDatabaseCode > connections with secrets > bigquery with credentials as secret > generated code 1`] = `
"import json
import os
import sqlmodel
@@ -398,13 +398,13 @@ credentials = json.loads(r"""{"type": "service_account", "project_id": "test"}""
engine = sqlmodel.create_engine(f"bigquery://{_project}/{_dataset}", credentials_info=credentials)"
`;
-exports[`generateDatabaseCode > connections with secrets > bigquery with credentials_json as a file path 1`] = `
+exports[`generateDatabaseCode > connections with secrets > bigquery with credentials_json as a file path > generated code 1`] = `
"import sqlmodel
engine = sqlmodel.create_engine(f"bigquery://my-project/my_dataset", credentials_path="/etc/secrets/bigquery.json")"
`;
-exports[`generateDatabaseCode > connections with secrets > bigquery with credentials_json as secret 1`] = `
+exports[`generateDatabaseCode > connections with secrets > bigquery with credentials_json as secret > generated code 1`] = `
"import json
import os
import sqlmodel
@@ -414,7 +414,7 @@ credentials = json.loads(_credentials_json)
engine = sqlmodel.create_engine(f"bigquery://my-project/my_dataset", credentials_info=credentials)"
`;
-exports[`generateDatabaseCode > connections with secrets > clickhouse with all connection details as secrets 1`] = `
+exports[`generateDatabaseCode > connections with secrets > clickhouse with all connection details as secrets > generated code 1`] = `
"import clickhouse_connect
import os
@@ -430,7 +430,7 @@ engine = clickhouse_connect.get_client(
)"
`;
-exports[`generateDatabaseCode > connections with secrets > motherduck with token as secret 1`] = `
+exports[`generateDatabaseCode > connections with secrets > motherduck with token as secret > generated code 1`] = `
"import duckdb
import os
@@ -438,7 +438,7 @@ _password = os.environ.get("ENV_TOKEN")
conn = duckdb.connect("md:my_db", config={"motherduck_token": _password})"
`;
-exports[`generateDatabaseCode > connections with secrets > mysql with username and password as secrets 1`] = `
+exports[`generateDatabaseCode > connections with secrets > mysql with username and password as secrets > generated code 1`] = `
"import os
import sqlalchemy
@@ -448,7 +448,7 @@ DATABASE_URL = f"mysql+pymysql://{_username}:{_password}@localhost:3306/test"
engine = sqlalchemy.create_engine(DATABASE_URL, connect_args={'ssl': {'ssl-mode': 'preferred'}})"
`;
-exports[`generateDatabaseCode > connections with secrets > postgres with password as secret 1`] = `
+exports[`generateDatabaseCode > connections with secrets > postgres with password as secret > generated code 1`] = `
"import os
import sqlmodel
@@ -458,7 +458,7 @@ DATABASE_URL = f"postgresql://user:{_password}@{_host}:5432/test"
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > connections with secrets > snowflake with multiple secrets 1`] = `
+exports[`generateDatabaseCode > connections with secrets > snowflake with multiple secrets > generated code 1`] = `
"from snowflake.sqlalchemy import URL
import os
import sqlmodel
@@ -479,7 +479,7 @@ engine = sqlmodel.create_engine(
)"
`;
-exports[`generateDatabaseCode > connections with secrets > supabase with all connection details as secrets 1`] = `
+exports[`generateDatabaseCode > connections with secrets > supabase with all connection details as secrets > generated code 1`] = `
"import os
import sqlalchemy
@@ -491,7 +491,7 @@ DATABASE_URL = f"postgresql+psycopg2://{_username}:{_password}@{_host}:5432/{_da
engine = sqlalchemy.create_engine(DATABASE_URL)"
`;
-exports[`generateDatabaseCode > connections with secrets > timeplus with all connection details as secrets 1`] = `
+exports[`generateDatabaseCode > connections with secrets > timeplus with all connection details as secrets > generated code 1`] = `
"import os
import sqlalchemy
@@ -502,7 +502,7 @@ DATABASE_URL = f"timeplus://{_username}:{_password}@{_host}:8123"
engine = sqlalchemy.create_engine(DATABASE_URL)"
`;
-exports[`generateDatabaseCode > edge cases > ENV with special chars SQLModel 1`] = `
+exports[`generateDatabaseCode > edge cases > ENV with special chars SQLModel > generated code 1`] = `
"import os
import sqlmodel
@@ -511,7 +511,7 @@ DATABASE_URL = f"postgresql://user-name.special:{_password}@localhost:5432/test-
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > edge cases > bigquery with long credentials 1`] = `
+exports[`generateDatabaseCode > edge cases > bigquery with long credentials > generated code 1`] = `
"import json
import sqlmodel
@@ -519,13 +519,13 @@ credentials = json.loads(r"""xxxxxxxxxx""")
engine = sqlmodel.create_engine(f"bigquery://my-project/my_dataset", credentials_info=credentials)"
`;
-exports[`generateDatabaseCode > edge cases > chdb with no database 1`] = `
+exports[`generateDatabaseCode > edge cases > chdb with no database > generated code 1`] = `
"import chdb
engine = chdb.connect("", read_only=False)"
`;
-exports[`generateDatabaseCode > edge cases > clickhouse connect with minimal config 1`] = `
+exports[`generateDatabaseCode > edge cases > clickhouse connect with minimal config > generated code 1`] = `
"import clickhouse_connect
engine = clickhouse_connect.get_client(
@@ -535,7 +535,7 @@ engine = clickhouse_connect.get_client(
)"
`;
-exports[`generateDatabaseCode > edge cases > clickhouse with https 1`] = `
+exports[`generateDatabaseCode > edge cases > clickhouse with https > generated code 1`] = `
"import clickhouse_connect
import os
@@ -549,7 +549,7 @@ engine = clickhouse_connect.get_client(
)"
`;
-exports[`generateDatabaseCode > edge cases > clickhouse with no port 1`] = `
+exports[`generateDatabaseCode > edge cases > clickhouse with no port > generated code 1`] = `
"import clickhouse_connect
import os
@@ -562,7 +562,7 @@ engine = clickhouse_connect.get_client(
)"
`;
-exports[`generateDatabaseCode > edge cases > clickhouse with proxy_path 1`] = `
+exports[`generateDatabaseCode > edge cases > clickhouse with proxy_path > generated code 1`] = `
"import clickhouse_connect
import os
@@ -577,14 +577,14 @@ engine = clickhouse_connect.get_client(
)"
`;
-exports[`generateDatabaseCode > edge cases > duckdb with relative path 1`] = `
+exports[`generateDatabaseCode > edge cases > duckdb with relative path > generated code 1`] = `
"import sqlmodel
DATABASE_URL = "./relative/path/db.duckdb"
engine = sqlmodel.connect(DATABASE_URL, read_only=False)"
`;
-exports[`generateDatabaseCode > edge cases > motherduck with special chars in database name 1`] = `
+exports[`generateDatabaseCode > edge cases > motherduck with special chars in database name > generated code 1`] = `
"import duckdb
import os
@@ -592,7 +592,7 @@ _password = os.environ.get("MOTHERDUCK_TOKEN", "my_token")
conn = duckdb.connect("md:test-db.special", config={"motherduck_token": _password})"
`;
-exports[`generateDatabaseCode > edge cases > mysql with extremely long database name 1`] = `
+exports[`generateDatabaseCode > edge cases > mysql with extremely long database name > generated code 1`] = `
"import os
import sqlmodel
@@ -601,7 +601,7 @@ DATABASE_URL = f"mysql+pymysql://user:{_password}@localhost:3306/xxxxxxxxxxxxxxx
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'ssl': {'ssl-mode': 'preferred'}})"
`;
-exports[`generateDatabaseCode > edge cases > mysql with max port 1`] = `
+exports[`generateDatabaseCode > edge cases > mysql with max port > generated code 1`] = `
"import os
import sqlmodel
@@ -610,7 +610,7 @@ DATABASE_URL = f"mysql+pymysql://user:{_password}@localhost:65535/test"
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'ssl': {'ssl-mode': 'preferred'}})"
`;
-exports[`generateDatabaseCode > edge cases > postgres with IPv6 1`] = `
+exports[`generateDatabaseCode > edge cases > postgres with IPv6 > generated code 1`] = `
"import os
import sqlmodel
@@ -619,7 +619,7 @@ DATABASE_URL = f"postgresql://user:{_password}@2001:0db8:85a3:0000:0000:8a2e:037
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > edge cases > postgres with URL-encoded characters 1`] = `
+exports[`generateDatabaseCode > edge cases > postgres with URL-encoded characters > generated code 1`] = `
"import os
import sqlmodel
@@ -628,7 +628,7 @@ DATABASE_URL = f"postgresql://user%20name:{_password}@localhost:5432/test%20db"
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > edge cases > postgres with domain socket 1`] = `
+exports[`generateDatabaseCode > edge cases > postgres with domain socket > generated code 1`] = `
"import os
import sqlmodel
@@ -637,7 +637,7 @@ DATABASE_URL = f"postgresql://user:{_password}@/var/run/postgresql:/test"
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > edge cases > postgres with non-standard port 1`] = `
+exports[`generateDatabaseCode > edge cases > postgres with non-standard port > generated code 1`] = `
"import os
import sqlmodel
@@ -646,7 +646,7 @@ DATABASE_URL = f"postgresql://user:{_password}@localhost:54321/test"
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > edge cases > postgres with special chars SQLAlchemy 1`] = `
+exports[`generateDatabaseCode > edge cases > postgres with special chars SQLAlchemy > generated code 1`] = `
"import os
import sqlalchemy
@@ -655,7 +655,7 @@ DATABASE_URL = f"postgresql://user-name.special:{_password}@localhost:5432/test-
engine = sqlalchemy.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > edge cases > postgres with unicode 1`] = `
+exports[`generateDatabaseCode > edge cases > postgres with unicode > generated code 1`] = `
"import os
import sqlmodel
@@ -664,7 +664,7 @@ DATABASE_URL = f"postgresql://用户:{_password}@localhost:5432/测试数据库"
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > edge cases > snowflake key pair without passphrase 1`] = `
+exports[`generateDatabaseCode > edge cases > snowflake key pair without passphrase > generated code 1`] = `
"from snowflake.sqlalchemy import URL
import sqlmodel
@@ -684,7 +684,7 @@ engine = sqlmodel.create_engine(
)"
`;
-exports[`generateDatabaseCode > edge cases > snowflake with all optional fields filled 1`] = `
+exports[`generateDatabaseCode > edge cases > snowflake with all optional fields filled > generated code 1`] = `
"from snowflake.sqlalchemy import URL
import os
import sqlmodel
@@ -703,7 +703,7 @@ engine = sqlmodel.create_engine(
)"
`;
-exports[`generateDatabaseCode > edge cases > snowflake with minimal config SQLModel 1`] = `
+exports[`generateDatabaseCode > edge cases > snowflake with minimal config SQLModel > generated code 1`] = `
"from snowflake.sqlalchemy import URL
import os
import sqlmodel
@@ -719,14 +719,14 @@ engine = sqlmodel.create_engine(
)"
`;
-exports[`generateDatabaseCode > edge cases > sqlite with empty path 1`] = `
+exports[`generateDatabaseCode > edge cases > sqlite with empty path > generated code 1`] = `
"import sqlmodel
DATABASE_URL = "sqlite:///"
engine = sqlmodel.create_engine(DATABASE_URL)"
`;
-exports[`generateDatabaseCode > edge cases > timeplus connect with minimal config 1`] = `
+exports[`generateDatabaseCode > edge cases > timeplus connect with minimal config > generated code 1`] = `
"import os
import sqlalchemy
@@ -735,7 +735,7 @@ DATABASE_URL = f"timeplus://default:{_password}@localhost:"
engine = sqlalchemy.create_engine(DATABASE_URL)"
`;
-exports[`generateDatabaseCode > edge cases > timeplus with no port 1`] = `
+exports[`generateDatabaseCode > edge cases > timeplus with no port > generated code 1`] = `
"import os
import sqlalchemy
@@ -744,7 +744,7 @@ DATABASE_URL = f"timeplus://default:{_password}@localhost:"
engine = sqlalchemy.create_engine(DATABASE_URL)"
`;
-exports[`generateDatabaseCode > edge cases > trino with async support 1`] = `
+exports[`generateDatabaseCode > edge cases > trino with async support > generated code 1`] = `
"import aiotrino
import os
import sqlalchemy
@@ -753,15 +753,7 @@ _password = os.environ.get("TRINO_PASSWORD", "pass")
engine = sqlalchemy.create_engine(f"aiotrino://user:{_password}@localhost:8080/test")"
`;
-exports[`generateDatabaseCode > security cases > bigquery with malformed JSON 1`] = `
-"import json
-import sqlmodel
-
-credentials = json.loads(r"""{"type": "service_account", "project_id": "test"""")
-engine = sqlmodel.create_engine(f"bigquery://my-project/my_dataset", credentials_info=credentials)"
-`;
-
-exports[`generateDatabaseCode > security cases > bigquery with malformed JSON 2`] = `
+exports[`generateDatabaseCode > security cases > bigquery with malformed JSON > sqlalchemy 1`] = `
"import json
import sqlalchemy
@@ -769,16 +761,15 @@ credentials = json.loads(r"""{"type": "service_account", "project_id": "test""""
engine = sqlalchemy.create_engine(f"bigquery://my-project/my_dataset", credentials_info=credentials)"
`;
-exports[`generateDatabaseCode > security cases > mysql with very long password 1`] = `
-"import os
+exports[`generateDatabaseCode > security cases > bigquery with malformed JSON > sqlmodel 1`] = `
+"import json
import sqlmodel
-_password = os.environ.get("MYSQL_PASSWORD", "xxxxxxxxxx")
-DATABASE_URL = f"mysql+pymysql://user:{_password}@localhost:3306/test"
-engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'ssl': {'ssl-mode': 'preferred'}})"
+credentials = json.loads(r"""{"type": "service_account", "project_id": "test"""")
+engine = sqlmodel.create_engine(f"bigquery://my-project/my_dataset", credentials_info=credentials)"
`;
-exports[`generateDatabaseCode > security cases > mysql with very long password 2`] = `
+exports[`generateDatabaseCode > security cases > mysql with very long password > sqlalchemy 1`] = `
"import os
import sqlalchemy
@@ -787,16 +778,16 @@ DATABASE_URL = f"mysql+pymysql://user:{_password}@localhost:3306/test"
engine = sqlalchemy.create_engine(DATABASE_URL, connect_args={'ssl': {'ssl-mode': 'preferred'}})"
`;
-exports[`generateDatabaseCode > security cases > postgres with SQL injection attempt in database name 1`] = `
+exports[`generateDatabaseCode > security cases > mysql with very long password > sqlmodel 1`] = `
"import os
import sqlmodel
-_password = os.environ.get("POSTGRES_PASSWORD", "pass")
-DATABASE_URL = f"postgresql://user:{_password}@localhost:5432/db'; DROP TABLE users;--"
-engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
+_password = os.environ.get("MYSQL_PASSWORD", "xxxxxxxxxx")
+DATABASE_URL = f"mysql+pymysql://user:{_password}@localhost:3306/test"
+engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'ssl': {'ssl-mode': 'preferred'}})"
`;
-exports[`generateDatabaseCode > security cases > postgres with SQL injection attempt in database name 2`] = `
+exports[`generateDatabaseCode > security cases > postgres with SQL injection attempt in database name > sqlalchemy 1`] = `
"import os
import sqlalchemy
@@ -805,16 +796,16 @@ DATABASE_URL = f"postgresql://user:{_password}@localhost:5432/db'; DROP TABLE us
engine = sqlalchemy.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > security cases > postgres with empty password 1`] = `
+exports[`generateDatabaseCode > security cases > postgres with SQL injection attempt in database name > sqlmodel 1`] = `
"import os
import sqlmodel
-_password = os.environ.get("POSTGRES_PASSWORD", "")
-DATABASE_URL = f"postgresql://user:{_password}@localhost:5432/test"
+_password = os.environ.get("POSTGRES_PASSWORD", "pass")
+DATABASE_URL = f"postgresql://user:{_password}@localhost:5432/db'; DROP TABLE users;--"
engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > security cases > postgres with empty password 2`] = `
+exports[`generateDatabaseCode > security cases > postgres with empty password > sqlalchemy 1`] = `
"import os
import sqlalchemy
@@ -823,13 +814,22 @@ DATABASE_URL = f"postgresql://user:{_password}@localhost:5432/test"
engine = sqlalchemy.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
`;
-exports[`generateDatabaseCode > security cases > snowflake with sensitive info in account 1`] = `
+exports[`generateDatabaseCode > security cases > postgres with empty password > sqlmodel 1`] = `
+"import os
+import sqlmodel
+
+_password = os.environ.get("POSTGRES_PASSWORD", "")
+DATABASE_URL = f"postgresql://user:{_password}@localhost:5432/test"
+engine = sqlmodel.create_engine(DATABASE_URL, connect_args={'sslmode': 'require'})"
+`;
+
+exports[`generateDatabaseCode > security cases > snowflake with sensitive info in account > sqlalchemy 1`] = `
"from snowflake.sqlalchemy import URL
import os
-import sqlmodel
+import sqlalchemy
_password = os.environ.get("SNOWFLAKE_PASSWORD", "pass")
-engine = sqlmodel.create_engine(
+engine = sqlalchemy.create_engine(
URL(
account="account-with-password123",
database="db",
@@ -842,13 +842,13 @@ engine = sqlmodel.create_engine(
)"
`;
-exports[`generateDatabaseCode > security cases > snowflake with sensitive info in account 2`] = `
+exports[`generateDatabaseCode > security cases > snowflake with sensitive info in account > sqlmodel 1`] = `
"from snowflake.sqlalchemy import URL
import os
-import sqlalchemy
+import sqlmodel
_password = os.environ.get("SNOWFLAKE_PASSWORD", "pass")
-engine = sqlalchemy.create_engine(
+engine = sqlmodel.create_engine(
URL(
account="account-with-password123",
database="db",
diff --git a/frontend/src/components/editor/connections/database/__tests__/as-code.test.ts b/frontend/src/components/editor/connections/database/__tests__/as-code.test.ts
index ed8ed63822..da6c3c5dee 100644
--- a/frontend/src/components/editor/connections/database/__tests__/as-code.test.ts
+++ b/frontend/src/components/editor/connections/database/__tests__/as-code.test.ts
@@ -353,7 +353,9 @@ describe("generateDatabaseCode", () => {
];
it.each(testCases)("%s", (_name, connection, orm) => {
- expect(generateDatabaseCode(connection, orm)).toMatchSnapshot();
+ expect(generateDatabaseCode(connection, orm)).toMatchSnapshot(
+ "generated code",
+ );
});
});
@@ -458,7 +460,7 @@ describe("generateDatabaseCode", () => {
])("%s", (_name, connection, orm) => {
expect(
generateDatabaseCode(connection, orm as ConnectionLibrary),
- ).toMatchSnapshot();
+ ).toMatchSnapshot("generated code");
});
});
@@ -703,7 +705,7 @@ describe("generateDatabaseCode", () => {
it.each(testCases)("%s", (_name, connection, orm) => {
expect(
generateDatabaseCode(connection, orm as ConnectionLibrary),
- ).toMatchSnapshot();
+ ).toMatchSnapshot("generated code");
});
});
@@ -745,8 +747,12 @@ describe("generateDatabaseCode", () => {
},
],
])("%s", (_name, connection) => {
- expect(generateDatabaseCode(connection, "sqlmodel")).toMatchSnapshot();
- expect(generateDatabaseCode(connection, "sqlalchemy")).toMatchSnapshot();
+ expect(generateDatabaseCode(connection, "sqlmodel")).toMatchSnapshot(
+ "sqlmodel",
+ );
+ expect(generateDatabaseCode(connection, "sqlalchemy")).toMatchSnapshot(
+ "sqlalchemy",
+ );
});
});
diff --git a/frontend/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap b/frontend/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap
index 2e84b32c6e..c3c1f6e946 100644
--- a/frontend/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap
+++ b/frontend/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap
@@ -1,6 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
-exports[`cell reducer > can initialize stdin 1`] = `
+exports[`cell reducer > can initialize stdin > initial state 1`] = `
{
"code": "",
"config": {
@@ -29,7 +29,7 @@ exports[`cell reducer > can initialize stdin 1`] = `
}
`;
-exports[`cell reducer > can initialize stdin 2`] = `
+exports[`cell reducer > can initialize stdin > prepared for run 1`] = `
{
"code": "",
"config": {
@@ -58,7 +58,7 @@ exports[`cell reducer > can initialize stdin 2`] = `
}
`;
-exports[`cell reducer > can initialize stdin 3`] = `
+exports[`cell reducer > can initialize stdin > queued message received 1`] = `
{
"code": "",
"config": {
@@ -87,7 +87,7 @@ exports[`cell reducer > can initialize stdin 3`] = `
}
`;
-exports[`cell reducer > can initialize stdin 4`] = `
+exports[`cell reducer > can initialize stdin > running message received 1`] = `
{
"code": "",
"config": {
@@ -116,7 +116,7 @@ exports[`cell reducer > can initialize stdin 4`] = `
}
`;
-exports[`cell reducer > can initialize stdin 5`] = `
+exports[`cell reducer > can initialize stdin > second stdin requested 1`] = `
{
"code": "",
"config": {
@@ -131,6 +131,19 @@ exports[`cell reducer > can initialize stdin 5`] = `
"mimetype": "text/plain",
"timestamp": 1,
},
+ {
+ "channel": "stdin",
+ "data": "what is your name?",
+ "mimetype": "text/plain",
+ "response": "Marimo!",
+ "timestamp": 2,
+ },
+ {
+ "channel": "stdin",
+ "data": "how old are you?",
+ "mimetype": "text/plain",
+ "timestamp": 3,
+ },
],
"debuggerActive": false,
"edited": false,
@@ -152,7 +165,7 @@ exports[`cell reducer > can initialize stdin 5`] = `
}
`;
-exports[`cell reducer > can initialize stdin 6`] = `
+exports[`cell reducer > can initialize stdin > stdin answered 1`] = `
{
"code": "",
"config": {
@@ -167,6 +180,13 @@ exports[`cell reducer > can initialize stdin 6`] = `
"mimetype": "text/plain",
"timestamp": 1,
},
+ {
+ "channel": "stdin",
+ "data": "what is your name?",
+ "mimetype": "text/plain",
+ "response": "Marimo!",
+ "timestamp": 2,
+ },
],
"debuggerActive": false,
"edited": false,
@@ -188,7 +208,7 @@ exports[`cell reducer > can initialize stdin 6`] = `
}
`;
-exports[`cell reducer > can initialize stdin 7`] = `
+exports[`cell reducer > can initialize stdin > stdin requested 1`] = `
{
"code": "",
"config": {
@@ -230,7 +250,7 @@ exports[`cell reducer > can initialize stdin 7`] = `
}
`;
-exports[`cell reducer > can initialize stdin 8`] = `
+exports[`cell reducer > can initialize stdin > stdout received 1`] = `
{
"code": "",
"config": {
@@ -245,13 +265,6 @@ exports[`cell reducer > can initialize stdin 8`] = `
"mimetype": "text/plain",
"timestamp": 1,
},
- {
- "channel": "stdin",
- "data": "what is your name?",
- "mimetype": "text/plain",
- "response": "Marimo!",
- "timestamp": 2,
- },
],
"debuggerActive": false,
"edited": false,
@@ -273,7 +286,7 @@ exports[`cell reducer > can initialize stdin 8`] = `
}
`;
-exports[`cell reducer > can initialize stdin 9`] = `
+exports[`cell reducer > can initialize stdin > stdout verified 1`] = `
{
"code": "",
"config": {
@@ -288,19 +301,6 @@ exports[`cell reducer > can initialize stdin 9`] = `
"mimetype": "text/plain",
"timestamp": 1,
},
- {
- "channel": "stdin",
- "data": "what is your name?",
- "mimetype": "text/plain",
- "response": "Marimo!",
- "timestamp": 2,
- },
- {
- "channel": "stdin",
- "data": "how old are you?",
- "mimetype": "text/plain",
- "timestamp": 3,
- },
],
"debuggerActive": false,
"edited": false,
@@ -322,7 +322,7 @@ exports[`cell reducer > can initialize stdin 9`] = `
}
`;
-exports[`cell reducer > can receive console when the cell is idle and will clear when starts again 1`] = `
+exports[`cell reducer > can receive console when the cell is idle and will clear when starts again > console cleared while running 1`] = `
{
"code": "",
"config": {
@@ -336,22 +336,22 @@ exports[`cell reducer > can receive console when the cell is idle and will clear
"errored": false,
"id": "0",
"interrupted": false,
- "lastCodeRun": null,
+ "lastCodeRun": "",
"lastExecutionTime": null,
- "lastRunStartTimestamp": null,
+ "lastRunStartTimestamp": 20,
"name": "_",
"outline": null,
"output": null,
"runElapsedTimeMs": null,
- "runStartTimestamp": null,
+ "runStartTimestamp": 20,
"serializedEditorState": null,
"staleInputs": false,
- "status": "idle",
+ "status": "running",
"stopped": false,
}
`;
-exports[`cell reducer > can receive console when the cell is idle and will clear when starts again 2`] = `
+exports[`cell reducer > can receive console when the cell is idle and will clear when starts again > console received while idle 1`] = `
{
"code": "",
"config": {
@@ -361,10 +361,10 @@ exports[`cell reducer > can receive console when the cell is idle and will clear
},
"consoleOutputs": [
{
- "channel": "stdout",
- "data": "hello!",
+ "channel": "stdin",
+ "data": "hello again!",
"mimetype": "text/plain",
- "timestamp": 1,
+ "timestamp": 2,
},
],
"debuggerActive": false,
@@ -374,20 +374,20 @@ exports[`cell reducer > can receive console when the cell is idle and will clear
"interrupted": false,
"lastCodeRun": "",
"lastExecutionTime": null,
- "lastRunStartTimestamp": null,
+ "lastRunStartTimestamp": 20,
"name": "_",
"outline": null,
"output": null,
- "runElapsedTimeMs": null,
+ "runElapsedTimeMs": 2000,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "queued",
+ "status": "idle",
"stopped": false,
}
`;
-exports[`cell reducer > can receive console when the cell is idle and will clear when starts again 3`] = `
+exports[`cell reducer > can receive console when the cell is idle and will clear when starts again > initial state 1`] = `
{
"code": "",
"config": {
@@ -395,20 +395,13 @@ exports[`cell reducer > can receive console when the cell is idle and will clear
"disabled": false,
"hide_code": false,
},
- "consoleOutputs": [
- {
- "channel": "stdout",
- "data": "hello!",
- "mimetype": "text/plain",
- "timestamp": 1,
- },
- ],
+ "consoleOutputs": [],
"debuggerActive": false,
"edited": false,
"errored": false,
"id": "0",
"interrupted": false,
- "lastCodeRun": "",
+ "lastCodeRun": null,
"lastExecutionTime": null,
"lastRunStartTimestamp": null,
"name": "_",
@@ -418,12 +411,12 @@ exports[`cell reducer > can receive console when the cell is idle and will clear
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "queued",
+ "status": "idle",
"stopped": false,
}
`;
-exports[`cell reducer > can receive console when the cell is idle and will clear when starts again 4`] = `
+exports[`cell reducer > can receive console when the cell is idle and will clear when starts again > prepared for run 1`] = `
{
"code": "",
"config": {
@@ -431,7 +424,14 @@ exports[`cell reducer > can receive console when the cell is idle and will clear
"disabled": false,
"hide_code": false,
},
- "consoleOutputs": [],
+ "consoleOutputs": [
+ {
+ "channel": "stdout",
+ "data": "hello!",
+ "mimetype": "text/plain",
+ "timestamp": 1,
+ },
+ ],
"debuggerActive": false,
"edited": false,
"errored": false,
@@ -439,20 +439,20 @@ exports[`cell reducer > can receive console when the cell is idle and will clear
"interrupted": false,
"lastCodeRun": "",
"lastExecutionTime": null,
- "lastRunStartTimestamp": 20,
+ "lastRunStartTimestamp": null,
"name": "_",
"outline": null,
"output": null,
"runElapsedTimeMs": null,
- "runStartTimestamp": 20,
+ "runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "running",
+ "status": "queued",
"stopped": false,
}
`;
-exports[`cell reducer > can receive console when the cell is idle and will clear when starts again 5`] = `
+exports[`cell reducer > can receive console when the cell is idle and will clear when starts again > queued message received 1`] = `
{
"code": "",
"config": {
@@ -462,10 +462,10 @@ exports[`cell reducer > can receive console when the cell is idle and will clear
},
"consoleOutputs": [
{
- "channel": "stdin",
- "data": "hello again!",
+ "channel": "stdout",
+ "data": "hello!",
"mimetype": "text/plain",
- "timestamp": 2,
+ "timestamp": 1,
},
],
"debuggerActive": false,
@@ -475,20 +475,20 @@ exports[`cell reducer > can receive console when the cell is idle and will clear
"interrupted": false,
"lastCodeRun": "",
"lastExecutionTime": null,
- "lastRunStartTimestamp": 20,
+ "lastRunStartTimestamp": null,
"name": "_",
"outline": null,
"output": null,
- "runElapsedTimeMs": 2000,
+ "runElapsedTimeMs": null,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "idle",
+ "status": "queued",
"stopped": false,
}
`;
-exports[`cell reducer > can run a stale cell 1`] = `
+exports[`cell reducer > can run a stale cell > queued message received 1`] = `
{
"code": "mo.slider()",
"config": {
@@ -517,7 +517,7 @@ exports[`cell reducer > can run a stale cell 1`] = `
}
`;
-exports[`cell reducer > can run a stale cell 2`] = `
+exports[`cell reducer > can run a stale cell > stale inputs received 1`] = `
{
"code": "mo.slider()",
"config": {
@@ -546,7 +546,7 @@ exports[`cell reducer > can run a stale cell 2`] = `
}
`;
-exports[`cell reducer > can run a stopped cell 1`] = `
+exports[`cell reducer > can run a stopped cell > ancestor stopped 1`] = `
{
"code": "mo.md('This has an ancestor that was stopped')",
"config": {
@@ -562,20 +562,31 @@ exports[`cell reducer > can run a stopped cell 1`] = `
"interrupted": false,
"lastCodeRun": "mo.md('This has an ancestor that was stopped')",
"lastExecutionTime": null,
- "lastRunStartTimestamp": null,
+ "lastRunStartTimestamp": 20,
"name": "_",
"outline": null,
- "output": null,
+ "output": {
+ "channel": "marimo-error",
+ "data": [
+ {
+ "msg": "This cell wasn't run because an ancestor was stopped with \`mo.stop\`: ",
+ "raising_cell": "2",
+ "type": "ancestor-stopped",
+ },
+ ],
+ "mimetype": "application/vnd.marimo+error",
+ "timestamp": 20,
+ },
"runElapsedTimeMs": null,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "queued",
- "stopped": false,
+ "status": "idle",
+ "stopped": true,
}
`;
-exports[`cell reducer > can run a stopped cell 2`] = `
+exports[`cell reducer > can run a stopped cell > idle message received 1`] = `
{
"code": "mo.md('This has an ancestor that was stopped')",
"config": {
@@ -604,7 +615,7 @@ exports[`cell reducer > can run a stopped cell 2`] = `
}
`;
-exports[`cell reducer > can run a stopped cell 3`] = `
+exports[`cell reducer > can run a stopped cell > queued after stop 1`] = `
{
"code": "mo.md('This has an ancestor that was stopped')",
"config": {
@@ -639,12 +650,12 @@ exports[`cell reducer > can run a stopped cell 3`] = `
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "idle",
+ "status": "queued",
"stopped": true,
}
`;
-exports[`cell reducer > can run a stopped cell 4`] = `
+exports[`cell reducer > can run a stopped cell > queued message received 1`] = `
{
"code": "mo.md('This has an ancestor that was stopped')",
"config": {
@@ -660,31 +671,20 @@ exports[`cell reducer > can run a stopped cell 4`] = `
"interrupted": false,
"lastCodeRun": "mo.md('This has an ancestor that was stopped')",
"lastExecutionTime": null,
- "lastRunStartTimestamp": 20,
+ "lastRunStartTimestamp": null,
"name": "_",
"outline": null,
- "output": {
- "channel": "marimo-error",
- "data": [
- {
- "msg": "This cell wasn't run because an ancestor was stopped with \`mo.stop\`: ",
- "raising_cell": "2",
- "type": "ancestor-stopped",
- },
- ],
- "mimetype": "application/vnd.marimo+error",
- "timestamp": 20,
- },
+ "output": null,
"runElapsedTimeMs": null,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
"status": "queued",
- "stopped": true,
+ "stopped": false,
}
`;
-exports[`cell reducer > can run a stopped cell 5`] = `
+exports[`cell reducer > can run a stopped cell > running after stop 1`] = `
{
"code": "mo.md('This has an ancestor that was stopped')",
"config": {
@@ -713,27 +713,40 @@ exports[`cell reducer > can run a stopped cell 5`] = `
}
`;
-exports[`cell reducer > can run cell and receive cell messages 1`] = `
+exports[`cell reducer > can run cell and receive cell messages > code changed after revert 1`] = `
{
- "code": "",
+ "code": "import marimo as mo
+import numpy",
"config": {
"column": null,
"disabled": false,
"hide_code": false,
},
- "consoleOutputs": [],
+ "consoleOutputs": [
+ {
+ "channel": "stdout",
+ "data": "hello!hello!",
+ "mimetype": "text/plain",
+ "timestamp": 0,
+ },
+ ],
"debuggerActive": false,
- "edited": false,
+ "edited": true,
"errored": false,
"id": "0",
"interrupted": false,
- "lastCodeRun": null,
+ "lastCodeRun": "import marimo as mo",
"lastExecutionTime": null,
- "lastRunStartTimestamp": null,
+ "lastRunStartTimestamp": 20,
"name": "_",
"outline": null,
- "output": null,
- "runElapsedTimeMs": null,
+ "output": {
+ "channel": "output",
+ "data": "ok",
+ "mimetype": "text/plain",
+ "timestamp": 0,
+ },
+ "runElapsedTimeMs": 13000,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
@@ -742,7 +755,7 @@ exports[`cell reducer > can run cell and receive cell messages 1`] = `
}
`;
-exports[`cell reducer > can run cell and receive cell messages 2`] = `
+exports[`cell reducer > can run cell and receive cell messages > code edited 1`] = `
{
"code": "import marimo as mo",
"config": {
@@ -771,36 +784,49 @@ exports[`cell reducer > can run cell and receive cell messages 2`] = `
}
`;
-exports[`cell reducer > can run cell and receive cell messages 3`] = `
+exports[`cell reducer > can run cell and receive cell messages > code edited again 1`] = `
{
- "code": "import marimo as mo",
+ "code": "import marimo as mo
+import numpy",
"config": {
"column": null,
"disabled": false,
"hide_code": false,
},
- "consoleOutputs": [],
+ "consoleOutputs": [
+ {
+ "channel": "stdout",
+ "data": "hello!hello!",
+ "mimetype": "text/plain",
+ "timestamp": 0,
+ },
+ ],
"debuggerActive": false,
- "edited": false,
+ "edited": true,
"errored": false,
"id": "0",
"interrupted": false,
"lastCodeRun": "import marimo as mo",
"lastExecutionTime": null,
- "lastRunStartTimestamp": null,
+ "lastRunStartTimestamp": 20,
"name": "_",
"outline": null,
- "output": null,
- "runElapsedTimeMs": null,
+ "output": {
+ "channel": "output",
+ "data": "ok",
+ "mimetype": "text/plain",
+ "timestamp": 0,
+ },
+ "runElapsedTimeMs": 13000,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "queued",
+ "status": "idle",
"stopped": false,
}
`;
-exports[`cell reducer > can run cell and receive cell messages 4`] = `
+exports[`cell reducer > can run cell and receive cell messages > code reverted 1`] = `
{
"code": "import marimo as mo",
"config": {
@@ -808,7 +834,14 @@ exports[`cell reducer > can run cell and receive cell messages 4`] = `
"disabled": false,
"hide_code": false,
},
- "consoleOutputs": [],
+ "consoleOutputs": [
+ {
+ "channel": "stdout",
+ "data": "hello!hello!",
+ "mimetype": "text/plain",
+ "timestamp": 0,
+ },
+ ],
"debuggerActive": false,
"edited": false,
"errored": false,
@@ -816,20 +849,25 @@ exports[`cell reducer > can run cell and receive cell messages 4`] = `
"interrupted": false,
"lastCodeRun": "import marimo as mo",
"lastExecutionTime": null,
- "lastRunStartTimestamp": null,
+ "lastRunStartTimestamp": 20,
"name": "_",
"outline": null,
- "output": null,
- "runElapsedTimeMs": null,
+ "output": {
+ "channel": "output",
+ "data": "ok",
+ "mimetype": "text/plain",
+ "timestamp": 0,
+ },
+ "runElapsedTimeMs": 13000,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "queued",
+ "status": "idle",
"stopped": false,
}
`;
-exports[`cell reducer > can run cell and receive cell messages 5`] = `
+exports[`cell reducer > can run cell and receive cell messages > console message received 1`] = `
{
"code": "import marimo as mo",
"config": {
@@ -837,7 +875,14 @@ exports[`cell reducer > can run cell and receive cell messages 5`] = `
"disabled": false,
"hide_code": false,
},
- "consoleOutputs": [],
+ "consoleOutputs": [
+ {
+ "channel": "stdout",
+ "data": "hello!",
+ "mimetype": "text/plain",
+ "timestamp": 0,
+ },
+ ],
"debuggerActive": false,
"edited": false,
"errored": false,
@@ -858,9 +903,10 @@ exports[`cell reducer > can run cell and receive cell messages 5`] = `
}
`;
-exports[`cell reducer > can run cell and receive cell messages 6`] = `
+exports[`cell reducer > can run cell and receive cell messages > error response received 1`] = `
{
- "code": "import marimo as mo",
+ "code": "import marimo as mo
+import numpy",
"config": {
"column": null,
"disabled": false,
@@ -869,64 +915,64 @@ exports[`cell reducer > can run cell and receive cell messages 6`] = `
"consoleOutputs": [
{
"channel": "stdout",
- "data": "hello!",
+ "data": "hello!hello!",
"mimetype": "text/plain",
"timestamp": 0,
},
],
"debuggerActive": false,
"edited": false,
- "errored": false,
+ "errored": true,
"id": "0",
"interrupted": false,
- "lastCodeRun": "import marimo as mo",
+ "lastCodeRun": "import marimo as mo
+import numpy",
"lastExecutionTime": null,
- "lastRunStartTimestamp": 20,
+ "lastRunStartTimestamp": 50,
"name": "_",
"outline": null,
- "output": null,
- "runElapsedTimeMs": null,
- "runStartTimestamp": 20,
+ "output": {
+ "channel": "marimo-error",
+ "data": [
+ {
+ "exception_type": "ValueError",
+ "msg": "Oh no!",
+ "type": "exception",
+ },
+ ],
+ "mimetype": "application/vnd.marimo+error",
+ "timestamp": 0,
+ },
+ "runElapsedTimeMs": 11000,
+ "runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "running",
+ "status": "idle",
"stopped": false,
}
`;
-exports[`cell reducer > can run cell and receive cell messages 7`] = `
+exports[`cell reducer > can run cell and receive cell messages > initial state 1`] = `
{
- "code": "import marimo as mo",
+ "code": "",
"config": {
"column": null,
"disabled": false,
"hide_code": false,
},
- "consoleOutputs": [
- {
- "channel": "stdout",
- "data": "hello!hello!",
- "mimetype": "text/plain",
- "timestamp": 0,
- },
- ],
+ "consoleOutputs": [],
"debuggerActive": false,
"edited": false,
"errored": false,
"id": "0",
"interrupted": false,
- "lastCodeRun": "import marimo as mo",
+ "lastCodeRun": null,
"lastExecutionTime": null,
- "lastRunStartTimestamp": 20,
+ "lastRunStartTimestamp": null,
"name": "_",
"outline": null,
- "output": {
- "channel": "output",
- "data": "ok",
- "mimetype": "text/plain",
- "timestamp": 0,
- },
- "runElapsedTimeMs": 13000,
+ "output": null,
+ "runElapsedTimeMs": null,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
@@ -935,7 +981,7 @@ exports[`cell reducer > can run cell and receive cell messages 7`] = `
}
`;
-exports[`cell reducer > can run cell and receive cell messages 8`] = `
+exports[`cell reducer > can run cell and receive cell messages > interruption response received 1`] = `
{
"code": "import marimo as mo
import numpy",
@@ -953,22 +999,27 @@ import numpy",
},
],
"debuggerActive": false,
- "edited": true,
+ "edited": false,
"errored": false,
"id": "0",
- "interrupted": false,
- "lastCodeRun": "import marimo as mo",
+ "interrupted": true,
+ "lastCodeRun": "import marimo as mo
+import numpy",
"lastExecutionTime": null,
- "lastRunStartTimestamp": 20,
+ "lastRunStartTimestamp": 50,
"name": "_",
"outline": null,
"output": {
- "channel": "output",
- "data": "ok",
- "mimetype": "text/plain",
+ "channel": "marimo-error",
+ "data": [
+ {
+ "type": "interruption",
+ },
+ ],
+ "mimetype": "application/vnd.marimo+error",
"timestamp": 0,
},
- "runElapsedTimeMs": 13000,
+ "runElapsedTimeMs": 11000,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
@@ -977,7 +1028,7 @@ import numpy",
}
`;
-exports[`cell reducer > can run cell and receive cell messages 9`] = `
+exports[`cell reducer > can run cell and receive cell messages > output received 1`] = `
{
"code": "import marimo as mo",
"config": {
@@ -1018,147 +1069,96 @@ exports[`cell reducer > can run cell and receive cell messages 9`] = `
}
`;
-exports[`cell reducer > can run cell and receive cell messages 10`] = `
+exports[`cell reducer > can run cell and receive cell messages > prepared for run 1`] = `
{
- "code": "import marimo as mo
-import numpy",
+ "code": "import marimo as mo",
"config": {
"column": null,
"disabled": false,
"hide_code": false,
},
- "consoleOutputs": [
- {
- "channel": "stdout",
- "data": "hello!hello!",
- "mimetype": "text/plain",
- "timestamp": 0,
- },
- ],
+ "consoleOutputs": [],
"debuggerActive": false,
- "edited": true,
+ "edited": false,
"errored": false,
"id": "0",
"interrupted": false,
"lastCodeRun": "import marimo as mo",
"lastExecutionTime": null,
- "lastRunStartTimestamp": 20,
+ "lastRunStartTimestamp": null,
"name": "_",
"outline": null,
- "output": {
- "channel": "output",
- "data": "ok",
- "mimetype": "text/plain",
- "timestamp": 0,
- },
- "runElapsedTimeMs": 13000,
+ "output": null,
+ "runElapsedTimeMs": null,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "idle",
+ "status": "queued",
"stopped": false,
}
`;
-exports[`cell reducer > can run cell and receive cell messages 11`] = `
+exports[`cell reducer > can run cell and receive cell messages > queued message received 1`] = `
{
- "code": "import marimo as mo
-import numpy",
+ "code": "import marimo as mo",
"config": {
"column": null,
"disabled": false,
"hide_code": false,
},
- "consoleOutputs": [
- {
- "channel": "stdout",
- "data": "hello!hello!",
- "mimetype": "text/plain",
- "timestamp": 0,
- },
- ],
+ "consoleOutputs": [],
"debuggerActive": false,
"edited": false,
- "errored": true,
+ "errored": false,
"id": "0",
"interrupted": false,
- "lastCodeRun": "import marimo as mo
-import numpy",
+ "lastCodeRun": "import marimo as mo",
"lastExecutionTime": null,
- "lastRunStartTimestamp": 50,
+ "lastRunStartTimestamp": null,
"name": "_",
"outline": null,
- "output": {
- "channel": "marimo-error",
- "data": [
- {
- "exception_type": "ValueError",
- "msg": "Oh no!",
- "type": "exception",
- },
- ],
- "mimetype": "application/vnd.marimo+error",
- "timestamp": 0,
- },
- "runElapsedTimeMs": 11000,
+ "output": null,
+ "runElapsedTimeMs": null,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "idle",
+ "status": "queued",
"stopped": false,
}
`;
-exports[`cell reducer > can run cell and receive cell messages 12`] = `
+exports[`cell reducer > can run cell and receive cell messages > running message received 1`] = `
{
- "code": "import marimo as mo
-import numpy",
+ "code": "import marimo as mo",
"config": {
"column": null,
"disabled": false,
"hide_code": false,
},
- "consoleOutputs": [
- {
- "channel": "stdout",
- "data": "hello!hello!",
- "mimetype": "text/plain",
- "timestamp": 0,
- },
- ],
+ "consoleOutputs": [],
"debuggerActive": false,
"edited": false,
"errored": false,
"id": "0",
- "interrupted": true,
- "lastCodeRun": "import marimo as mo
-import numpy",
+ "interrupted": false,
+ "lastCodeRun": "import marimo as mo",
"lastExecutionTime": null,
- "lastRunStartTimestamp": 50,
+ "lastRunStartTimestamp": 20,
"name": "_",
"outline": null,
- "output": {
- "channel": "marimo-error",
- "data": [
- {
- "type": "interruption",
- },
- ],
- "mimetype": "application/vnd.marimo+error",
- "timestamp": 0,
- },
- "runElapsedTimeMs": 11000,
- "runStartTimestamp": null,
+ "output": null,
+ "runElapsedTimeMs": null,
+ "runStartTimestamp": 20,
"serializedEditorState": null,
"staleInputs": false,
- "status": "idle",
+ "status": "running",
"stopped": false,
}
`;
-exports[`cell reducer > errors reset status to idle 1`] = `
+exports[`cell reducer > errors reset status to idle > code edited 1`] = `
{
- "code": "",
+ "code": "import marimo as mo",
"config": {
"column": null,
"disabled": false,
@@ -1166,7 +1166,7 @@ exports[`cell reducer > errors reset status to idle 1`] = `
},
"consoleOutputs": [],
"debuggerActive": false,
- "edited": false,
+ "edited": true,
"errored": false,
"id": "0",
"interrupted": false,
@@ -1185,7 +1185,7 @@ exports[`cell reducer > errors reset status to idle 1`] = `
}
`;
-exports[`cell reducer > errors reset status to idle 2`] = `
+exports[`cell reducer > errors reset status to idle > error response received 1`] = `
{
"code": "import marimo as mo",
"config": {
@@ -1195,16 +1195,27 @@ exports[`cell reducer > errors reset status to idle 2`] = `
},
"consoleOutputs": [],
"debuggerActive": false,
- "edited": true,
- "errored": false,
+ "edited": false,
+ "errored": true,
"id": "0",
"interrupted": false,
- "lastCodeRun": null,
+ "lastCodeRun": "import marimo as mo",
"lastExecutionTime": null,
"lastRunStartTimestamp": null,
"name": "_",
"outline": null,
- "output": null,
+ "output": {
+ "channel": "marimo-error",
+ "data": [
+ {
+ "exception_type": "SyntaxError",
+ "msg": "Oh no!",
+ "type": "exception",
+ },
+ ],
+ "mimetype": "application/vnd.marimo+error",
+ "timestamp": 0,
+ },
"runElapsedTimeMs": null,
"runStartTimestamp": null,
"serializedEditorState": null,
@@ -1214,9 +1225,9 @@ exports[`cell reducer > errors reset status to idle 2`] = `
}
`;
-exports[`cell reducer > errors reset status to idle 3`] = `
+exports[`cell reducer > errors reset status to idle > initial state 1`] = `
{
- "code": "import marimo as mo",
+ "code": "",
"config": {
"column": null,
"disabled": false,
@@ -1228,7 +1239,7 @@ exports[`cell reducer > errors reset status to idle 3`] = `
"errored": false,
"id": "0",
"interrupted": false,
- "lastCodeRun": "import marimo as mo",
+ "lastCodeRun": null,
"lastExecutionTime": null,
"lastRunStartTimestamp": null,
"name": "_",
@@ -1238,12 +1249,12 @@ exports[`cell reducer > errors reset status to idle 3`] = `
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "queued",
+ "status": "idle",
"stopped": false,
}
`;
-exports[`cell reducer > errors reset status to idle 4`] = `
+exports[`cell reducer > errors reset status to idle > prepared for run 1`] = `
{
"code": "import marimo as mo",
"config": {
@@ -1254,7 +1265,7 @@ exports[`cell reducer > errors reset status to idle 4`] = `
"consoleOutputs": [],
"debuggerActive": false,
"edited": false,
- "errored": true,
+ "errored": false,
"id": "0",
"interrupted": false,
"lastCodeRun": "import marimo as mo",
@@ -1262,23 +1273,12 @@ exports[`cell reducer > errors reset status to idle 4`] = `
"lastRunStartTimestamp": null,
"name": "_",
"outline": null,
- "output": {
- "channel": "marimo-error",
- "data": [
- {
- "exception_type": "SyntaxError",
- "msg": "Oh no!",
- "type": "exception",
- },
- ],
- "mimetype": "application/vnd.marimo+error",
- "timestamp": 0,
- },
+ "output": null,
"runElapsedTimeMs": null,
"runStartTimestamp": null,
"serializedEditorState": null,
"staleInputs": false,
- "status": "idle",
+ "status": "queued",
"stopped": false,
}
`;
diff --git a/frontend/src/core/cells/__tests__/cells.test.ts b/frontend/src/core/cells/__tests__/cells.test.ts
index 6d2816ae4f..df138a4955 100644
--- a/frontend/src/core/cells/__tests__/cells.test.ts
+++ b/frontend/src/core/cells/__tests__/cells.test.ts
@@ -797,7 +797,7 @@ describe("cell reducer", () => {
expect(cell.status).toBe("idle");
expect(cell.lastCodeRun).toBe(null);
expect(cell.edited).toBe(false);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("initial state");
// Update code
actions.updateCellCode({
@@ -809,7 +809,7 @@ describe("cell reducer", () => {
expect(cell.status).toBe("idle");
expect(cell.lastCodeRun).toBe(null);
expect(cell.edited).toBe(true);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("code edited");
// Prepare for run
actions.prepareForRun({
@@ -819,7 +819,7 @@ describe("cell reducer", () => {
expect(cell.status).toBe("queued");
expect(cell.lastCodeRun).toBe("import marimo as mo");
expect(cell.edited).toBe(false);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("prepared for run");
// Receive queued messages
actions.handleCellMessage({
@@ -837,7 +837,7 @@ describe("cell reducer", () => {
expect(cell.runElapsedTimeMs).toBe(null);
expect(cell.runStartTimestamp).toBe(null);
expect(cell.lastRunStartTimestamp).toBe(null);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("queued message received");
// Receive running messages
actions.handleCellMessage({
@@ -855,7 +855,7 @@ describe("cell reducer", () => {
expect(cell.runElapsedTimeMs).toBe(null);
expect(cell.runStartTimestamp).toBe(20);
expect(cell.lastRunStartTimestamp).toBe(20);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("running message received");
// Console messages shouldn't transition status
actions.handleCellMessage({
@@ -877,7 +877,7 @@ describe("cell reducer", () => {
expect(cell.runElapsedTimeMs).toBe(null);
expect(cell.runStartTimestamp).toBe(20);
expect(cell.lastRunStartTimestamp).toBe(20);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("console message received");
// Receive output messages
actions.handleCellMessage({
@@ -904,7 +904,7 @@ describe("cell reducer", () => {
expect(cell.runElapsedTimeMs).toBe(13_000);
expect(cell.runStartTimestamp).toBe(null);
expect(cell.lastRunStartTimestamp).toBe(20);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("output received");
// EDITING BACK AND FORTH
/////////////////
@@ -917,7 +917,7 @@ describe("cell reducer", () => {
cell = cells[0];
expect(cell.status).toBe("idle");
expect(cell.edited).toBe(true);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("code edited again");
// Update code should be unedited
actions.updateCellCode({
@@ -927,7 +927,7 @@ describe("cell reducer", () => {
});
cell = cells[0];
expect(cell.edited).toBe(false);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("code reverted");
// Update code should be edited again
actions.updateCellCode({
@@ -939,7 +939,7 @@ describe("cell reducer", () => {
expect(cell.status).toBe("idle");
expect(cell.lastCodeRun).toBe("import marimo as mo");
expect(cell.edited).toBe(true);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("code changed after revert");
// ERROR RESPONSE
/////////////////
@@ -994,7 +994,7 @@ describe("cell reducer", () => {
expect(cell.edited).toBe(false);
expect(cell.runElapsedTimeMs).toBe(11_000);
expect(cell.runStartTimestamp).toBe(null);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("error response received");
// INTERRUPT RESPONSE
/////////////////
@@ -1046,7 +1046,7 @@ describe("cell reducer", () => {
expect(cell.edited).toBe(false);
expect(cell.runElapsedTimeMs).toBe(11_000);
expect(cell.runStartTimestamp).toBe(null);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("interruption response received");
});
it("errors reset status to idle", () => {
@@ -1055,7 +1055,7 @@ describe("cell reducer", () => {
expect(cell.status).toBe("idle");
expect(cell.lastCodeRun).toBe(null);
expect(cell.edited).toBe(false);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("initial state");
// Update code
actions.updateCellCode({
@@ -1067,7 +1067,7 @@ describe("cell reducer", () => {
expect(cell.status).toBe("idle");
expect(cell.lastCodeRun).toBe(null);
expect(cell.edited).toBe(true);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("code edited");
// Prepare for run
actions.prepareForRun({
@@ -1077,7 +1077,7 @@ describe("cell reducer", () => {
expect(cell.status).toBe("queued");
expect(cell.lastCodeRun).toBe("import marimo as mo");
expect(cell.edited).toBe(false);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("prepared for run");
// ERROR RESPONSE
//
@@ -1109,7 +1109,7 @@ describe("cell reducer", () => {
expect(cell.edited).toBe(false);
expect(cell.runElapsedTimeMs).toBe(null);
expect(cell.runStartTimestamp).toBe(null);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("error response received");
});
it("can run a stale cell", () => {
@@ -1152,7 +1152,7 @@ describe("cell reducer", () => {
expect(cell.edited).toBe(false);
expect(cell.runElapsedTimeMs).toBe(null);
expect(cell.runStartTimestamp).toBe(null);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("queued message received");
// Receive stale message
actions.handleCellMessage({
@@ -1169,7 +1169,7 @@ describe("cell reducer", () => {
expect(cell.edited).toBe(false);
expect(cell.runElapsedTimeMs).toBe(null);
expect(cell.runStartTimestamp).toBe(null);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("stale inputs received");
});
it("can format code and update cell", () => {
@@ -1281,7 +1281,7 @@ describe("cell reducer", () => {
expect(cell.edited).toBe(false);
expect(cell.runElapsedTimeMs).toBe(null);
expect(cell.runStartTimestamp).toBe(null);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("queued message received");
// Receive idle message
actions.handleCellMessage({
@@ -1293,7 +1293,7 @@ describe("cell reducer", () => {
timestamp: new Date(20).getTime() as Seconds,
});
cell = cells[0];
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("idle message received");
// Receive stop output
actions.handleCellMessage({
@@ -1322,7 +1322,7 @@ describe("cell reducer", () => {
"This cell wasn't run because an ancestor was stopped with `mo.stop`: ",
);
expect(cell.stopped).toBe(true);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("ancestor stopped");
// Receive queued message
actions.handleCellMessage({
@@ -1336,7 +1336,7 @@ describe("cell reducer", () => {
cell = cells[0];
expect(cell.status).toBe("queued");
expect(cell.stopped).toBe(true);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("queued after stop");
// Receive running message
actions.handleCellMessage({
@@ -1351,7 +1351,7 @@ describe("cell reducer", () => {
expect(cell.status).toBe("running");
expect(cell.stopped).toBe(false);
expect(cell.output).toBe(null);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("running after stop");
});
it("can initialize stdin", () => {
@@ -1378,7 +1378,7 @@ describe("cell reducer", () => {
let cell = cells[0];
expect(cell.status).toBe("idle");
expect(cell.consoleOutputs).toEqual([]);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("initial state");
// Prepare for run
actions.prepareForRun({
@@ -1387,7 +1387,7 @@ describe("cell reducer", () => {
cell = cells[0];
expect(cell.status).toBe("queued");
expect(cell.consoleOutputs).toEqual([]);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("prepared for run");
// Receive queued messages
actions.handleCellMessage({
@@ -1400,7 +1400,7 @@ describe("cell reducer", () => {
});
cell = cells[0];
expect(cell.status).toBe("queued");
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("queued message received");
// Receive running messages
actions.handleCellMessage({
@@ -1413,7 +1413,7 @@ describe("cell reducer", () => {
});
cell = cells[0];
expect(cell.status).toBe("running");
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("running message received");
// Add console
actions.handleCellMessage({
@@ -1426,12 +1426,12 @@ describe("cell reducer", () => {
});
cell = cells[0];
expect(cell.status).toBe("running");
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("stdout received");
cell = cells[0];
expect(cell.consoleOutputs[0]).toMatchObject(STDOUT);
expect(cell.status).toBe("running");
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("stdout verified");
// Ask via stdin
actions.handleCellMessage({
@@ -1446,7 +1446,7 @@ describe("cell reducer", () => {
expect(cell.consoleOutputs[0]).toMatchObject(STDOUT);
expect(cell.consoleOutputs[1]).toMatchObject(STD_IN_1);
expect(cell.status).toBe("running");
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("stdin requested");
// Response to stdin
actions.setStdinResponse({
@@ -1460,7 +1460,7 @@ describe("cell reducer", () => {
response: "Marimo!",
});
expect(cell.status).toBe("running");
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("stdin answered");
// Ask via stdin, again
actions.handleCellMessage({
@@ -1478,7 +1478,7 @@ describe("cell reducer", () => {
STD_IN_2,
]);
expect(cell.status).toBe("running");
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("second stdin requested");
// Interrupt, so we respond with ""
actions.handleCellMessage({
@@ -1562,7 +1562,7 @@ describe("cell reducer", () => {
let cell = cells[0];
expect(cell.status).toBe("idle");
expect(cell.consoleOutputs).toEqual([]);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("initial state");
// Add console
actions.handleCellMessage({
@@ -1581,7 +1581,7 @@ describe("cell reducer", () => {
cell = cells[0];
expect(cell.status).toBe("queued");
expect(cell.consoleOutputs).toMatchObject([OLD_STDOUT]); // Old stays there until it starts running
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("prepared for run");
// Receive queued messages
actions.handleCellMessage({
@@ -1595,7 +1595,7 @@ describe("cell reducer", () => {
cell = cells[0];
expect(cell.status).toBe("queued");
expect(cell.consoleOutputs).toMatchObject([OLD_STDOUT]); // Old stays there until it starts running
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("queued message received");
// Receive running messages
actions.handleCellMessage({
@@ -1609,7 +1609,7 @@ describe("cell reducer", () => {
cell = cells[0];
expect(cell.status).toBe("running");
expect(cell.consoleOutputs).toMatchObject([]);
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("console cleared while running");
// Add console
actions.handleCellMessage({
@@ -1623,7 +1623,7 @@ describe("cell reducer", () => {
cell = cells[0];
expect(cell.consoleOutputs).toMatchObject([STDOUT]);
expect(cell.status).toBe("idle");
- expect(cell).toMatchSnapshot(); // snapshot everything as a catch all
+ expect(cell).toMatchSnapshot("console received while idle");
});
it("can send a cell to the top", () => {