forked from StudioInfinity/dyna3
Set up testing with Ava
This commit is contained in:
parent
eb81cee609
commit
c3995d6fcb
6 changed files with 3884 additions and 31 deletions
|
@ -2,14 +2,15 @@
|
|||
|
||||
### External dependencies
|
||||
|
||||
The dyna3 program depends on some externally-maintained JavaScript libraries/modules. The package uses npm to track these external dependencies. A module externals.js is automatically generated from the package_lock.json file created by npm to load the necessary modules at runtime.
|
||||
The dyna3 program depends on some externally-maintained JavaScript libraries/modules. The package uses npm to track these external dependencies. A module externals.js is automatically generated from the package.json and package_lock.json files created by npm to load the necessary modules at runtime.
|
||||
|
||||
The generation is performed by pkglock_to_externals.litcoffee, which also records the main importable file within the library, as there does not seem to be a systematic way to generate that filename from the module name.
|
||||
|
||||
Specific packages/implementation approaches for components of dyna3 include the following items. All packages are obtained from npm unless otherwise noted.
|
||||
|
||||
- for conversion of markdown to HTML: pandoc
|
||||
- For a test harness for the package: QUnit
|
||||
- For a test harness for the package: Ava
|
||||
- When a point is reached at which there is a need to test in-browser behavior, ava can call Puppeteer as per https://github.com/avajs/ava/blob/master/docs/recipes/puppeteer.md
|
||||
- For WebGL rendering of the 3D view of the geometry: three
|
||||
|
||||
```javascript
|
||||
|
@ -31,9 +32,9 @@ And here is the current complete list of external libraries on which operation o
|
|||
"""
|
||||
process.stdout.write header
|
||||
fs = require 'fs'
|
||||
pl = fs.readFileSync 'package-lock.json'
|
||||
pdata = JSON.parse pl
|
||||
for dep in Object.keys pdata.dependencies
|
||||
pkdata = JSON.parse fs.readFileSync 'package.json'
|
||||
pldata = JSON.parse fs.readFileSync 'package-lock.json'
|
||||
for dep in Object.keys pkdata.dependencies
|
||||
if process.argv.length > 2
|
||||
process.stdout.write "- #{dep}\n"
|
||||
else
|
||||
|
@ -43,10 +44,11 @@ And here is the current complete list of external libraries on which operation o
|
|||
export var #{dep}Loaded = new Promise(async function(resolve, reject) {
|
||||
var success = false;
|
||||
try {
|
||||
#{dep} = await import('https://cdn.jsdelivr.net/npm/#{dep}@#{pdata.dependencies[dep].version}/#{importable[dep]}');
|
||||
#{dep} = await import('https://cdn.jsdelivr.net/npm/#{dep}@#{pldata.dependencies[dep].version}/#{importable[dep]}');
|
||||
console.log('CDN import of #{dep} module OK');
|
||||
success = true;
|
||||
} catch(err) {
|
||||
console.log('CDN import of #{dep} failed: ' + JSON.stringify(err));
|
||||
try {
|
||||
#{dep} = await import('./node_modules/#{dep}/#{importable[dep]}');
|
||||
success = true;
|
||||
|
@ -56,7 +58,6 @@ And here is the current complete list of external libraries on which operation o
|
|||
}
|
||||
if (success) { resolve(); } else { reject(); }
|
||||
});
|
||||
|
||||
"""
|
||||
process.stdout.write block
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue