Skip to content
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

[Bug] ENAMETOOLONG: name too long #21

Open
storenth opened this issue Dec 24, 2018 · 3 comments
Open

[Bug] ENAMETOOLONG: name too long #21

storenth opened this issue Dec 24, 2018 · 3 comments
Labels
bug Something isn't working triaged

Comments

@storenth
Copy link

The issue was found when I start to implement next coverage feature:

// *_text.js
Before((I) => {
    I.startCoverage();
    I.amOnPage('https://wikium.ru/');
});

After((I) => {
    I.stopCoverage();
});

// some scenario

with next Extended Puppeteer helper:

// mypuppeteer_helper.js
  async startCoverage() {
    const page = this.helpers['Puppeteer'].page;
    // Enable both JavaScript and CSS coverage
    await Promise.all([
      page.coverage.startJSCoverage()
    ]);
  }
  
  async stopCoverage() {
    const page = this.helpers['Puppeteer'].page;
    const pti = require('/home/storenth/.nvm/versions/node/v11.5.0/lib/node_modules/puppeteer-to-istanbul')
    // Disable both JavaScript and CSS coverage
    const [jsCoverage] = await Promise.all([
      page.coverage.stopJSCoverage()
      ]);
    pti.write(jsCoverage);
  }

Crash every time on most web app:

  ✖ FAILED in 2441ms

    [2] Starting recording promises
    Emitted | suite.after ([object Object])

-- FAILURES:

  1) Localization testing
       "after each" hook: After for "test check language @lang | English":
     ENAMETOOLONG: name too long, open '/home/storenth/Documents/wikium_test_codeceptjs/.nyc_output/js/?uid=dWlkPTI0Mjk0MDgxJnQ9MTU0NTYyNjUxMjQ0NSZyPWh0dHBzJTNBJTJGJTJGd2lraXVtLnJ1JTJGJnU9aHR0cHMlM0ElMkYlMkZ3aWtpdW0ucnUlMkYmYz1xdmlkJTNEMjQyOTQwODElM0IlMjBxcGhvbmUlM0QlM0IlMjBxdmlzaWQlM0QxMjMzMDk4NDElM0IlMjBxcGlkJTNEMCUzQiUyMGdhaWQlM0RHQTEuMi4zMzU4Nzc1NTcuMTU0NTYyNjUwNw==&v=3.3.1.js'
  
  Scenario Steps:
  
  - I.stopCoverage() at Context.After (Wikium_localization_test.js:13:7)
  
  Error: ENAMETOOLONG: name too long, open '/home/storenth/Documents/wikium_test_codeceptjs/.nyc_output/js/?uid=dWlkPTI0Mjk0MDgxJnQ9MTU0NTYyNjUxMjQ0NSZyPWh0dHBzJTNBJTJGJTJGd2lraXVtLnJ1JTJGJnU9aHR0cHMlM0ElMkYlMkZ3aWtpdW0ucnUlMkYmYz1xdmlkJTNEMjQyOTQwODElM0IlMjBxcGhvbmUlM0QlM0IlMjBxdmlzaWQlM0QxMjMzMDk4NDElM0IlMjBxcGlkJTNEMCUzQiUyMGdhaWQlM0RHQTEuMi4zMzU4Nzc1NTcuMTU0NTYyNjUwNw==&v=3.3.1.js'
      at Object.openSync (fs.js:450:3)
      at Object.writeFileSync (fs.js:1212:35)
      at OutputFiles._parseAndIsolate (/home/storenth/.nvm/versions/node/v11.5.0/lib/node_modules/puppeteer-to-istanbul/lib/output-files.js:52:10)
      at new OutputFiles (/home/storenth/.nvm/versions/node/v11.5.0/lib/node_modules/puppeteer-to-istanbul/lib/output-files.js:18:10)
      at module.exports (/home/storenth/.nvm/versions/node/v11.5.0/lib/node_modules/puppeteer-to-istanbul/lib/output-files.js:62:10)
      at new PuppeteerToIstanbul (/home/storenth/.nvm/versions/node/v11.5.0/lib/node_modules/puppeteer-to-istanbul/lib/puppeteer-to-istanbul.js:10:33)
      at module.exports (/home/storenth/.nvm/versions/node/v11.5.0/lib/node_modules/puppeteer-to-istanbul/lib/puppeteer-to-istanbul.js:37:10)
      at Object.write (/home/storenth/.nvm/versions/node/v11.5.0/lib/node_modules/puppeteer-to-istanbul/index.js:5:17)
      at MyPuppeteer.stopCoverage (mypuppeteer_helper.js:38:9)
      at process.internalTickCallback (internal/process/next_tick.js:77:7)


  FAIL  | 1 passed, 1 failed   // 12s
    Emitted | global.result ([object Object])
    Emitted | global.after ([object Object])

I need to know how to avoid this behavior, because pti.write(jsCoverage); root cause of the issue I think.

@storenth
Copy link
Author

storenth commented Dec 24, 2018

Additional info:
If we just catch the exception like

    try{

      pti.write(jsCoverage);
    }
    catch{
      console.log('ups')
    }

nyc report will be empty

ups
    Emitted | step.passed (I stop coverage )
    Emitted | step.finish (I stop coverage )
    Emitted | hook.passed ([object Object])
    Emitted | test.after ([object Object])
    Emitted | suite.after ([object Object])

  OK  | 2 passed   // 29s
    Emitted | global.result ([object Object])
    Emitted | global.after ([object Object])
[12:33:43] storenth@storenth-MacBookAir:~/Documents/wikium_test_codeceptjs$ ll .nyc_output/
total 12
drwxr-xr-x 3 storenth storenth 4096 дек 24 11:41 ./
drwxr-xr-x 7 storenth storenth 4096 дек 24 11:41 ../
drwxr-xr-x 2 storenth storenth 4096 дек 24 12:33 js/
[12:33:49] storenth@storenth-MacBookAir:~/Documents/wikium_test_codeceptjs$ nyc report
----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
----------|----------|----------|----------|----------|-------------------|


@bcoe bcoe added bug Something isn't working triaged labels Dec 29, 2018
@bcoe
Copy link
Member

bcoe commented Dec 29, 2018

This is an interesting issue, seems like we should probably be removing get parameters from the filename right?

@geminiyellow
Copy link

same issue,

Error: ENAMETOOLONG: name too long

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged
Projects
None yet
Development

No branches or pull requests

3 participants