Skip to content

Won't work for sub functions #18

Open

Description

@falsandtru

Now the sub functions such as assert.doesNotThrow won't be removed. Probably this is a bug on the upstream.

Activity

  1. falsandtru commented on Mar 27, 2021

    @falsandtru
    Author

    @twada Is this working on your projects?

  2. falsandtru commented on Mar 27, 2021

    @falsandtru
    Author

    I found this is caused by the update of espurify.

  3. twada commented on Mar 27, 2021

    @twada
    Member

    @falsandtru Oh thank you for reporting. I'm going to investigate this issue.

  4. falsandtru commented on Mar 27, 2021

    @falsandtru
    Author

    Thanks.

  5. twada commented on Mar 27, 2021

    @twada
    Member

    @falsandtru I cannot reproduce the case since assert.doesNotThrow still removed properly. Would you make a small reproduction case?

    #19

  6. falsandtru commented on Mar 27, 2021

    @falsandtru
    Author

    Did you test after clean install?

  7. twada commented on Mar 27, 2021

    @twada
    Member

    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');
    }
    $ 
  8. falsandtru commented on Mar 27, 2021

    @falsandtru
    Author

    Indeed. I couldn't make a simple repro. FYI, the leaked assertions are this: falsandtru/pjax-api@265f135. Since they are few (almost all assertions are removed), this bug is stateful. Can you release the updated version at first?

  9. falsandtru commented on Mar 28, 2021

    @falsandtru
    Author

    The current repro:

    1. Clone https://github.com/falsandtru/pjax-api
    2. Checkout 4bf593c1d2350ca332f2e943f03ec99b8d4046bf
    3. Run npm i
    4. Run gulp dist
    5. See dist/pjax-api.js
  10. twada commented on Mar 29, 2021

    @twada
    Member

    @falsandtru Thank you for your repro case! I'm going to find the root cause and fix it.

  11. falsandtru commented on Mar 29, 2021

    @falsandtru
    Author

    Since the current espurify is broken, can you release v2.0.1 as the latest?

  12. twada commented on Mar 29, 2021

    @twada
    Member

    No, no, espurify is not broken but unssert do. I'll cut some bugfix releases ASAP.

  13. falsandtru commented on Mar 29, 2021

    @falsandtru
    Author

    OK.

  14. twada commented on Mar 29, 2021

    @twada
    Member

    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.

  15. falsandtru commented on Mar 29, 2021

    @falsandtru
    Author

    That's what I intended. Thanks.

  16. twada commented on Mar 29, 2021

    @twada
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions