test: mark the skipped tests in jest

This commit is contained in:
Amin Yahyaabadi 2023-09-04 19:27:23 -07:00
parent b10559687a
commit aa96482204
7 changed files with 33 additions and 26 deletions

View File

@ -3,6 +3,7 @@
"ignorePatterns": ["dist/", "node_modules/", "dev/cpp_vcpkg_project"], "ignorePatterns": ["dist/", "node_modules/", "dev/cpp_vcpkg_project"],
"rules": { "rules": {
"no-unused-vars": "off", "no-unused-vars": "off",
"no-empty-function": "off",
"@typescript-eslint/no-unused-vars": [ "@typescript-eslint/no-unused-vars": [
"warn", "warn",
{ {

View File

@ -3,10 +3,11 @@ import { testBin } from "../../utils/tests/test-helpers"
jest.setTimeout(300000) jest.setTimeout(300000)
describe("setup-brew", () => { describe("setup-brew", () => {
if (process.platform === "win32") {
it.skip("should setup brew", () => {})
return
}
it("should setup brew", async () => { it("should setup brew", async () => {
if (process.platform !== "darwin") {
return
}
const installInfo = await setupBrew("", "", process.arch) const installInfo = await setupBrew("", "", process.arch)
await testBin("brew", ["--version"], installInfo?.binDir) await testBin("brew", ["--version"], installInfo?.binDir)
}) })

View File

@ -4,10 +4,11 @@ import { setupChocolatey } from "../chocolatey"
jest.setTimeout(300000) jest.setTimeout(300000)
describe("setup-chocolatey", () => { describe("setup-chocolatey", () => {
if (process.platform !== "win32") {
it.skip("should setup chocolatey", () => {})
return
}
it("should setup chocolatey", async () => { it("should setup chocolatey", async () => {
if (process.platform !== "win32") {
return
}
const { binDir } = (await setupChocolatey("", "", process.arch)) as InstallationInfo const { binDir } = (await setupChocolatey("", "", process.arch)) as InstallationInfo
await testBin("choco", ["--version"], binDir) await testBin("choco", ["--version"], binDir)
}) })

View File

@ -2,12 +2,14 @@ import { setupMacOSSDK } from "../macos-sdk"
jest.setTimeout(300000) jest.setTimeout(300000)
describe("setup-macos-sdk", () => { describe("setup-macos-sdk", () => {
if (process.platform !== "darwin") {
it.skip("should setup macos-sdk", () => {})
return
}
it("should setup macos-sdk", async () => { it("should setup macos-sdk", async () => {
if (process.platform === "darwin") { process.env.SDKROOT = undefined
process.env.SDKROOT = undefined await setupMacOSSDK()
await setupMacOSSDK() expect(process.env.SDKROOT).toBeTruthy()
expect(process.env.SDKROOT).toBeTruthy() expect(typeof process.env.SDKROOT).toBe("string")
expect(typeof process.env.SDKROOT).toBe("string")
}
}) })
}) })

View File

@ -5,13 +5,12 @@ import { warning } from "ci-log"
jest.setTimeout(300000) jest.setTimeout(300000)
describe("setup-msvc", () => { describe("setup-msvc", () => {
const isWindows = process.platform === "win32" if (process.platform !== "win32") {
it.skip("should setup msvc", () => {})
return
}
it("should setup the pre-installed msvc", async () => { it("should setup the pre-installed msvc", async () => {
try { try {
if (!isWindows) {
return
}
await setupMSVC("", "", process.arch) await setupMSVC("", "", process.arch)
console.log(which.sync("cl")) console.log(which.sync("cl"))
} catch (err) { } catch (err) {
@ -22,10 +21,11 @@ describe("setup-msvc", () => {
}) })
for (const version of [2022, 2019, 2017, 2015]) { for (const version of [2022, 2019, 2017, 2015]) {
if (runnerWindowsVersion() !== undefined && runnerWindowsVersion()! > version) {
it.skip(`should setup msvc ${version}`, () => {})
return
}
it(`should setup msvc ${version}`, async () => { it(`should setup msvc ${version}`, async () => {
if (!isWindows || (runnerWindowsVersion() !== undefined && runnerWindowsVersion()! > version)) {
return
}
try { try {
await setupMSVC(`${version}`, "", process.arch) await setupMSVC(`${version}`, "", process.arch)
console.log(which.sync("cl")) console.log(which.sync("cl"))

View File

@ -4,10 +4,11 @@ import { isUbuntu } from "../../utils/env/isUbuntu"
jest.setTimeout(300000) jest.setTimeout(300000)
describe("setup-nala", () => { describe("setup-nala", () => {
if (!isUbuntu()) {
test.skip("should setup nala", () => {})
return
}
it("should setup nala", async () => { it("should setup nala", async () => {
if (!isUbuntu()) {
return
}
const installInfo = await setupNala("", "", process.arch) const installInfo = await setupNala("", "", process.arch)
await testBin("nala", ["--version"], installInfo?.binDir) await testBin("nala", ["--version"], installInfo?.binDir)
}) })

View File

@ -3,10 +3,11 @@ import { testBin } from "../../utils/tests/test-helpers"
jest.setTimeout(300000) jest.setTimeout(300000)
describe("setup-OpenCppCoverage", () => { describe("setup-OpenCppCoverage", () => {
if (process.platform !== "win32") {
it.skip("should setup OpenCppCoverage", () => {})
return
}
it("should setup OpenCppCoverage", async () => { it("should setup OpenCppCoverage", async () => {
if (process.platform !== "win32") {
return
}
const installationInfo = await setupOpencppcoverage("", "", process.arch) const installationInfo = await setupOpencppcoverage("", "", process.arch)
await testBin("OpenCppCoverage", null, installationInfo?.binDir) // OpenCppCoverage exits with non-zero even with --help await testBin("OpenCppCoverage", null, installationInfo?.binDir) // OpenCppCoverage exits with non-zero even with --help