Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Add unit tests for noiseDetail()

Abierto Apto para principiantes
#9,253 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@Pcmhacker-piro ya está trabajando en esto.

Desde el 6/10/2026.

  • #9255 de @Pcmhacker-piro — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
75/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript
Área
testing

Línea de trabajo

Lee src/math/noise.js en la zona de noiseDetail() y los tests existentes en test/unit/math/noise.js. Añade tests para configurar octaves y falloff, valores inválidos y falloff omitido; restaura el estado predeterminado después para que otros tests no se vean afectados. Ejecuta los tests unitarios de noise y actualiza el comentario obsoleto; listo cuando los comportamientos solicitados estén cubiertos y la suite pase.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Area:Math Enhancement
Increasing access

Tests make noiseDetail()'s behaviour explicit and protect it from regressions, so sketches that rely on it keep working across releases. They also give new contributors a clear reference for how the function is meant to behave.

Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)
Feature enhancement details

noiseDetail() (src/math/noise.js:403-410) has no unit tests. test/unit/math/noise.js:19 notes this:

// ALso need test for noiseSeed and noiseDetail

noiseSeed has since been covered (lines 36-60), but noiseDetail hasn't.

The private getters _getNoiseOctaves() and _getNoiseAmpFalloff() (lines 416-425) make the state directly assertable. Proposed tests:

  • sets octaves and falloff when both are given
  • ignores lod <= 0 and falloff <= 0, keeping the previous values
  • when falloff is omitted it defaults to 0.5, so a previously set falloff is reset rather than kept

Since the suite shares one mockP5Prototype and noiseDetail state persists in the module closure, the new tests would restore the defaults (4 octaves, 0.5 falloff) afterwards so the existing noise() tests aren't affected.

I'd also update the comment at line 19, since noiseSeed is now tested.

Checked against main at 3193703. The strands noiseDetail tests in the WebGL/WebGPU shader suites cover state leaking between shaders, not this function.

I'd like to fix this myself if approved.

Lenguaje dominante
JavaScript
Estrellas
24.1k
Forks
3.9k
Merge medio
3 d 19 h
PR fusionados (30 d)
33

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de processing/p5.js

Todos los issues de processing/p5.js

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.