[Pkg-javascript-devel] Help with node-webfont packaging: rollup looks at test files
Julian Gilbey
jdg at debian.org
Thu Dec 22 19:21:11 GMT 2022
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
More information about the Pkg-javascript-devel
mailing list