Skip to content

Commit 7620697

Browse files
authored
test: drop node 14 compatibility from a couple test files (#6398)
1 parent b23844d commit 7620697

File tree

3 files changed

+2
-28
lines changed

3 files changed

+2
-28
lines changed

packages/build-info/tests/helpers.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import { execSync } from 'child_process'
2-
import { readFile, readdir, stat } from 'fs/promises'
1+
import { readFile, readdir, stat } from 'node:fs/promises'
32
import { tmpdir } from 'os'
43
import { join } from 'path'
5-
import { version } from 'process'
64
import { fileURLToPath } from 'url'
75

8-
import { Response } from 'node-fetch'
9-
import { compare } from 'semver'
106
import { TestContext, vi } from 'vitest'
117

128
/**
@@ -27,15 +23,7 @@ export const createFixture = async (fixture: string, ctx: TestContext) => {
2723

2824
try {
2925
const src = fileURLToPath(new URL(`fixtures/${fixture}`, import.meta.url))
30-
// fs.cp is only supported in node 16.7+ as long as we have to maintain support for node 14
31-
// we need a workaround for the tests (remove once support is dropped)
32-
if (compare(version, '16.7.0') < 0) {
33-
execSync(`cp -r ${src}/* ${cwd}`)
34-
} else {
35-
await fs.cp(src, cwd, {
36-
recursive: true,
37-
})
38-
}
26+
await fs.cp(src, cwd, { recursive: true })
3927
} catch {
4028
// noop
4129
}

packages/headers-parser/vitest.config.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ import type { BenchmarkUserOptions } from 'vitest'
22
import { defineConfig } from 'vitest/config'
33

44
const benchmarkOptions: BenchmarkUserOptions = {}
5-
// Tinybench dropped support for Node 14 recently so we need to skip benchmark tests for it
6-
// https://github.com/tinylibs/tinybench/pull/40 and
7-
// https://github.com/tinylibs/tinybench/pull/43
8-
// This is just a quick workaround to not run the bench tests in node 14 while we still support it
9-
if (process.version.startsWith('v14')) {
10-
benchmarkOptions.exclude = ['tests/**/*.bench.ts']
11-
}
125

136
export default defineConfig({
147
test: {

packages/redirect-parser/vitest.config.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ import type { BenchmarkUserOptions } from 'vitest'
22
import { defineConfig } from 'vitest/config'
33

44
const benchmarkOptions: BenchmarkUserOptions = {}
5-
// Tinybench dropped support for Node 14 recently so we need to skip benchmark tests for it
6-
// https://github.com/tinylibs/tinybench/pull/40 and
7-
// https://github.com/tinylibs/tinybench/pull/43
8-
// This is just a quick workaround to not run the bench tests in node 14 while we still support it
9-
if (process.version.startsWith('v14')) {
10-
benchmarkOptions.exclude = ['tests/**/*.bench.ts']
11-
}
125

136
export default defineConfig({
147
test: {

0 commit comments

Comments
 (0)