caolan / caolan/nodeunit

Is it possible to split the tests into setup, run test, and teardown?

Abierto
#315 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
1.9k
Forks
359
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I am using this basic code to run some test on various sorting algorithms in the same file:

Here is the driver code:

```
var reporter = require('nodeunit').reporters.default;
reporter.run(['tests/sortingTests.js']);
```

This works good so far for my testing needs. But now I am interested in using [benchmark.js](https://github.com/bestiejs/benchmark.js) to benchmark each of those sorting algorithms.
I want to reuse the testing code for the purpose of Benchmarking to reduce redundancy.

Benchmark provides helpful setup and teardown functions in its API. That is important because we don't want to measure the time taken during setup and tear down.

All I want is that in Benchmark's setup function, I should be able to instruct node-unit to run the setup.
And then in measurement function, I tell node-unit to separately run only the test.
And later in Benchmark's teardown function, I should be able to call node-unit's teardown.
And repeat above 3 steps for every test in that same file.

Any ideas how should I go about it?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con el código del controlador usando nodeunit's default reporter y tests/sortingTests.js; después, revisa los puntos de entrada de ejecución de pruebas y del ciclo de vida de nodeunit junto con la API de setup, medición y teardown de benchmark.js. Determina si las tres fases pueden invocarse de forma independiente para cada prueba y documenta o define el comportamiento de integración esperado.

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

Evaluación

Stack tecnológico
javascript, node.js
Área
testing
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.