[Pkg-javascript-devel] Bug#1078897: node-tap: FTBFS: SyntaxError: Cannot use import statement outside a module

Santiago Vila sanvila at debian.org
Sat Aug 17 14:40:38 BST 2024


Package: src:node-tap
Version: 16.3.2+ds1+~cs50.8.16-1
Severity: serious
Control: close -1 16.3.7+ds1+~cs50.9.19-7
Tags: ftbfs bookworm

Dear maintainer:

During a rebuild of all packages in bookworm, your package failed to build:

--------------------------------------------------------------------------------
[...]
  debian/rules binary
dh binary
    dh_update_autotools_config
    dh_autoreconf
    dh_auto_configure --buildsystem=nodejs
Link ./node_modules/callsites -> /usr/share/nodejs/callsites
Link ./node_modules/tape -> /usr/share/nodejs/tape
Link ./node_modules/ts-node -> /usr/share/nodejs/ts-node
Link ./node_modules/@types/diff -> /usr/share/nodejs/@types/diff
Link ./node_modules/@types/node -> /usr/share/nodejs/@types/node
Link node_modules/async-hook-domain -> ../module-async-hook-domain
Link node_modules/bind-obj-methods -> ../module-bind-obj-methods
Link node_modules/caller-callsite -> ../module-caller-callsite
Link node_modules/caller-path -> ../module-caller-path
Link node_modules/findit -> ../module-findit
Link node_modules/fs-exists-cached -> ../module-fs-exists-cached
Link node_modules/function-loop -> ../module-function-loop
Link node_modules/@isaacs/import-jsx -> ../../module-isaacs-import-jsx
Link node_modules/jackspeak -> ../module-jackspeak
Link node_modules/libtap -> ../module-libtap
Link node_modules/own-or -> ../module-own-or
Link node_modules/own-or-env -> ../module-own-or-env
Link node_modules/tcompare -> ../module-tcompare
Link node_modules/trivial-deferred -> ../module-trivial-deferred
Link node_modules/@types/tap -> ../../types-tap
    dh_auto_build --buildsystem=nodejs
Found debian/nodejs/module-caller-path/build
	cd ./module-caller-path && sh -ex ../debian/nodejs/module-caller-path/build
+ mjs2cjs index.js

index.js → ./index.cjs...
created ./index.cjs in 44ms
+ perl -i -pe s/node:// index.cjs
No build command found, searching known files
No build command found, searching known files
Found debian/nodejs/module-tcompare/build
	cd ./module-tcompare && sh -ex ../debian/nodejs/module-tcompare/build
+ tsc -p tsconfig-cjs.json
+ tsc -p tsconfig-esm.json
No build command found, searching known files
No build command found, searching known files
No build command found, searching known files
No build command found, searching known files
No build command found, searching known files
No build command found, searching known files
No build command found, searching known files
No build command found, searching known files
Found debian/nodejs/module-caller-callsite/build
	cd ./module-caller-callsite && sh -ex ../debian/nodejs/module-caller-callsite/build
+ mjs2cjs index.js

index.js → ./index.cjs...
created ./index.cjs in 52ms
+ perl -i -pe s/node:// index.cjs
No build command found, searching known files
No build command found, searching known files
No build command found, searching known files
    dh_auto_test --buildsystem=nodejs
	ln -s ../debian/tests/test_modules/touch node_modules/touch
	ln -s ../. node_modules/tap
	/bin/sh -ex debian/tests/pkg-js/test
+ pwd
+ TAP=/<<PKGBUILDDIR>>/bin/run.js
+ pkgjs-utils root_components_list
+ grep -v types-
+ grep -v module-isaacs-import-jsx
+ grep -v module-findit
+ grep -v module-libtap
+ grep -v module-jackspeak
+ LIST=module-async-hook-domain
module-bind-obj-methods
module-caller-callsite
module-caller-path
module-fs-exists-cached
module-function-loop
module-own-or
module-own-or-env
module-tcompare
module-trivial-deferred
+ test  !=
+ TAP=/<<PKGBUILDDIR>>/bin/run.js -J -R spec -t 30000
+ test -e module-async-hook-domain
+ cd module-async-hook-domain
+ TAP_SNAPSHOT=1 /<<PKGBUILDDIR>>/bin/run.js -J -R spec -t 30000 --no-coverage test

test/fixtures/basic.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/child.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/debug.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/destroy.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/multiple-destroy.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/no-handler.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/other-handler.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/process-clubbing.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/process-missing.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise-no-domain.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise-rejections-unhandled-none.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise-rejections-unhandled-strict-with-space.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise-rejections-unhandled-strict.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise-rejections-unhandled-throw.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise-rejections-unhandled-warn-with-error-code.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise-rejections-unhandled-warn.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise-rejections.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise-throwing-handler.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise-timing.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/promise.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/throw-in-handler.js

   ✓ error

   ✓ output

   ✓ stderr
test/fixtures/uncaught.js

   ✓ error

   ✓ output

   ✓ stderr
test/run.js

   ✓ error

   ✓ output

   ✓ stderr
test/sms.js

   ✓ error

   ✓ output

   ✓ stderr

   72 passing (9s)
+ test -e module-bind-obj-methods
+ cd module-bind-obj-methods
+ TAP_SNAPSHOT=1 /<<PKGBUILDDIR>>/bin/run.js -J -R spec -t 30000 --no-coverage test.js

test.js

   ✓ should be equal

   ✓ expected to throw

   ✓ should be equal

   ✓ expected to throw

   ✓ should be equal

   ✓ should be equal

   ✓ should be equal

   ✓ should be equal

   ✓ should be equal

   ✓ should be equal

   10 passing (213.482ms)
+ test -e module-caller-callsite
+ cd module-caller-callsite
+ TAP_SNAPSHOT=1 /<<PKGBUILDDIR>>/bin/run.js -J -R spec -t 30000 --no-coverage test.js

test.js

   ✓ should be strictly equal

   ✓ should be strictly equal

   ✓ should be strictly equal

   3 passing (205.6ms)
+ test -e module-caller-path
+ cd module-caller-path
+ TAP_SNAPSHOT=1 /<<PKGBUILDDIR>>/bin/run.js -J -R spec -t 30000 --no-coverage test.js

test.js

   ✓ should be strictly equal

   ✓ should be strictly equal

   ✓ should be strictly equal

   3 passing (206.314ms)
+ test -e module-fs-exists-cached
+ cd module-fs-exists-cached
+ TAP_SNAPSHOT=1 /<<PKGBUILDDIR>>/bin/run.js -J -R spec -t 30000 --no-coverage test.js

test.js

   ✓ setup
   existing file same way

     ✓ expect truthy value

     ✓ expect truthy value

     ✓ expect truthy value

     ✓ expect truthy value

   existing file different ways

     ✓ expect truthy value

     ✓ expect truthy value

     ✓ expect truthy value

     ✓ expect truthy value

   non-existing file same way

     ✓ expect falsey value

     ✓ expect falsey value

     ✓ expect falsey value

     ✓ expect falsey value

   non-existing file different ways

     ✓ expect falsey value

     ✓ expect falsey value

     ✓ expect falsey value

     ✓ expect falsey value


   ✓ cleanup

   18 passing (258.8ms)
+ test -e module-function-loop
+ cd module-function-loop
+ TAP_SNAPSHOT=1 /<<PKGBUILDDIR>>/bin/run.js -J -R spec -t 30000 --no-coverage test.js

test.js
   basic passing operation

     ✓ this is correct 1

     ✓ 0

     ✓ this is correct 2

     ✓ 1

     ✓ 2, after loop() call

     ✓ this is correct 3

     ✓ 2

     ✓ this is correct 4

     ✓ 3

     ✓ this is correct 5

     ✓ 4

   throws

     ✓ this is correct

     ✓ should match pattern provided

   all sync

     ✓ should be equal

     ✓ should be equal

     ✓ should be equal

     ✓ should be equal

     ✓ should be equal

     ✓ should be equal

     ✓ should be equal

   broken promise

     ✓ this is correct

     ✓ this is correct

     ✓ should match pattern provided


   23 passing (244.065ms)
+ test -e module-own-or
+ cd module-own-or
+ TAP_SNAPSHOT=1 /<<PKGBUILDDIR>>/bin/run.js -J -R spec -t 30000 --no-coverage test.js

test.js

   ✓ undefined

   1 passing (130.548ms)
+ test -e module-own-or-env
+ cd module-own-or-env
+ TAP_SNAPSHOT=1 /<<PKGBUILDDIR>>/bin/run.js -J -R spec -t 30000 --no-coverage test.js

test.js

   ✓ undefined

   1 passing (128.368ms)
+ test -e module-tcompare
+ cd module-tcompare
+ TAP_SNAPSHOT=1 /<<PKGBUILDDIR>>/bin/run.js -J -R spec -t 30000 --no-coverage test

/<<PKGBUILDDIR>>/module-tcompare/test/has-strict.ts:1
import t from 'tap'
^^^^^^

SyntaxError: Cannot use import statement outside a module
     at internalCompileFunction (node:internal/vm:73:18)
     at wrapSafe (node:internal/modules/cjs/loader:1274:20)
     at Module._compile (node:internal/modules/cjs/loader:1320:27)
     at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
     at Module.load (node:internal/modules/cjs/loader:1197:32)
     at Module._load (node:internal/modules/cjs/loader:1013:12)
     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
     at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
     at async loadESM (node:internal/process/esm_loader:34:7)

Node.js v18.19.0
/<<PKGBUILDDIR>>/module-tcompare/test/format.ts:1
import t from 'tap'
^^^^^^

SyntaxError: Cannot use import statement outside a module
     at internalCompileFunction (node:internal/vm:73:18)
     at wrapSafe (node:internal/modules/cjs/loader:1274:20)
     at Module._compile (node:internal/modules/cjs/loader:1320:27)
     at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
     at Module.load (node:internal/modules/cjs/loader:1197:32)
     at Module._load (node:internal/modules/cjs/loader:1013:12)
     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
     at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
     at async loadESM (node:internal/process/esm_loader:34:7)

Node.js v18.19.0
test/format.ts

   1) test/format.ts
/<<PKGBUILDDIR>>/module-tcompare/test/has.ts:1
import t from 'tap'
^^^^^^

SyntaxError: Cannot use import statement outside a module
     at internalCompileFunction (node:internal/vm:73:18)
     at wrapSafe (node:internal/modules/cjs/loader:1274:20)
     at Module._compile (node:internal/modules/cjs/loader:1320:27)
     at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
     at Module.load (node:internal/modules/cjs/loader:1197:32)
     at Module._load (node:internal/modules/cjs/loader:1013:12)
     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
     at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
     at async loadESM (node:internal/process/esm_loader:34:7)

Node.js v18.19.0
/<<PKGBUILDDIR>>/module-tcompare/test/index.ts:1
import t from 'tap'
^^^^^^

SyntaxError: Cannot use import statement outside a module
     at internalCompileFunction (node:internal/vm:73:18)
     at wrapSafe (node:internal/modules/cjs/loader:1274:20)
     at Module._compile (node:internal/modules/cjs/loader:1320:27)
     at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
     at Module.load (node:internal/modules/cjs/loader:1197:32)
     at Module._load (node:internal/modules/cjs/loader:1013:12)
     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
     at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
     at async loadESM (node:internal/process/esm_loader:34:7)

Node.js v18.19.0
test/has-strict.ts

   2) test/has-strict.ts
test/has.ts

   3) test/has.ts
/<<PKGBUILDDIR>>/module-tcompare/test/match-strict.ts:1
import t from 'tap'
^^^^^^

SyntaxError: Cannot use import statement outside a module
     at internalCompileFunction (node:internal/vm:73:18)
     at wrapSafe (node:internal/modules/cjs/loader:1274:20)
     at Module._compile (node:internal/modules/cjs/loader:1320:27)
     at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
     at Module.load (node:internal/modules/cjs/loader:1197:32)
     at Module._load (node:internal/modules/cjs/loader:1013:12)
     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
     at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
     at async loadESM (node:internal/process/esm_loader:34:7)
/<<PKGBUILDDIR>>/module-tcompare/test/match-only.ts:1
import t from 'tap'
^^^^^^

SyntaxError: Cannot use import statement outside a module
     at internalCompileFunction (node:internal/vm:73:18)
     at wrapSafe (node:internal/modules/cjs/loader:1274:20)
     at Module._compile (node:internal/modules/cjs/loader:1320:27)
     at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
     at Module.load (node:internal/modules/cjs/loader:1197:32)
     at Module._load (node:internal/modules/cjs/loader:1013:12)
     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
     at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
     at async loadESM (node:internal/process/esm_loader:34:7)

Node.js v18.19.0

Node.js v18.19.0
test/index.ts

   4) test/index.ts
test/match-only.ts

   5) test/match-only.ts
/<<PKGBUILDDIR>>/module-tcompare/test/match.ts:1
import t from 'tap'
^^^^^^

SyntaxError: Cannot use import statement outside a module
     at internalCompileFunction (node:internal/vm:73:18)
     at wrapSafe (node:internal/modules/cjs/loader:1274:20)
     at Module._compile (node:internal/modules/cjs/loader:1320:27)
     at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
     at Module.load (node:internal/modules/cjs/loader:1197:32)
     at Module._load (node:internal/modules/cjs/loader:1013:12)
     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
     at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
     at async loadESM (node:internal/process/esm_loader:34:7)

Node.js v18.19.0
/<<PKGBUILDDIR>>/module-tcompare/test/same.ts:1
import t from 'tap'
^^^^^^

SyntaxError: Cannot use import statement outside a module
     at internalCompileFunction (node:internal/vm:73:18)
     at wrapSafe (node:internal/modules/cjs/loader:1274:20)
     at Module._compile (node:internal/modules/cjs/loader:1320:27)
     at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
     at Module.load (node:internal/modules/cjs/loader:1197:32)
     at Module._load (node:internal/modules/cjs/loader:1013:12)
     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
     at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
     at async loadESM (node:internal/process/esm_loader:34:7)

Node.js v18.19.0
test/match-strict.ts

   6) test/match-strict.ts
test/match.ts

   7) test/match.ts
/<<PKGBUILDDIR>>/module-tcompare/test/strict.ts:1
import t from 'tap'
^^^^^^

SyntaxError: Cannot use import statement outside a module
     at internalCompileFunction (node:internal/vm:73:18)
     at wrapSafe (node:internal/modules/cjs/loader:1274:20)
     at Module._compile (node:internal/modules/cjs/loader:1320:27)
     at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
     at Module.load (node:internal/modules/cjs/loader:1197:32)
     at Module._load (node:internal/modules/cjs/loader:1013:12)
     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:202:29)
     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
     at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)
     at async loadESM (node:internal/process/esm_loader:34:7)

Node.js v18.19.0
test/same.ts

   8) test/same.ts
test/strict.ts

   9) test/strict.ts

   0 passing (3s)
   9 failing

   1) test/format.ts test/format.ts:
      test/format.ts
   

   2) test/has-strict.ts test/has-strict.ts:
      test/has-strict.ts
   

   3) test/has.ts test/has.ts:
      test/has.ts
   

   4) test/index.ts test/index.ts:
      test/index.ts
   

   5) test/match-only.ts test/match-only.ts:
      test/match-only.ts
   

   6) test/match-strict.ts test/match-strict.ts:
      test/match-strict.ts
   

   7) test/match.ts test/match.ts:
      test/match.ts
   

   8) test/same.ts test/same.ts:
      test/same.ts
   

   9) test/strict.ts test/strict.ts:
      test/strict.ts
   

dh_auto_test: error: /bin/sh -ex debian/tests/pkg-js/test returned exit code 1
make: *** [debian/rules:20: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
--------------------------------------------------------------------------------

The above is just how the build ends and not necessarily the most relevant part.
If required, the full build log is available here:

https://people.debian.org/~sanvila/build-logs/bookworm/

About the archive rebuild: The build was made on virtual machines
of type m6a.large and r6a.large from AWS, using sbuild and a
reduced chroot with only build-essential packages.

If you could not reproduce the bug please contact me privately, as I
am willing to provide ssh access to a virtual machine where the bug is
fully reproducible.

If this is really a bug in one of the build-depends, please use
reassign and affects, so that this is still visible in the BTS web
page for this package.

Thanks.



More information about the Pkg-javascript-devel mailing list