-
Notifications
You must be signed in to change notification settings - Fork 268
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
10 changed files
with
213 additions
and
132 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
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
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
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
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
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,17 +1,30 @@ | ||
|
||
import each from 'each' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { exec } from 'child_process' | ||
import fs from 'node:fs/promises' | ||
import path from 'node:path' | ||
import { spawn } from 'node:child_process' | ||
|
||
import { fileURLToPath } from 'url' | ||
__dirname = path.dirname fileURLToPath import.meta.url | ||
__dirname = new URL( '.', import.meta.url).pathname | ||
dir = path.resolve __dirname, '../samples' | ||
samples = fs.readdirSync(dir).filter (sample) -> /\.js$/.test sample | ||
samples = await fs.readdir dir | ||
|
||
describe 'Samples', -> | ||
|
||
each samples, (sample) -> | ||
it "Sample #{sample}", (callback) -> | ||
exec "node #{path.resolve dir, sample}", (err) -> | ||
callback err | ||
|
||
samples | ||
.filter (sample) -> | ||
return false unless /\.(js|ts)?$/.test sample | ||
true | ||
.map (sample) -> | ||
|
||
it "Sample #{sample}", () -> | ||
data = await fs.readFile path.resolve(dir, sample), 'utf8' | ||
return if /^["|']skip test["|']/.test data | ||
new Promise (resolve, reject) -> | ||
ext = /\.(\w+)?$/.exec(sample)[0] | ||
[cmd, ...args] = switch ext | ||
when '.js' | ||
['node', path.resolve dir, sample] | ||
when '.ts' | ||
['node', '--loader', 'ts-node/esm', path.resolve dir, sample] | ||
spawn(cmd, args) | ||
.on 'close', (code) -> if code is 0 then resolve() else reject(new Error 'Failure') | ||
.stdout.on 'data', (->) |
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,20 +1,31 @@ | ||
import fs from 'node:fs/promises' | ||
import path from 'node:path' | ||
import { spawn } from 'node:child_process' | ||
|
||
import each from 'each' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { exec } from 'child_process' | ||
|
||
import { fileURLToPath } from 'url' | ||
__dirname = path.dirname fileURLToPath import.meta.url | ||
dir = path.resolve __dirname, '../samples' | ||
[_, major] = process.version.match(/(\d+)\.\d+\.\d+/) | ||
samples = fs.readdirSync(dir) | ||
.filter (sample) -> ! (major < 16 && sample is 'recipe.promises.js') | ||
.filter (sample) -> /\.js$/.test sample | ||
__dirname = new URL( '.', import.meta.url).pathname | ||
dir = path.resolve __dirname, '../samples' | ||
samples = await fs.readdir dir | ||
|
||
describe 'Samples', -> | ||
|
||
each samples, (sample) -> | ||
it "Sample #{sample}", (callback) -> | ||
exec "node #{path.resolve dir, sample}", (err) -> | ||
callback err | ||
|
||
samples | ||
.filter (sample) -> ! (major < 16 && sample is 'recipe.promises.js') | ||
.filter (sample) -> | ||
return false unless /\.(js|ts)?$/.test sample | ||
true | ||
.map (sample) -> | ||
|
||
it "Sample #{sample}", () -> | ||
data = await fs.readFile path.resolve(dir, sample), 'utf8' | ||
return if /^["|']skip test["|']/.test data | ||
new Promise (resolve, reject) -> | ||
ext = /\.(\w+)?$/.exec(sample)[0] | ||
[cmd, ...args] = switch ext | ||
when '.js' | ||
['node', path.resolve dir, sample] | ||
when '.ts' | ||
['node', '--loader', 'ts-node/esm', path.resolve dir, sample] | ||
spawn(cmd, args) | ||
.on 'close', (code) -> if code is 0 then resolve() else reject(new Error 'Failure') | ||
.stdout.on 'data', (->) |
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,17 +1,30 @@ | ||
|
||
import each from 'each' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { exec } from 'child_process' | ||
import fs from 'node:fs/promises' | ||
import path from 'node:path' | ||
import { spawn } from 'node:child_process' | ||
|
||
import { fileURLToPath } from 'url' | ||
__dirname = path.dirname fileURLToPath import.meta.url | ||
__dirname = new URL( '.', import.meta.url).pathname | ||
dir = path.resolve __dirname, '../samples' | ||
samples = fs.readdirSync(dir).filter (sample) -> /\.js$/.test sample | ||
samples = await fs.readdir dir | ||
|
||
describe 'Samples', -> | ||
|
||
each samples, (sample) -> | ||
it "Sample #{sample}", (callback) -> | ||
exec "node #{path.resolve dir, sample}", (err) -> | ||
callback err | ||
|
||
samples | ||
.filter (sample) -> | ||
return false unless /\.(js|ts)?$/.test sample | ||
true | ||
.map (sample) -> | ||
|
||
it "Sample #{sample}", () -> | ||
data = await fs.readFile path.resolve(dir, sample), 'utf8' | ||
return if /^["|']skip test["|']/.test data | ||
new Promise (resolve, reject) -> | ||
ext = /\.(\w+)?$/.exec(sample)[0] | ||
[cmd, ...args] = switch ext | ||
when '.js' | ||
['node', path.resolve dir, sample] | ||
when '.ts' | ||
['node', '--loader', 'ts-node/esm', path.resolve dir, sample] | ||
spawn(cmd, args) | ||
.on 'close', (code) -> if code is 0 then resolve() else reject(new Error 'Failure') | ||
.stdout.on 'data', (->) |
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,17 +1,30 @@ | ||
|
||
import each from 'each' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { exec } from 'child_process' | ||
import fs from 'node:fs/promises' | ||
import path from 'node:path' | ||
import { spawn } from 'node:child_process' | ||
|
||
import { fileURLToPath } from 'url' | ||
__dirname = path.dirname fileURLToPath import.meta.url | ||
__dirname = new URL( '.', import.meta.url).pathname | ||
dir = path.resolve __dirname, '../samples' | ||
samples = fs.readdirSync(dir).filter (sample) -> /\.js$/.test sample | ||
samples = await fs.readdir dir | ||
|
||
describe 'Samples', -> | ||
|
||
each samples, (sample) -> | ||
it "Sample #{sample}", (callback) -> | ||
exec "node #{path.resolve dir, sample}", (err) -> | ||
callback err | ||
|
||
samples | ||
.filter (sample) -> | ||
return false unless /\.(js|ts)?$/.test sample | ||
true | ||
.map (sample) -> | ||
|
||
it "Sample #{sample}", () -> | ||
data = await fs.readFile path.resolve(dir, sample), 'utf8' | ||
return if /^["|']skip test["|']/.test data | ||
new Promise (resolve, reject) -> | ||
ext = /\.(\w+)?$/.exec(sample)[0] | ||
[cmd, ...args] = switch ext | ||
when '.js' | ||
['node', path.resolve dir, sample] | ||
when '.ts' | ||
['node', '--loader', 'ts-node/esm', path.resolve dir, sample] | ||
spawn(cmd, args) | ||
.on 'close', (code) -> if code is 0 then resolve() else reject(new Error 'Failure') | ||
.stdout.on 'data', (->) |
Oops, something went wrong.