Git Product home page Git Product logo

stated's Issues

An ability to load a local file

Problem Statement

To enable local unit testing, a test file needs to import a template that it is testing

Proposed Solution

Allow import to load a local file based on a relative location of the caller

Undetected data dependencies

Description

There are many ways to express data dependencies that aren't discoverable by the DAG building process.

Actual Behavior

One example

> .init -f "test.json"
{
  "a": "",
  "b": [
    "/${a}"
  ],
  "c$": "$lookup('a')"
}
> .out
{
  "a": "",
  "b": [
    ""
  ],
  "c$": ""
}
> .set /a "✅"
{
  "a": "",
  "b": [
    ""
  ],
  "c$": "" // 👈 Actual
}

Expected Behavior

.set /a "✅" should result in "c$": "✅".

> .set /a "✅"
{
  "a": "",
  "b": [
    ""
  ],
  "c$": "" // 👈 Expected
}

Affected Version

0.0.10, 0.0.29

Steps to Reproduce

  1. Clone the repo at latest (1452aa6).
  2. Change // to # in .npmrc. (Otherwise next step fails.)
  3. Run yarn.
  4. Create test.json with above snippet.
  5. Run yarn stated.
  6. Enter above commands (.init -f "test.json", .out, .set /a "✅").

Checklist

Environment

node -v yarn -v
v18.13.0 1.22.19

Allow auth injection in import

Problem Statement

Local testing needs access to shared functions which are accessible via a REST API that requires authorization

Proposed Solution

Add OIDC/OAuth2 support to import function, via a new 'auth' object argument which can have a structure like

  • authority (string): The URL of the OIDC/OAuth2 provider, which will be used to get its metadata i.e. https://snoopy.observe.appdynamics.com/auth/8e1716f8-d79e-4a64-a91d-d1589f5fe94d/default. .well-known/openid-configuration will be appended to this URL as per OIDC specification
  • client_id (string): Your client application's identifier as registered with the OIDC/OAuth2 provider
  • client_secret (string): Your client application's secret as registered with the OIDC/OAuth2 provider
  • scope (string, default: 'openid'): The scope being requested from the OIDC/OAuth2 provider

./out on invalid path crashes REPL

Description

.out on invalid path crashes REPL

Expected Behavior

REPL does not crash, and prints an error instead

Actual Behavior

REPL crashes with

null
file:///usr/local/lib/node_modules/stated-js/dist/src/StatedREPL.js:120
if (!result.toString().startsWith("Started tailing...") || this.tookOverIO(cliCoreMethodName)) {
^

TypeError: Cannot read properties of null (reading 'toString')
at StatedREPL.cli (file:///usr/local/lib/node_modules/stated-js/dist/src/StatedREPL.js:120:21)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async REPLServer.action (file:///usr/local/lib/node_modules/stated-js/dist/src/StatedREPL.js:70:21)

Steps to Reproduce

  1. .init < your template >
  2. .out < invalid path >

An ability to add an error to an error report

Problem Statement

In order to enable unit testing, each failed test case needs to record an error in some global report, while continuing the execution of all the tests in a suite. That report needs to be returned in the end of test case execution

Proposed Solution

Add a new function, i.e. reportError(string name), which appends a new error to the report.
.out should return the report if there are any errors in it. This could be an option triggered by an argument

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.