Skip to content

Commit

Permalink
test: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 31, 2024
1 parent 1cdaa67 commit e0768a1
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 171 deletions.
5 changes: 0 additions & 5 deletions test/core/test/__snapshots__/repro2.test.ts.snap

This file was deleted.

48 changes: 0 additions & 48 deletions test/core/test/repro1.test.ts

This file was deleted.

21 changes: 0 additions & 21 deletions test/core/test/repro2.test.ts

This file was deleted.

17 changes: 0 additions & 17 deletions test/snapshots/test-update/__snapshots__/retry.test.ts.snap

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import { expect, test } from 'vitest'

test('inline repeats', { repeats: 1 }, () => {
expect('foo').toMatchInlineSnapshot()
})

test('inline retry', { retry: 1 }, (ctx) => {
expect('foo').toMatchInlineSnapshot()
if (ctx.task.result?.retryCount === 0) {
throw new Error('boom')
}
})

test('file repeats', { repeats: 1 }, () => {
expect('foo').toMatchSnapshot()
})
Expand Down
12 changes: 12 additions & 0 deletions test/snapshots/test-update/retry-inline.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { expect, test } from 'vitest'

test('inline repeats', { repeats: 1 }, () => {
expect('foo').toMatchInlineSnapshot(`"foo"`)
})

test('inline retry', { retry: 1 }, (ctx) => {
expect('foo').toMatchInlineSnapshot(`"foo"`)
if (ctx.task.result?.retryCount === 0) {
throw new Error('boom')
}
})
58 changes: 1 addition & 57 deletions test/snapshots/test/__snapshots__/test-update.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ it.concurrent('3rd', ({ expect }) => {
"
`;
exports[`retry.test.ts 1`] = `
exports[`retry-inline.test.ts 1`] = `
"import { expect, test } from 'vitest'
test('inline repeats', { repeats: 1 }, () => {
Expand All @@ -103,62 +103,6 @@ test('inline retry', { retry: 1 }, (ctx) => {
throw new Error('boom')
}
})
test('file repeats', { repeats: 1 }, () => {
expect('foo').toMatchSnapshot()
})
test('file retry', { retry: 1 }, (ctx) => {
expect('foo').toMatchSnapshot()
if (ctx.task.result?.retryCount === 0) {
throw new Error('boom')
}
})
test('file repeats many', { repeats: 1 }, () => {
expect('foo').toMatchSnapshot()
expect('bar').toMatchSnapshot()
})
test('file retry many', { retry: 1 }, (ctx) => {
expect('foo').toMatchSnapshot()
expect('bar').toMatchSnapshot()
if (ctx.task.result?.retryCount === 0) {
throw new Error('boom')
}
})
test('file retry partial', { retry: 1 }, (ctx) => {
expect('foo').toMatchSnapshot()
if (ctx.task.result?.retryCount === 0) {
throw new Error('boom')
}
expect('bar').toMatchSnapshot()
})
"
`;
exports[`same-title-file.test.js 1`] = `
"import { expect, test } from 'vitest'
test('same title exist', () => {
// correct entry exists in .snap
expect('a').toMatchSnapshot()
})
test('same title exist', () => {
// wrong entry exists in .snap
expect('b').toMatchSnapshot()
})
test('same title new', () => {
expect('a').toMatchSnapshot()
})
test('same title new', () => {
expect('b').toMatchSnapshot()
expect('c').toMatchSnapshot()
})
"
`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import { expect, test } from 'vitest'

test('inline repeats', { repeats: 1 }, () => {
expect('foo').toMatchInlineSnapshot(`"foo"`)
})

test('inline retry', { retry: 1 }, (ctx) => {
expect('foo').toMatchInlineSnapshot(`"foo"`)
if (ctx.task.result?.retryCount === 0) {
throw new Error('boom')
}
})

test('file repeats', { repeats: 1 }, () => {
expect('foo').toMatchSnapshot()
})
Expand Down
12 changes: 12 additions & 0 deletions test/snapshots/test/fixtures/test-update/retry-inline.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { expect, test } from 'vitest'

test('inline repeats', { repeats: 1 }, () => {
expect('foo').toMatchInlineSnapshot()
})

test('inline retry', { retry: 1 }, (ctx) => {
expect('foo').toMatchInlineSnapshot()
if (ctx.task.result?.retryCount === 0) {
throw new Error('boom')
}
})
2 changes: 1 addition & 1 deletion test/snapshots/test/test-update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { expect, test } from 'vitest'

const dir = join(import.meta.dirname, '../test-update')
const dirents = await fs.readdir(dir, { withFileTypes: true })
const files = dirents.filter(f => f.isFile()).map(f => f.name)
const files = dirents.filter(f => f.isFile() && f.name.includes('inline')).map(f => f.name)
test.for(files)('%s', async (file) => {
const content = await fs.readFile(join(dir, file), 'utf8')
expect(content).toMatchSnapshot()
Expand Down

0 comments on commit e0768a1

Please sign in to comment.