Skip to content

Commit

Permalink
chore: use resolve from pathe
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Nov 12, 2024
1 parent dd068fd commit cc14a69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 6 additions & 7 deletions test/cli/test/fails.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { TestCase } from 'vitest/node'
import path from 'node:path'
import { resolve } from 'pathe'

import { glob } from 'tinyglobby'
Expand Down Expand Up @@ -91,21 +90,21 @@ it('prints a warning if the assertion is not awaited', async () => {
const lines = stderr.split('\n')
lines.forEach((line, index) => {
if (line.includes('Promise returned by')) {
warnings.push(lines.slice(index, index + 2).join('\n').replace(root + path.sep, '<rootDir>'))
warnings.push(lines.slice(index, index + 2).join('\n').replace(`${root}/`, '<rootDir>/'))
}
})
expect(warnings).toMatchInlineSnapshot(`
[
"Promise returned by \`expect(actual).resolves.toBe(expected)\` was not awaited. Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. Please remember to await the assertion.
at <rootDir>base.test.js:5:33",
at <rootDir>/base.test.js:5:33",
"Promise returned by \`expect(actual).rejects.toBe(expected)\` was not awaited. Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. Please remember to await the assertion.
at <rootDir>base.test.js:10:32",
at <rootDir>/base.test.js:10:32",
"Promise returned by \`expect(actual).resolves.toBe(expected)\` was not awaited. Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. Please remember to await the assertion.
at <rootDir>base.test.js:9:33",
at <rootDir>/base.test.js:9:33",
"Promise returned by \`expect(actual).resolves.toBe(expected)\` was not awaited. Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. Please remember to await the assertion.
at <rootDir>base.test.js:14:33",
at <rootDir>/base.test.js:14:33",
"Promise returned by \`expect(actual).toMatchFileSnapshot(expected)\` was not awaited. Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. Please remember to await the assertion.
at <rootDir>base.test.js:19:17",
at <rootDir>/base.test.js:19:17",
]
`)
})
Expand Down
3 changes: 1 addition & 2 deletions test/test-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import type { WorkspaceProjectConfiguration } from 'vitest/config'
import type { TestModule, UserConfig, Vitest, VitestRunMode } from 'vitest/node'
import { webcrypto as crypto } from 'node:crypto'
import fs from 'node:fs'
import { resolve } from 'node:path'
import { Readable, Writable } from 'node:stream'
import { fileURLToPath } from 'node:url'
import { dirname } from 'pathe'
import { dirname, resolve } from 'pathe'
import { x } from 'tinyexec'
import { afterEach, onTestFinished, type WorkerGlobalState } from 'vitest'
import { startVitest } from 'vitest/node'
Expand Down

0 comments on commit cc14a69

Please sign in to comment.