fix(test): Github Actions上で外部サイトへの取得を行うテストをスキップするように (#38)

This commit is contained in:
かっこかり 2025-02-02 10:59:35 +09:00 committed by GitHub
parent fc9f7db477
commit 71a6aefb8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -31,4 +31,4 @@ jobs:
pnpm build
- name: Test
run: |
pnpm test
SKIP_NETWORK_TEST=true pnpm test

View File

@ -12,7 +12,7 @@ import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { Agent as httpAgent } from 'node:http';
import { Agent as httpsAgent } from 'node:https';
import { expect, test, describe, beforeEach, afterEach } from '@jest/globals';
import { expect, test, describe, beforeEach, afterEach, xtest } from '@jest/globals';
import fastify, { type FastifyInstance } from 'fastify';
import { summaly } from '../src/index.js';
import { StatusError } from '../src/utils/status-error.js';
@ -36,6 +36,15 @@ process.on('unhandledRejection', console.dir);
let app: FastifyInstance | null = null;
function skippableTest(name: string, fn: () => void) {
if (process.env.SKIP_NETWORK_TEST === 'true') {
console.log(`[SKIP] ${name}`);
xtest(name, fn);
} else {
test(name, fn);
}
}
afterEach(async () => {
if (app) {
await app.close();
@ -77,7 +86,7 @@ test('basic', async () => {
});
});
test('Stage Bye Stage', async () => {
skippableTest('Stage Bye Stage', async () => {
// If this test fails, you must rewrite the result data and the example in README.md.
const summary = await summaly('https://www.youtube.com/watch?v=NMIEAhH_fTU');