This repository has been archived by the owner on Jun 28, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
|
||
fs = require('fs').promises | ||
util = require 'util' | ||
path = require 'path' | ||
{exec} = require 'child_process' | ||
each = require 'each' | ||
|
||
it 'samples', -> | ||
|
||
# `describe` label doesnt print because the code inside calling `it` is asynchronous. | ||
# From Mocha.js doc | ||
# https://mochajs.org/#dynamically-generating-tests | ||
# With top-level await you can collect your test data in a dynamic and asynchronous way while the test file is being loaded | ||
|
||
describe 'Samples', -> | ||
|
||
dir = path.resolve __dirname, '../samples' | ||
samples = await fs.readdir dir | ||
return each samples.filter( (sample) -> /\.js$/.test sample) | ||
.call (sample, callback) -> | ||
for sample in samples | ||
continue unless /\.js$/.test sample | ||
it "Sample #{sample}", (callback) -> | ||
exec "node #{path.resolve dir, sample}", (err) -> | ||
callback err | ||
.promise() |