@nera-static/test-utils 1.0.1 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.2] - 2026-11-28
9
+
10
+ ### Fixed
11
+
12
+ - `writeFiles` writes a path whose name starts with two dots (`..cache/a.js`, `b/..c`): it refused it as "outside the root" because it checked the relative path's first two characters instead of its first segment. A `..` segment that leaves the root is still refused. The check is plugin-utils' `isInside`.
13
+
8
14
  ## [1.0.1] - 2026-11-27
9
15
 
10
16
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nera-static/test-utils",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Shared test helpers, test suites and the canonical vitest preset for Nera plugins, themes, starters and tools.",
5
5
  "type": "module",
6
6
  "exports": {
package/src/files.js CHANGED
@@ -2,6 +2,7 @@ import fs from 'node:fs'
2
2
  import os from 'node:os'
3
3
  import path from 'node:path'
4
4
  import { afterAll } from 'vitest'
5
+ import { isInside } from '@nera-static/plugin-utils/urls'
5
6
  import { isPlainObject } from '@nera-static/plugin-utils/values'
6
7
 
7
8
  // A path below a root: not empty, not absolute, no `..` segment. Internal:
@@ -77,8 +78,7 @@ export function writeFiles(root, files) {
77
78
 
78
79
  for (const [rel, content] of Object.entries(files)) {
79
80
  const file = path.resolve(root, rel)
80
- const inside = path.relative(root, file)
81
- if (inside === '' || inside.startsWith('..') || path.isAbsolute(inside)) {
81
+ if (!isInside(root, file, { self: false })) {
82
82
  throw new Error(
83
83
  `writeFiles: "${rel}" points outside ${root}. Use a path relative to the root, without "..".`,
84
84
  )