vona-cli 1.1.157 → 1.1.160

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.
package/dist/play.js CHANGED
@@ -2,7 +2,23 @@ import fse from 'fs-extra';
2
2
  import path from 'node:path';
3
3
  import { loadJSONFile } from "./utils.js";
4
4
  export async function playAttach(projectPath, args) {
5
- const runtimeFile = path.join(projectPath, '.app/runtime/-.json');
5
+ const runId = process.env.VONA_TEST_RUN_ID;
6
+ if (runId) {
7
+ const match = /^(\d{14})-[a-f0-9]{8}$/.exec(runId);
8
+ const timestamp = match?.[1];
9
+ const date = timestamp
10
+ ? new Date(`${timestamp.slice(0, 4)}-${timestamp.slice(4, 6)}-${timestamp.slice(6, 8)}T${timestamp.slice(8, 10)}:${timestamp.slice(10, 12)}:${timestamp.slice(12, 14)}Z`)
11
+ : undefined;
12
+ if (process.env.META_MODE !== 'test' ||
13
+ !timestamp ||
14
+ !date ||
15
+ Number.isNaN(date.getTime()) ||
16
+ date.toISOString().slice(0, 19).replace(/[-:T]/g, '') !== timestamp) {
17
+ throw new Error('VONA_TEST_RUN_ID requires test mode and a UTC timestamp plus eight hex digits');
18
+ }
19
+ }
20
+ const dataDir = runId ? `.app-test-${runId}` : '.app';
21
+ const runtimeFile = path.join(projectPath, dataDir, 'runtime/-.json');
6
22
  if (!fse.existsSync(runtimeFile))
7
23
  throw new Error('dev server not running');
8
24
  // body
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,34 @@
1
+ import assert from 'node:assert/strict';
2
+ import { spawnSync } from 'node:child_process';
3
+ import { test } from 'node:test';
4
+ const script = `
5
+ import { playAttach } from './play.ts';
6
+ await playAttach('/nonexistent-vona-project', []);
7
+ `;
8
+ test('play attach accepts the timestamped test identity before locating its runtime', () => {
9
+ const result = spawnSync(process.execPath, ['--input-type=module', '-e', script], {
10
+ cwd: import.meta.dirname,
11
+ env: {
12
+ ...process.env,
13
+ META_MODE: 'test',
14
+ VONA_TEST_RUN_ID: '20261014010203-a1b2c3d4',
15
+ },
16
+ encoding: 'utf8',
17
+ });
18
+ assert.notEqual(result.status, 0);
19
+ assert.match(result.stderr, /dev server not running/);
20
+ assert.doesNotMatch(result.stderr, /VONA_TEST_RUN_ID requires/);
21
+ });
22
+ test('play attach rejects impossible UTC seconds', () => {
23
+ const result = spawnSync(process.execPath, ['--input-type=module', '-e', script], {
24
+ cwd: import.meta.dirname,
25
+ env: {
26
+ ...process.env,
27
+ META_MODE: 'test',
28
+ VONA_TEST_RUN_ID: '20260230010203-a1b2c3d4',
29
+ },
30
+ encoding: 'utf8',
31
+ });
32
+ assert.notEqual(result.status, 0);
33
+ assert.match(result.stderr, /VONA_TEST_RUN_ID requires/);
34
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-cli",
3
- "version": "1.1.157",
4
- "gitHead": "8d575dd958be6aa16daa249bdbdb024d20d0789d",
3
+ "version": "1.1.160",
4
+ "gitHead": "bc3034e45e4f728199560c682b3432d47381ceb4",
5
5
  "description": "vona cli",
6
6
  "keywords": [
7
7
  "framework",
@@ -36,7 +36,7 @@
36
36
  "fs-extra": "^11.3.4",
37
37
  "mri": "^1.2.0",
38
38
  "semver": "^7.7.4",
39
- "vona-cli-set-api": "^1.1.155"
39
+ "vona-cli-set-api": "^1.1.158"
40
40
  },
41
41
  "bin": {
42
42
  "vona": "dist/bin/vona.js"