From 374ee7fc967bc8d6dc298d43723f7d6ccfd1807e Mon Sep 17 00:00:00 2001 From: Robin Raju Date: Thu, 16 Jun 2022 20:27:14 +0200 Subject: [PATCH] Fix test failure on windows runner (#461) --- .github/workflows/ci.yml | 3 ++- __tests__/main.test.ts | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbe8dac..916e611 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,8 @@ jobs: node-version: 16 cache: 'npm' - - name: Build and test + - name: Build and test + shell: bash run: | npm ci npm run all diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 7ae6a71..2ed7e07 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -6,12 +6,11 @@ import * as thc from "typed-rest-client/HttpClient" import {IReleaseDownloadSettings} from "../src/download-settings" import {ReleaseDownloader} from "../src/release-downloader" - -const nock = require("nock") +import nock from "nock" let downloader: ReleaseDownloader let httpClent: thc.HttpClient -const outputFilePath = "./target" +const outputFilePath = "./test-output" beforeEach(() => { const githubtoken = process.env.REPO_TOKEN || "" @@ -64,8 +63,8 @@ beforeEach(() => { .replyWithFile(200, __dirname + "/resource/assets/file_example.csv") }) -afterEach(() => { - io.rmRF(outputFilePath) +afterEach(async () => { + await io.rmRF(outputFilePath) }) function readFromFile(fileName: string): string { @@ -141,7 +140,6 @@ test("Download multiple pdf files with wildcard filename", async () => { outFilePath: outputFilePath } const result = await downloader.download(downloadSettings) - core.info(`Result from download: ${result}`) expect(result.length).toBe(2) }, 10000) @@ -156,6 +154,5 @@ test("Download a csv file with wildcard filename", async () => { outFilePath: outputFilePath } const result = await downloader.download(downloadSettings) - core.info(`Result from download: ${result}`) expect(result.length).toBe(1) }, 10000)