On 11/12/2021 17:35, Pirate Praveen wrote:


On ശ, ഡിസം 11 2021 at 05:28:13 വൈകു +0100 +0100, Yadd <[email protected]> wrote:
On 11/12/2021 16:21, Pirate Praveen wrote:


On ശ, ഡിസം 11 2021 at 01:48:18 വൈകു +0100 +0100, Julien Puydt <[email protected]> wrote:
Hi,

Le samedi 11 décembre 2021 à 13:24 +0100, Yadd a écrit :

 echo -n require > debian/tests/pkg-js/SKIP

Good one!

How does one test an import-able module?

Create test.mjs as
import {loadJsonFile} from 'load-json-file';

node test.mjs

or more generic
import * as loadJSONFile from 'load-json-file';

or even simpler

import 'load-json-file';

This does not work with node 12

I tested in node 12 only

load-json-file was installed via npm i load-json-file

(debian-sid)pravi@mahishi:/tmp$ cat test.mjs
import 'load-json-file';(debian-sid)pravi@mahishi:/tmp$ node -v
v12.22.7
(debian-sid)pravi@mahishi:/tmp$ apt policy nodejs
nodejs:
  Installed: 12.22.7~dfsg-2
  Candidate: 12.22.7~dfsg-2
  Version table:
     16.13.0~dfsg-5 1
          1 http://deb.debian.org/debian experimental/main amd64 Packages
*** 12.22.7~dfsg-2 500
        500 http://deb.debian.org/debian sid/main amd64 Packages
        100 /var/lib/dpkg/status
(debian-sid)pravi@mahishi:/tmp$ node test.mjs
(debian-sid)pravi@mahishi:/tmp$ echo $?
0
(debian-sid)pravi@mahishi:/tmp$

I understand, this works because you download it in node_modules. This does not work with an installed module

--
Pkg-javascript-devel mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-javascript-devel

Reply via email to