Git Product home page Git Product logo

Comments (3)

lorenzofox3 avatar lorenzofox3 commented on August 23, 2024 1

Hello.

To be honest I don't know: https://raw.githubusercontent.com/lorenzofox3/zora/master/src/reporter.ts exists, so it might be a bug in Deno's loader.

Maybe you can try by using this bundle file URL.

Perhaps @bdchauvette can help you. He is the only Deno's user I am aware of

from zora.

bdchauvette avatar bdchauvette commented on August 23, 2024 1

You have to use the bundle URL and you won't be able to use any TS interfaces because the declarations use node-style path imports. Here's a minimal example.

The reason you have to use the bundle is that it's pretty much impossible to write TS sources that are compatible with both Deno and tsc. The issue is that Deno requires you to include .ts in the import path but the tsc itself does not allow you to import files ending with .ts (see e.g. microsoft/TypeScript#37582). As a result, you can either write TS sources that work with Deno or TS sources that work with tsc, but not both.

The reason the declarations don't work is again related to Deno's requirement that imports need to match the exact file name. The Zora typings are not bundled and they use Node-style extensionless paths. So even if you add a // @deno-types annotation (see below), it will fail when trying to import the other type files:

// @deno-types="https://unpkg.com/[email protected]/dist/declarations/index.d.ts"
import { test } from 'https://unpkg.com/[email protected]/dist/bundle/module.js';

In my case, I'm writing a cross-runtime lib, so I'm writing the tests with Node-style imports, then bundling everything together (with some changes based on target runtime) into tmp files, then running Node, Deno, QuickJS, etc. against the temp files. The only runtime support that I was missing from Zora was the ability to read env vars from the Deno object like it does with process in Node (#73).

If you're only supporting Deno, you should probably use Deno's builtin test framework or something like Rhum that targets Deno exclusively.


@lorenzofox3 -- Sorry for adding some maintenance overhead here 😓

I'm actually probably going to end up writing my own testing framework (no issue with Zora, I just prefer Mocha/Jest bdd-style structure for tests), so it might be simpler to revert #73 to avoid any confusion about Deno support 😬

from zora.

lorenzofox3 avatar lorenzofox3 commented on August 23, 2024 1

Thanks for your thorough feedback @bdchauvette 👍 I'll close this one for now

from zora.

Related Issues (20)

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.