Skip to content
forked from nbqx/estktap

tap(tape) wrapper for testing adobe extendscript

Notifications You must be signed in to change notification settings

ES-Collection/estktap

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

estktap

tap(tape) wrapper for testing adobe extendscript

usage

The estktap function takes 4 arguments:

estktap(message, jsx_script_path, is_a, targets)
  1. message String: Description

  2. jsx_script_path String: Path to script to test

  3. is_a Number, String, Boolean, Function: Comparitor

  4. targets Array: (Optional) List of targets

version number needs to be specified in targets [indesign-7.0,indesign-11] see versions.json

example

script to test

  • myfn.jsx
Myfn = this.Myfn || {};

// return Document page length
Myfn.count = function(doc){
  if(doc.hasOwnProperty("pages")){
    return doc.pages.length
  }else{
    return undefined
  }
};

// add new Page to Document
Myfn.add = function(doc){
  if(doc instanceof Document){
    doc.pages.add();
  }
  return doc;
};

write test

  • test.jsx (for testing myfn.jsx)
#target InDesign-7.0
#include "../myfn.jsx"

var doc = (app.documents.length===0)? app.documents.add() : app.activeDocument;
$.write(Myfn.count(doc)===1); // must

You should append $.write(xxx) at end in extendscript code for the test, because it uses tap test as output.

create runner

  • test.js (for running test.js)
var test = require('tape'),
    estktap = require('estktap');

test('this is adobe extendscript tap test',function(t){
  estktap('this must be true',__dirname+'/test/fixtures/test/test.jsx',true);
  t.end();
});

run

$ node test.js

or

$ tape test.js

more examples

See example.js

About

tap(tape) wrapper for testing adobe extendscript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%