-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm test
fails when opening archive
#56042
npm test
fails when opening archive
#56042
Comments
I think it should work, you've got some strange problem as your local setup tried to resolve this as external dependenc. This one is from Debian (WSL2): ➜ DefinitelyTyped git:(master) cd types/wordpress__components
➜ wordpress__components git:(master) ls
angle-picker-control date-time higher-order placeholder spinner
...
custom-select-control form-toggle package.json slot-fill
dashicon form-token-field panel snackbar
➜ wordpress__components git:(master) npm i --no-package-lock
added 24 packages, and audited 25 packages in 6s
found 0 vulnerabilities
➜ wordpress__components git:(master) cd ../..
➜ DefinitelyTyped git:(master) npm test @wordpress/components
> definitely-typed@0.0.3 test
> dtslint types "@wordpress/components"
➜ DefinitelyTyped git:(master) so the @ syntax should work, there is no special support for this, except of proper line in DTLint itself to handle namespaced packages (by a path translation): |
Cool, I'll keep looking. Is it possible Linux is unsupported? I'll also try on macOS. Running the same commands for me: ➜ DefinitelyTyped git:(update/wp-components-v17) ls
azure-pipelines.yml README.es.md README.ru.md
dangerfile.ts README.it.md README.zh.md
LICENSE README.ja.md types
node_modules README.ko.md wordpress-components-17.0.0.tgz
notNeededPackages.json README.md
package.json README.pt.md
➜ DefinitelyTyped git:(update/wp-components-v17) cd types/wordpress__components
➜ wordpress__components git:(update/wp-components-v17) ls
angle-picker-control custom-select-control font-size-picker menu-items-choice radio-control textarea-control
animate dashicon form-file-upload modal range-control text-control
autocomplete date-time form-toggle navigable-container resizable-box toggle-control
base-control disabled form-token-field node_modules responsive-wrapper toolbar
button draggable higher-order notice sandbox toolbar-button
button-group dropdown icon package.json scroll-lock tooltip
card dropdown-menu icon-button package-lock.json select-control tree-select
checkbox-control drop-zone index.d.ts panel shortcut tsconfig.json
clipboard-button external-link isolated-event-container placeholder slot-fill tslint.json
color-indicator flex keyboard-shortcuts popover snackbar wordpress__components-tests.tsx
color-palette focal-point-picker menu-group primitives spinner
color-picker focusable-iframe menu-item query-controls tab-panel
➜ wordpress__components git:(update/wp-components-v17) npm i --no-package-lock
changed 1 package, and audited 25 packages in 2s
found 0 vulnerabilities
➜ wordpress__components git:(update/wp-components-v17) cd ..
➜ types git:(update/wp-components-v17) npm test @wordpress/components
> definitely-typed@0.0.3 test
> dtslint types "@wordpress/components"
tar (child): @wordpress/components-17.0.0.tgz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now |
No, I don't think so Linux is unsupported. All CI actions are run on Ubuntu (same installs). I cannot use native *nix at the moment, by my WSL2 Ubuntu/Debian distros do not show this problem
this should be on parent/root of the repo:
|
👍
Ah, that's my bad for the example. I get the same error from the root, though. I do have a sparse checkout, so I could try cloning the whole thing. (I resolved all of the issues reported earlier in the test step though 🤔) |
No, same error on |
I actually get a lot more error output on macOS, though this is still a sparse checkout: ~/source/DefinitelyTyped(master) » npm test @wordpress/components
> definitely-typed@0.0.3 test
> dtslint types "@wordpress/components"
tar: Error opening archive: Failed to open '@wordpress/components-14.0.0.tgz'
Error: /Users/noahtallen/source/DefinitelyTyped/types/wordpress__components/color-picker/index.d.ts:2:28
ERROR: 2:28 expect TypeScript@4.5 compile error:
Cannot find module 'tinycolor2' or its corresponding type declarations.
/Users/noahtallen/source/DefinitelyTyped/types/wordpress__components/custom-select-control/index.d.ts:2:28
ERROR: 2:28 expect TypeScript@4.5 compile error:
Cannot find module 'downshift' or its corresponding type declarations.
/Users/noahtallen/source/DefinitelyTyped/types/wordpress__components/higher-order/with-focus-outside/index.d.ts:1:27
ERROR: 1:27 expect TypeScript@4.5 compile error:
Cannot find module '@wordpress/element' or its corresponding type declarations.
/Users/noahtallen/source/DefinitelyTyped/types/wordpress__components/resizable-box/index.d.ts:2:32
ERROR: 2:32 expect TypeScript@4.5 compile error:
Cannot find module 're-resizable' or its corresponding type declarations.
/Users/noahtallen/source/DefinitelyTyped/types/wordpress__components/slot-fill/context.d.ts:1:27
ERROR: 1:27 expect TypeScript@4.5 compile error:
Cannot find module '@wordpress/element' or its corresponding type declarations.
/Users/noahtallen/source/DefinitelyTyped/types/wordpress__components/wordpress__components-tests.tsx:2:27
ERROR: 2:27 expect TypeScript@4.5 compile error:
Cannot find module '@wordpress/element' or its corresponding type declarations.
ERROR: 211:15 expect TypeScript@4.5 compile error:
Parameter 'v' implicitly has an 'any' type.
ERROR: 1035:9 expect TypeScript@4.5 compile error:
Argument of type 'typeof (Anonymous class)' is not assignable to parameter of type 'HFOComponent<any, any>'.
Type '(Anonymous class)' is missing the following properties from type 'Component<any, any, any>': context, setState, forceUpdate, props, and 2 more.
ERROR: 1040:35 expect TypeScript@4.5 compile error:
Property 'props' does not exist on type '(Anonymous class)'.
ERROR: 1051:31 expect TypeScript@4.5 compile error:
Property 'props' does not exist on type 'PredefinedComponentClass'.
ERROR: 1054:65 expect TypeScript@4.5 compile error:
Argument of type 'typeof PredefinedComponentClass' is not assignable to parameter of type 'HFOComponent<any, any>'.
Type 'PredefinedComponentClass' is missing the following properties from type 'Component<any, any, any>': context, setState, forceUpdate, props, and 2 more.
at /Users/noahtallen/source/DefinitelyTyped/node_modules/dtslint/bin/index.js:207:19
at Generator.next (<anonymous>)
at fulfilled (/Users/noahtallen/source/DefinitelyTyped/node_modules/dtslint/bin/index.js:6:58) |
But after resolving those issues (npm i and adding the missing type/ directories), still getting the same error on mac:
super weird! |
npm test
fails with namespaced packagenpm test
fails when opening archive
this is different problem. When testing locally, there is no CI script that install all nested dependencies. One is expected to do this oneself. Here I would usually go to: cd types/webapck
npm i --no-package-lock and for any dependency for current test, that is required to be installed from some |
I agree -- while I did get those errors, after installing the nested dependencies, those errors go away and I'm left with the thing about |
I'm on another machine now, and I was really hoping it would start working, as I've set the repo up from scratch again! Still getting this error: $ npm test '@wordpress/data-controls'
> definitely-typed@0.0.3 test
> dtslint types "@wordpress/data-controls"
tar (child): @wordpress/data-controls-2.2.6.tgz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now |
It's creating a tar file and then trying to access it with the incorrect name: ~/source/DefinitelyTyped wp-data-controls-2.2.6
$ npm test @wordpress/data-controls
> definitely-typed@0.0.3 test
> dtslint types "@wordpress/data-controls"
tar (child): @wordpress/data-controls-2.2.6.tgz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
~/source/DefinitelyTyped wp-data-controls-2.2.6 6s
$ ls
azure-pipelines.yml notNeededPackages.json README.ja.md README.ru.md
dangerfile.ts package.json README.ko.md README.zh.md
LICENSE README.es.md README.md types
node_modules README.it.md README.pt.md wordpress-data-controls-2.2.6.tgz
|
I think I've narrowed it down to the |
It happens somewhere inside of this function call: https://github.com/microsoft/dtslint/blob/8ec7ef4bce4122b911c5990b24241d86eef1464d/src/rules/npmNamingRule.ts#L180 |
The tarball name here: https://github.com/DefinitelyTyped/dts-critic/blob/b079c11437c03a6b9d68a95ba2b2872b80201a9c/index.ts#L320 is definitely incorrect. It is considered |
Yeah, ~/source/DefinitelyTyped wp-data-controls-2.2.6*
$ ls
azure-pipelines.yml node_modules README.it.md README.ru.md
dangerfile.ts notNeededPackages.json README.ja.md README.zh.md
definitely-typed@0.0.3 package README.ko.md types
dtslint package.json README.md
LICENSE README.es.md README.pt.md
~/source/DefinitelyTyped wp-data-controls-2.2.6*
$ npm pack "@wordpress/data-controls"
npm notice
npm notice 📦 @wordpress/data-controls@2.2.6
npm notice === Tarball Contents ===
npm notice 1.2kB CHANGELOG.md
npm notice 36.4kB LICENSE.md
npm notice 2.8kB README.md
npm notice 3.7kB build-module/index.js
npm notice 5.7kB build-module/index.js.map
npm notice 4.1kB build/index.js
npm notice 5.5kB build/index.js.map
npm notice 969B package.json
npm notice 3.6kB src/index.js
npm notice 664B src/test/index.js
npm notice === Tarball Details ===
npm notice name: @wordpress/data-controls
npm notice version: 2.2.6
npm notice filename: @wordpress/data-controls-2.2.6.tgz
npm notice package size: 17.6 kB
npm notice unpacked size: 64.6 kB
npm notice shasum: fb927cd060dbd08e56661c153278746c2d16d195
npm notice integrity: sha512-voh/MjwThLZGO[...]C/yQSiZMKo5ZA==
npm notice total files: 10
npm notice
wordpress-data-controls-2.2.6.tgz
~/source/DefinitelyTyped wp-data-controls-2.2.6*
$ ls
azure-pipelines.yml package README.pt.md
dangerfile.ts package.json README.ru.md
definitely-typed@0.0.3 README.es.md README.zh.md
dtslint README.it.md types
LICENSE README.ja.md wordpress-data-controls-2.2.6.tgz
node_modules README.ko.md
notNeededPackages.json README.md
|
There's even an existing issue: npm/cli#3405 |
A workaround is to use an older npm version, such as v6.14.15. |
Update: This is caused by npm/cli#3405.
npm pack
outputs the filename in its info as@pakage/foo.tar.gz
, but actually saves it aspackage/foo.tar.gz
. As a result, whendts-critic
does to open that tar.gz, it has the wrong filename, and the tests fail. This happens on newer npm versions, and can be worked around by using npm v6.When running
npm run test
locally, I am getting the following error:I get the same error whether I use
@wordpress/components
orwordpress__components
. From what I can tell, the file is being saved, but without the leading@
symbol. For example:So it attempts to open
@wordpress/components...
, but the saved file is actuallywordpress/components...
. I poked around indtslint
, but I couldn't find anywhere it tries to runtar
commands.The text was updated successfully, but these errors were encountered: