Skip to content

Commit

Permalink
Adding vitest config and a test
Browse files Browse the repository at this point in the history
  • Loading branch information
cb1kenobi committed Sep 12, 2023
1 parent 09adea8 commit 3cd0045
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/tierror.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TiError } from '../src/util/tierror.js';
import { describe, expect, it } from 'vitest';

describe('TiError', () => {
it('should support no meta info', () => {
const e = new TiError('oh no');
expect(e.toString()).to.equal('Error: oh no');
});

it('should mix in meta info', () => {
const e = new TiError('oh no', { reason: 'something' });
expect(e.toString()).to.equal('Error: oh no');
expect(e.reason).to.equal('something');
});
});
14 changes: 14 additions & 0 deletions vitest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
coverage: {
reporter: ['html', 'lcov', 'text']
},
environment: 'node',
include: [
'test/**/*.test.js'
],
watch: false
}
});

0 comments on commit 3cd0045

Please sign in to comment.