From f65a16df981420bc537e69e3de9bbdcb9a1f4547 Mon Sep 17 00:00:00 2001 From: Kenta Kase Date: Sat, 23 Nov 2024 18:00:24 +0900 Subject: [PATCH] WIP: snapshot --- __tests__/snapshot.test.ts | 19 +++++++++---------- package.json | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/__tests__/snapshot.test.ts b/__tests__/snapshot.test.ts index 39fe778..8e083b4 100644 --- a/__tests__/snapshot.test.ts +++ b/__tests__/snapshot.test.ts @@ -1,8 +1,7 @@ import * as junit2json from '../src/index.ts' import * as fs from 'node:fs' import * as path from 'node:path' -import { describe, it } from 'node:test'; -import assert from 'node:assert/strict'; +import { describe, it, test } from 'node:test'; import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); @@ -13,31 +12,31 @@ const fixturePath = (fixtureName: string) => { } describe('parse snapshot', () => { - it('all success xml', async () => { + test('all success xml', async (t) => { const xml = fs.readFileSync(fixturePath('jest-success.xml')) const parsed = await junit2json.parse(xml) - assert.snapshot(parsed, { description: 'all success xml snapshot' }); + t.assert.snapshot(parsed); }) - it('jest failure xml', async () => { + test('jest failure xml', async (t) => { const xml = fs.readFileSync(fixturePath('jest-failure.xml')) const parsed = await junit2json.parse(xml) - assert.snapshot(parsed, { description: 'jest failure xml snapshot' }); + t.assert.snapshot(parsed); }) - it('nunit failure xml', async () => { + test('nunit failure xml', async (t) => { const xml = fs.readFileSync(fixturePath('nunit-failure.xml')) const parsed = await junit2json.parse(xml) - assert.snapshot(parsed, { description: 'nunit failure xml snapshot' }); + t.assert.snapshot(parsed); }) - it('Android robolectric success xml', async () => { + test('Android robolectric success xml', async (t) => { const xml = fs.readFileSync(fixturePath('android-robolectric-success.xml')) const parsed = await junit2json.parse(xml) - assert.snapshot(parsed, { description: 'Android robolectric success xml snapshot' }); + t.assert.snapshot(parsed); }) }) diff --git a/package.json b/package.json index c4c3574..9388e19 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ "scripts": { "clean": "rm -rf dist", "build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && tsconfig-to-dual-package", - "test": "node --test --experimental-strip-types", - "test:watch": "node --test --experimental-strip-types --watch", + "test": "node --test --experimental-strip-types --experimental-test-snapshots", + "test:watch": "node --test --experimental-strip-types --experimental-test-snapshots --watch", "doc": "deno doc --unstable-byonm --unstable-sloppy-imports --html --name=junit2json src", "doc:lint": "deno doc --unstable-byonm --unstable-sloppy-imports --lint src", "integrate_test": "node --test integrate_tests/",