#1012023 debian/tests/pkg-js/files not working for node-webpack-sources

Package:
pkg-js-tools
Source:
pkg-js-tools
Submitter:
Pirate Praveen
Date:
2022-09-12 15:48:04 UTC
Severity:
important
Tags:
#1012023#5
Date:
2022-05-28 07:56:50 UTC
From:
To:
Package: node-webpack-sources
Version: 3.2.1-3
Severity: serious
Control: block -1 by 1004658
Control: tags -1 help

Autopkgtest is failing as it needs node-source-map 0.7 and that is blocked by mismatch in embedded and built from source wasm file.

This is blocking webpack 5 migration to testing.

https://ci.debian.net/data/autopkgtest/testing/amd64/n/node-webpack-sources/22182585/log.gz

#1012023#14
Date:
2022-05-28 08:25:31 UTC
From:
To:
On Sat, 28 May 2022 13:26:50 +0530 Pirate Praveen  <praveen@onenetbeyond.org> wrote:
 > Autopkgtest is failing as it needs node-source-map 0.7 and that is
blocked by mismatch in embedded and built from source wasm file.
 >
 > This is blocking webpack 5 migration to testing.
 >
 >
https://ci.debian.net/data/autopkgtest/testing/amd64/n/node-webpack-sources/22182585/log.gz

with node-source-map 0.7 built from salsa master branch, there is only
1 failure. 26 tests were failing earlier with node-source-map 0.6.

FAIL test/ReplaceSource.js
  ● ReplaceSource › should produce correct source map

    TypeError: consumer.eachMapping is not a function

      88 | });
      89 |
    > 90 | consumer.eachMapping(function (mapping) {
         | ^
      91 | mappingCount++;
      92 |
      93 | validateMapping(mapping);

      at validate
(debian/tests/test_modules/sourcemap-validator/index.js:90:12)
      at Object.<anonymous> (test/ReplaceSource.js:206:3)

PASS test/package-entry.js
PASS test/SizeOnlySource.js

Test Suites: 1 failed, 9 passed, 10 total
Tests: 1 failed, 59 passed, 60 total
Snapshots: 16 passed, 16 total
Time: 3.755 s
Ran all test suites.

#1012023#19
Date:
2022-05-28 16:55:18 UTC
From:
To:

This is a red herring.

The autopkgtest fails aren't related to node-source-map at all.

Specifically, the tests don't fail in gbp buildpackage, but only in
autopkgtest, that too only in one particular stage.

That's because the __mocks__ that jest relies on are in the lib/helpers/
directory and that's not available somehow to the autopkgtest run. For
example, if you do autopkgtest with --shell-fail and after it fails copy
__mocks__ to /usr/share/nodejs/webpack-sources/lib/helpers and rerun the 
test with /usr/share/pkg-js-autopkgtest/runner it passes

You can replicate it by downloading upstream code and removing
`__mocks__` folder and running yarnpkg test


https://wiki.debian.org/ContinuousIntegration/AutopkgtestBestPractices#Recommendations

 > Use upstream test-suite if they have as-installed test

The jest tests are not as-installed

#1012023#24
Date:
2022-05-28 19:23:47 UTC
From:
To:
package.json has

 "files": [
    "lib/",
    "!lib/helpers/__mocks__"

So this directory is excluded from the deb. We can add this to
debian/tests/pkg-js/files to include it in autopkgtest environment. I'm
trying this now.

#1012023#37
Date:
2022-05-28 20:37:54 UTC
From:
To:
On Sun, 29 May 2022 00:53:47 +0530 Pirate Praveen  <praveen@onenetbeyond.org> wrote:
 > package.json has
 >
 >  "files": [
 >     "lib/",
 >     "!lib/helpers/__mocks__"
 >
 > So this directory is excluded from the deb. We can add this to
 > debian/tests/pkg-js/files to include it in autopkgtest environment.
I'm
 > trying this now.

This did not work as expected and I think this is a bug in
pkg-js-tools. For now, as a work around, I have created
debian/node-webpack-sources.install and installed these files. Once the
bug is fixed in pkg-js-tools, we can remove
debian/node-webpack-sources.install

I think package.json exclude has a higher priority than
debian/tests/pkg-js/files. This should be changed to give a higher
priority to debian/tests/pkg-js/files.

#1012023#42
Date:
2022-06-01 07:37:58 UTC
From:
To:
Decreasing severity since:
  * node-source-map 0.7 isn't published
  * workarounds exists