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

Tests failed #138

Open
massongit opened this issue Jan 23, 2022 · 5 comments
Open

Tests failed #138

massongit opened this issue Jan 23, 2022 · 5 comments

Comments

@massongit
Copy link

massongit commented Jan 23, 2022

The following tests failed:

$ npm test
...
  6 failing

  1) no-dead-link
       should treat 301 https://httpstat.us/301:

      AssertionError [ERR_ASSERTION]: "message should be "https://httpstat.us/301 is redirected to https://httpstat.us/. (301 Moved Permanently)"
      + expected - actual

      -https://httpstat.us/301 is dead. (301 Moved Permanently)
      +https://httpstat.us/301 is redirected to https://httpstat.us/. (301 Moved Permanently)
      
      at /path/to/textlint-rule-no-dead-link/node_modules/textlint-tester/src/test-util.ts:121:24
      at Array.forEach (<anonymous>)
      at /path/to/textlint-rule-no-dead-link/node_modules/textlint-tester/src/test-util.ts:91:16
      at processTicksAndRejections (node:internal/process/task_queues:96:5)

  2) no-dead-link
       Fixer: should treat 301 https://httpstat.us/301:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ 'should treat 301 https://httpstat.us/301'
- 'should treat 301 https://httpstat.us/'
      + expected - actual

      -should treat 301 https://httpstat.us/301
      +should treat 301 https://httpstat.us/
      
      at /path/to/textlint-rule-no-dead-link/node_modules/textlint-tester/src/textlint-tester.ts:239:28
      at processTicksAndRejections (node:internal/process/task_queues:96:5)

  3) no-dead-link
       should treat 301 [link](https://httpstat.us/301):

      AssertionError [ERR_ASSERTION]: "message should be "https://httpstat.us/301 is redirected to https://httpstat.us/. (301 Moved Permanently)"
      + expected - actual

      -https://httpstat.us/301 is dead. (301 Moved Permanently)
      +https://httpstat.us/301 is redirected to https://httpstat.us/. (301 Moved Permanently)
      
      at /path/to/textlint-rule-no-dead-link/node_modules/textlint-tester/src/test-util.ts:121:24
      at Array.forEach (<anonymous>)
      at /path/to/textlint-rule-no-dead-link/node_modules/textlint-tester/src/test-util.ts:91:16
      at processTicksAndRejections (node:internal/process/task_queues:96:5)

  4) no-dead-link
       Fixer: should treat 301 [link](https://httpstat.us/301):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ 'should treat 301 [link](https://httpstat.us/301)'
- 'should treat 301 [link](https://httpstat.us/)'
      + expected - actual

      -should treat 301 [link](https://httpstat.us/301)
      +should treat 301 [link](https://httpstat.us/)
      
      at /path/to/textlint-rule-no-dead-link/node_modules/textlint-tester/src/textlint-tester.ts:239:28
      at processTicksAndRejections (node:internal/process/task_queues:96:5)

  5) no-dead-link
       should treat 302 [link](https://httpstat.us/302):

      AssertionError [ERR_ASSERTION]: "message should be "https://httpstat.us/302 is redirected to https://httpstat.us/. (302 Found)"
      + expected - actual

      -https://httpstat.us/302 is dead. (302 Found)
      +https://httpstat.us/302 is redirected to https://httpstat.us/. (302 Found)
      
      at /path/to/textlint-rule-no-dead-link/node_modules/textlint-tester/src/test-util.ts:121:24
      at Array.forEach (<anonymous>)
      at /path/to/textlint-rule-no-dead-link/node_modules/textlint-tester/src/test-util.ts:91:16
      at processTicksAndRejections (node:internal/process/task_queues:96:5)

  6) no-dead-link
       Fixer: should treat 302 [link](https://httpstat.us/302):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ 'should treat 302 [link](https://httpstat.us/302)'
- 'should treat 302 [link](https://httpstat.us/)'
      + expected - actual

      -should treat 302 [link](https://httpstat.us/302)
      +should treat 302 [link](https://httpstat.us/)
      
      at /path/to/textlint-rule-no-dead-link/node_modules/textlint-tester/src/textlint-tester.ts:239:28
      at processTicksAndRejections (node:internal/process/task_queues:96:5)



ERROR: "unittest" exited with 6.
@massongit massongit changed the title test failed Test failed Jan 23, 2022
@massongit massongit changed the title Test failed Tests failed Jan 23, 2022
@azu
Copy link
Member

azu commented Jan 23, 2022

It looks taht httpstat behavior is changed.

@azu azu added the Type: Testing For Test label Jan 23, 2022
@azu
Copy link
Member

azu commented Jan 23, 2022

When request with {redirect: 'follow'} option, httpstat return dead link.

First HEAD Request is succuss, but second redirect:follow request is failed.

const finalRes = await fetchWithDefaults(
redirectedUrl,
{ ...opts, redirect: 'follow' },
);

I'm not faimilar with {redirect: follow} works.

@azu
Copy link
Member

azu commented Jan 23, 2022

reproduce code. HEAD with follow is broken.

await fetch("https://httpstat.us", { method: "HEAD", redirect: "follow"})
// [HTTP/1.1 405 Method Not Allowed 144ms]
// Response { type: "basic", url: "https://httpstat.us/", redirected: false, status: 405, ok: false, statusText: "Method Not Allowed", headers: Headers, body: ReadableStream, bodyUsed: false }

@azu
Copy link
Member

azu commented Jan 23, 2022

await fetch("https://httpstat.us", { method: "HEAD" })

It looks like that https://httpstat.us/ top page does not allow HEAD request.
I do not know that this is expected behavior.
Probably, It is reguression bug.

@azu
Copy link
Member

azu commented Jan 23, 2022

#138 (comment)
This finalRes line does not donsider to treat the request error.
It may be a bug.

Workaround:
We can also use altenerive site like https://httpbin.org/ as workaround.

@azu azu added the Type: Bug label Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants