Skip to content

Commit

Permalink
WIP: snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Kesin11 committed Nov 23, 2024
1 parent aca0c00 commit f65a16d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
19 changes: 9 additions & 10 deletions __tests__/snapshot.test.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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);
})
})
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down

0 comments on commit f65a16d

Please sign in to comment.