[Pkg-javascript-devel] Help with node-webfont packaging: rollup looks at test files

Israel Galadima izzygaladima at gmail.com
Fri Dec 23 00:06:44 GMT 2022


Hi Julian,

For the first set of errors, you need to exclude all test files from rollup.
Then for the second, you need to change globby to a named export.

I've added the relevant commits to my fork on Salsa here
<https://salsa.debian.org/izzygala/node-webfont>.

Regards.

On Thu, 22 Dec 2022 at 20:21, Julian Gilbey <jdg at debian.org> wrote:

> I'm wondering if anyone has an idea about this.  I've been working on
> packaging node-webfont (my current work is on salsa:
> https://salsa.debian.org/js-team/node-webfont).  It now builds, but
> there is some really weird behaviour during the build.
>
> It builds the components that need building, then comes to the main
> module and calls rollup:
>
> ---
> Found debian/nodejs/./build
>         cd ./. && sh -ex debian/nodejs/./build
> + rollup -c
> ---
>
> but immediately runs into trouble:
>
> ---
> src/cli/index.ts → dist/cli.js...
> (!) Plugin typescript: @rollup/plugin-typescript TS2307: Cannot find
> module 'tsd' or its corresponding type declarations.
> is-svg/index.test-d.ts: (1:26)
>
> 1 import {expectType} from 'tsd';
>                            ~~~~~
> ---
>
> I don't know why it's looking at is-svg (one of the components); it
> shouldn't be touching it.  And even if rollup has to look at it, why
> is it looking at one of the test files?  It then hits another is-svg
> error, followed by lots of webfont errors, starting with:
>
> ---
> (!) Plugin typescript: @rollup/plugin-typescript TS2304: Cannot find name
> 'jest'.
> src/cli/index.test.ts: (8:1)
>
> 8 jest.mock("./meow");
>   ~~~~
>
> (!) Plugin typescript: @rollup/plugin-typescript TS2582: Cannot find name
> 'describe'. Do you need to install type definitions for a test runner? Try
> `npm i --save-dev @types/jest` or `npm i --save-dev @types/mocha`.
> src/cli/index.test.ts: (15:1)
>
> 15 describe("cli", () => {
>    ~~~~~~~~
>
> [...]
>
> (!) Plugin typescript: @rollup/plugin-typescript TS2304: Cannot find name
> 'beforeAll'.
> src/cli/index.test.ts: (17:3)
>
> 17   beforeAll(() => new Promise((resolve, reject) => {
>      ~~~~~~~~~
>
> (!) Plugin typescript: @rollup/plugin-typescript TS2304: Cannot find name
> 'beforeEach'.
> src/cli/index.test.ts: (34:3)
>
> 34   beforeEach(() => new Promise((resolve, reject) => {
>      ~~~~~~~~~~
>
> (!) Plugin typescript: @rollup/plugin-typescript TS2582: Cannot find name
> 'it'. Do you need to install type definitions for a test runner? Try `npm i
> --save-dev @types/jest` or `npm i --save-dev @types/mocha`.
> src/cli/index.test.ts: (60:3)
>
> 60   it("exits with code 2 and displays --help if no argument parameters
> are passed", async () => {
>      ~~
>
> [...]
>
> (!) Plugin typescript: @rollup/plugin-typescript TS2304: Cannot find name
> 'expect'.
> src/cli/index.test.ts: (64:5)
>
> 64     expect(output.code).toBe(2);
>        ~~~~~~
> ---
>
> Installing the jest package made no difference to this error, and
> again, I don't understand why it is looking at test files.
>
>
> There was then another, apparently unrelated, error:
>
> ---
> (!) Plugin typescript: @rollup/plugin-typescript TS2349: This expression
> is not callable.
>   Type 'typeof import("/usr/share/nodejs/globby/index")' has no call
> signatures.
> src/standalone/index.ts: (121:28)
>
> 121   const foundFiles = await globby([].concat(options.files));
>                                ~~~~~~
> ---
>
> Any hints or suggestions would be very welcome here!
>
> (There is also an unrelated issue: one of the included components is
> wawoff2, and that is not in source format.  Figuring out how to fix
> that looks like a reasonably big job :( )
>
> Best wishes,
>
>    Julian
>
> --
> Pkg-javascript-devel mailing list
> Pkg-javascript-devel at alioth-lists.debian.net
>
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-javascript-devel/attachments/20221223/849543ed/attachment.htm>


More information about the Pkg-javascript-devel mailing list