mirror of
https://github.com/misskey-dev/summaly.git
synced 2025-04-29 10:47:25 +09:00
fix(test): Github Actions上で外部サイトへの取得を行うテストをスキップするように (#38)
This commit is contained in:
parent
fc9f7db477
commit
71a6aefb8e
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -31,4 +31,4 @@ jobs:
|
|||||||
pnpm build
|
pnpm build
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
pnpm test
|
SKIP_NETWORK_TEST=true pnpm test
|
||||||
|
@ -12,7 +12,7 @@ import { dirname } from 'node:path';
|
|||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { Agent as httpAgent } from 'node:http';
|
import { Agent as httpAgent } from 'node:http';
|
||||||
import { Agent as httpsAgent } from 'node:https';
|
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 fastify, { type FastifyInstance } from 'fastify';
|
||||||
import { summaly } from '../src/index.js';
|
import { summaly } from '../src/index.js';
|
||||||
import { StatusError } from '../src/utils/status-error.js';
|
import { StatusError } from '../src/utils/status-error.js';
|
||||||
@ -36,6 +36,15 @@ process.on('unhandledRejection', console.dir);
|
|||||||
|
|
||||||
let app: FastifyInstance | null = null;
|
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 () => {
|
afterEach(async () => {
|
||||||
if (app) {
|
if (app) {
|
||||||
await app.close();
|
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.
|
// 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');
|
const summary = await summaly('https://www.youtube.com/watch?v=NMIEAhH_fTU');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user