Open falsandtru opened 3 years ago
@twada Is this working on your projects?
I found this is caused by the update of espurify.
@falsandtru Oh thank you for reporting. I'm going to investigate this issue.
Thanks.
@falsandtru I cannot reproduce the case since assert.doesNotThrow
still removed properly. Would you make a small reproduction case?
Did you test after clean install?
yes
$ mkdir pd-unassert
$ cd pd-unassert
$ npm init -y
Wrote to /Users/takuto/work/pd-unassert/package.json:
{
"name": "pd-unassert",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
$ npm install --save-dev unassert-cli
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN pd-unassert@1.0.0 No description
npm WARN pd-unassert@1.0.0 No repository field.
+ unassert-cli@1.0.0
added 43 packages from 130 contributors and audited 43 packages in 3.71s
9 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$ cat <<EOT >> prod.js
heredoc> const assert = require('assert');
heredoc> function fail() {
heredoc> throw new Error('fail');
heredoc> }
heredoc> assert.doesNotThrow(function () {
heredoc> fail();
heredoc> });
heredoc> EOT
$ cat prod.js
const assert = require('assert');
function fail() {
throw new Error('fail');
}
assert.doesNotThrow(function () {
fail();
});
$ npx unassert prod.js
function fail() {
throw new Error('fail');
}
$
Indeed. I couldn't make a simple repro. FYI, the leaked assertions are this: https://github.com/falsandtru/pjax-api/commit/265f135050411c4db110db8162485dddea85bf54. Since they are few (almost all assertions are removed), this bug is stateful. Can you release the updated version at first?
The current repro:
npm i
gulp dist
dist/pjax-api.js
@falsandtru Thank you for your repro case! I'm going to find the root cause and fix it.
Since the current espurify is broken, can you release v2.0.1 as the latest?
No, no, espurify is not broken but unssert do. I'll cut some bugfix releases ASAP.
OK.
Since the current espurify is broken, can you release v2.0.1 as the latest?
First I've tagged espurify@2.0.1 as latest.
That's what I intended. Thanks.
Now the sub functions such as assert.doesNotThrow won't be removed. Probably this is a bug on the upstream.