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

After update to 1.2.* need to refresh tests in order to get latest test output #472

Open
4 tasks done
sashberd opened this issue Sep 18, 2024 · 3 comments
Open
4 tasks done

Comments

@sashberd
Copy link

sashberd commented Sep 18, 2024

Describe the bug

After updating to version 1.2.*, the extension seems to be caching outdated code, leading to incorrect test results. To obtain accurate test output, it is necessary to refresh the tests.

Reproduction

20240918_095813

Output

As shown in the attached video, you may need to press Ctrl+;+R to refresh your code and ensure that the latest changes are reflected in the test results."

The Output:
[INFO 10:03:13 AM] Running 1 file(s) with name pattern: ^\s?CorrectDiagnosticArea component unit tests
[10:03:13 AM] The runner is starting because tests C:/Users/LQ4161/Desktop/Dev/darwin-web/src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx were started due to a file change
[10:03:13 AM] Enqueuing "CorrectDiagnosticArea component unit tests
[10:03:13 AM] Enqueuing "should render component in case of state is pending close
[10:03:17 AM] No task result for "should render component in case of state is pending close", assuming the test just started running
[10:03:17 AM] Marking "should render component in case of state is pending close" as passed
[10:03:17 AM] Ending test run src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx
[INFO 10:03:21 AM] Running 1 file(s) with name pattern: ^\s?CorrectDiagnosticArea component unit tests
[10:03:21 AM] The runner is starting because tests C:/Users/LQ4161/Desktop/Dev/darwin-web/src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx were started due to a file change
[10:03:21 AM] Enqueuing "CorrectDiagnosticArea component unit tests
[10:03:21 AM] Enqueuing "should render component in case of state is pending close
[10:03:25 AM] No task result for "should render component in case of state is pending close", assuming the test just started running
[10:03:25 AM] Marking "should render component in case of state is pending close" as passed
[10:03:25 AM] Ending test run src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx
[INFO 10:03:27 AM] [API] Vitest process 23148 closed successfully
[INFO 10:03:27 AM] [API] Running Vitest v2.0.5 (darwin-web/vitest.config.ts) with Node.js: C:\Program Files\nodejs\node.EXE
[INFO 10:03:28 AM] [API] Vitest v2.0.5 (darwin-web/vitest.config.ts) process 17372 created
[INFO 10:03:28 AM] [API] Collecting tests: src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx
[10:03:28 AM] Not starting the runner because tests are being collected
[10:03:33 AM] There is no test run for "correctDiagnosticArea.test.tsx"
[10:03:33 AM] No test run to finish for C:/Users/LQ4161/Desktop/Dev/darwin-web/src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx
[INFO 10:03:34 AM] Running 1 file(s) with name pattern: ^\s?CorrectDiagnosticArea component unit tests
[10:03:34 AM] The runner is starting because tests C:/Users/LQ4161/Desktop/Dev/darwin-web/src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx were started due to a file change
[10:03:34 AM] Enqueuing "CorrectDiagnosticArea component unit tests
[10:03:34 AM] Enqueuing "should render component in case of state is pending close
[10:03:39 AM] No task result for "should render component in case of state is pending close", assuming the test just started running
[10:03:39 AM] No errors found for "correctDiagnosticArea.test.tsx"
[10:03:39 AM] No errors found for "CorrectDiagnosticArea component unit tests"
[10:03:39 AM] Could not find a valid stack for should render component in case of state is pending close [
  {
    "method": "assertNotNullOrUndefined",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/matches.js",
    "line": 12,
    "column": 11
  },
  {
    "method": "matches",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/matches.js",
    "line": 35,
    "column": 3
  },
  {
    "method": "",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/query-helpers.js",
    "line": 37,
    "column": 82
  },
  {
    "method": "queryAllByAttribute",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/query-helpers.js",
    "line": 37,
    "column": 67
  },
  {
    "method": "queryAllByTestId",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/queries/test-id.js",
    "line": 13,
    "column": 44
  },
  {
    "method": "",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/query-helpers.js",
    "line": 74,
    "column": 17
  },
  {
    "method": "",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/query-helpers.js",
    "line": 52,
    "column": 17
  },
  {
    "method": "",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/query-helpers.js",
    "line": 95,
    "column": 19
  },
  {
    "method": "",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx",
    "line": 33,
    "column": 19
  }
]
[10:03:39 AM] Marking "should render component in case of state is pending close" as failed with 1 errors
[10:03:39 AM] No errors found for "correctDiagnosticArea.test.tsx"
[10:03:39 AM] Ending test run src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx
[INFO 10:03:45 AM] Running 1 file(s) with name pattern: ^\s?CorrectDiagnosticArea component unit tests
[10:03:45 AM] The runner is starting because tests C:/Users/LQ4161/Desktop/Dev/darwin-web/src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx were started due to a file change
[10:03:45 AM] Enqueuing "CorrectDiagnosticArea component unit tests
[10:03:45 AM] Enqueuing "should render component in case of state is pending close
[10:03:49 AM] No task result for "should render component in case of state is pending close", assuming the test just started running
[10:03:49 AM] No errors found for "correctDiagnosticArea.test.tsx"
[10:03:49 AM] No errors found for "CorrectDiagnosticArea component unit tests"
[10:03:49 AM] Could not find a valid stack for should render component in case of state is pending close [
  {
    "method": "assertNotNullOrUndefined",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/matches.js",
    "line": 12,
    "column": 11
  },
  {
    "method": "matches",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/matches.js",
    "line": 35,
    "column": 3
  },
  {
    "method": "",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/query-helpers.js",
    "line": 37,
    "column": 82
  },
  {
    "method": "queryAllByAttribute",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/query-helpers.js",
    "line": 37,
    "column": 67
  },
  {
    "method": "queryAllByTestId",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/queries/test-id.js",
    "line": 13,
    "column": 44
  },
  {
    "method": "",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/query-helpers.js",
    "line": 74,
    "column": 17
  },
  {
    "method": "",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/query-helpers.js",
    "line": 52,
    "column": 17
  },
  {
    "method": "",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/node_modules/.pnpm/@[email protected]/node_modules/@testing-library/dom/dist/query-helpers.js",
    "line": 95,
    "column": 19
  },
  {
    "method": "",
    "file": "C:/Users/LQ4161/Desktop/Dev/darwin-web/src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx",
    "line": 33,
    "column": 19
  }
]
[10:03:49 AM] Marking "should render component in case of state is pending close" as failed with 1 errors
[10:03:49 AM] No errors found for "correctDiagnosticArea.test.tsx"
[10:03:49 AM] Ending test run src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx
[INFO 10:03:52 AM] [API] Vitest process 17372 closed successfully
[INFO 10:03:52 AM] [API] Running Vitest v2.0.5 (darwin-web/vitest.config.ts) with Node.js: C:\Program Files\nodejs\node.EXE
[INFO 10:03:52 AM] [API] Vitest v2.0.5 (darwin-web/vitest.config.ts) process 20768 created
[INFO 10:03:52 AM] [API] Collecting tests: src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx
[10:03:52 AM] Not starting the runner because tests are being collected
[10:03:58 AM] There is no test run for "correctDiagnosticArea.test.tsx"
[10:03:58 AM] No test run to finish for C:/Users/LQ4161/Desktop/Dev/darwin-web/src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx
[INFO 10:03:59 AM] Running 1 file(s) with name pattern: ^\s?CorrectDiagnosticArea component unit tests
[10:03:59 AM] The runner is starting because tests C:/Users/LQ4161/Desktop/Dev/darwin-web/src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx were started due to a file change
[10:03:59 AM] Enqueuing "CorrectDiagnosticArea component unit tests
[10:03:59 AM] Enqueuing "should render component in case of state is pending close
[10:04:04 AM] No task result for "should render component in case of state is pending close", assuming the test just started running
[10:04:04 AM] Marking "should render component in case of state is pending close" as passed
[10:04:04 AM] Ending test run src/tests/app/modules/report-status/correctDiagnosticArea.test.tsx

Version

1.2.7

VSCode Data:
Version: 1.93.0 (user setup)
Commit: 4849ca9bdf9666755eb463db297b69e5385090e3
Date: 2024-09-04T13:02:38.431Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.19045

Validations

@AriPerkkio
Copy link
Member

Are you sure this is caused by the extension? There's an open issue on VSCode too: microsoft/vscode#222098 (comment).

I'm seeing this same bug even when I disable the extension completely.

@sashberd
Copy link
Author

@AriPerkkio You are right! After I disabled TypeScript › Tsserver › Experimental: Use Vs Code Watcher, it works without refresh.
However, now it looks like it stuck after changes and won`t run again. Only debug option runs the tests
(It started run again after at least 15 seconds of wait)

20240918_112317

@timotheeguerin
Copy link

Not sure if this is the same issue but since version 1.2.3 (worked in 1.2.2) it won't refresh change for files loaded dynamically. This is using the latest version of vitest

And following config

export default defineConfig({
  test: {
    exclude: ["node_modules", "dist/test"],
  },
  server: {
    watch: {
      ignored: [],
    },
  },
});

Made a repro here https://github.com/timotheeguerin/vitest-vscode-dynamic-repro

If you run the tests then update the console.log in foo.ts and run the test again you can see its not updating.

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

3 participants