npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jasminejsx

v0.5.0

Published

A port of Jasmine.js that is compatible with Adobe ExtendScript

Downloads

19

Readme

Overview

A version of jasmine that works with Adobe ExtendScript. ExtendScript is a JavaScript variant that allows you to create and run scripts that extend Adobe's Creative Suite.

Environment

This has been developed and tested on

  • Mac OS X 10.14.5 with Adobe InDesign CC 2019
  • Mac OS X 10.14.5 with Adobe InDesign CC 2020
  • Mac OS X 10.15.3 with Adobe InDesign CC 2020

All but the command line test/run (described below) should work on other platforms.

This uses an old version of jasmine v2.6 since ExtendScript is so old.

Installation

Simply install it like any other npm package. Nice npm setup tutorial here.

npm install jasminejsx

You may also elect to add it to your package.json as development dependency:

"devDependencies": {
  "jasminejsx": "^0.1.0"
}

and install with a npm install.

Usage

  1. Create a test/spec directory for your *Spec.jsx files.

  2. In your test/ folder, create your own run.jsx file that will bootstrap your testing environment. Here's what it should look like:

    // Define your root path - this will be the folder that contains your node_modules folder
    var Global = Global || {};
    Global.rootPath = new File($.fileName).parent.parent;
    Global.modulesPath = new File(Global.rootPath + '/node_modules');
    
    // Define an optional Logger to override default
    // $.evalFile(Global.modulesPath + '/extendscript-logger/index.jsx');
    // Global.logger = new Logger(Global.rootPath+'/log/mytestlog.log', 'DEBUG');
       
    //Configuration options
    //Global.jasminejsx = Global.jasminejsx || {}
    //Global.jasminejsx.specPath = new File(Global.rootPath + '/test/spec');
    //Global.jasminejsx.reportPending = true; //defaults to false
    //Global.jasminejsx.activateApp = true; //defaults to false
       
    //Load the jasminejsx setup
    //@include '../node_modules/jasminejsx/index.jsx'
    
    // Sanity check, you can delete this after you verify your root path is correct.
    Global.logger.info('Global.rootPath is: ' + Global.rootPath);
    
    // Run Jasmine
    $.evalFile(Global.modulesPath + '/jasminejsx/test/run.jsx');

    You can run this script in a few ways:

  3. If you want to be able to run these test from the command line, link to the node_modules/jasminejsx/test/run file. This currently only works with OSX machines as it uses JavaScript for automation to open InDesign and run the tests.

    ln -s ../node_modules/jasminejsx/test/run test/run
  4. Run all tests with test/run or specific tests with test/run CalculatorSpec.

Testing

npm test or test/run

Output should look like:

me@host$ test/run
2020-02-25T12:13:22|INFO|***************************
2020-02-25T12:13:22|INFO|Jasmine ExtendScript Runner
2020-02-25T12:13:22|INFO|***************************
2020-02-25T12:13:22|WARN|To prevent odd errors, usually methods not being defined, login into Adobe Creative Cloud and verify all modal dialog boxes are closed. If tests are not running as expected, try restarting the application.
2020-02-25T12:13:23|INFO|Loading all specs in /Users/spyle/projects/jasminejsx/test/spec
2020-02-25T12:13:29|INFO|53 specs, 0 failures, 51 pending specs
2020-02-25T12:13:29|INFO|Finished in 0.035 seconds

NPM Release Tasks

  1. Update package.json version number
  2. npm install to update package lock.
  3. npm test to ensure tests pass.
  4. Update CHANGELOG.md with changes since last release.
  5. Check them all into the repository.
  6. git tag -a <version> -m <version>; git push --tags
  7. npm publish to deploy the release to npm.

Thanks

A big thank you to @tmaslen for the original idea and development of jasminejsx.