Skip to content

Commit 993afdc

Browse files
committed
run tests on typescript source
1 parent c8d7260 commit 993afdc

File tree

2 files changed

+24
-29
lines changed

2 files changed

+24
-29
lines changed

tests/test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { xmlValidator } from '../dist/index.js';
1+
import { xmlValidator } from '../src/index.ts';
22

33
import { resolve } from 'node:path';
44
import { test } from 'uvu';
55
import * as assert from 'uvu/assert';
66
import gulp from 'gulp';
7+
import type PluginError from 'plugin-error';
78

8-
function resolveFixture(fileName) {
9+
function resolveFixture(fileName: string) {
910
return resolve(process.cwd(), `tests/fixtures/${fileName}`);
1011
}
1112

@@ -16,7 +17,7 @@ test('should emit error on streamed file', async () => {
1617
gulp
1718
.src(fixture, { buffer: false })
1819
.pipe(xmlValidator())
19-
.once('error', (error) => resolve(error));
20+
.once('error', (error: PluginError) => resolve(error));
2021
});
2122

2223
assert.is(message, 'Streaming not supported');
@@ -40,7 +41,7 @@ test('fail on mismatching tags', async () => {
4041
gulp
4142
.src(fixture)
4243
.pipe(xmlValidator())
43-
.once('error', (error) => resolve(error));
44+
.once('error', (error: PluginError) => resolve(error));
4445
});
4546

4647
assert.ok(message.includes('\x1B[4mmismatching_tags.xml\x1B[24m: <warning> unclosed xml attribute'));
@@ -53,7 +54,7 @@ test('fail on missing close tags', async () => {
5354
gulp
5455
.src(fixture)
5556
.pipe(xmlValidator())
56-
.once('error', (error) => resolve(error));
57+
.once('error', (error: PluginError) => resolve(error));
5758
});
5859

5960
assert.ok(message.includes('\x1B[4mmissing_close_tag.xml\x1B[24m: <warning> unclosed xml attribute'));
@@ -66,7 +67,7 @@ test('fail on missing quote', async () => {
6667
gulp
6768
.src(fixture)
6869
.pipe(xmlValidator())
69-
.once('error', (error) => resolve(error));
70+
.once('error', (error: PluginError) => resolve(error));
7071
});
7172

7273
assert.ok(
@@ -83,7 +84,7 @@ test('fail on invalid tag', async () => {
8384
gulp
8485
.src(fixture)
8586
.pipe(xmlValidator())
86-
.once('error', (error) => resolve(error));
87+
.once('error', (error: PluginError) => resolve(error));
8788
});
8889

8990
assert.ok(

tsconfig.json

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
{
2-
"compilerOptions": {
3-
"target": "es2020",
4-
"module": "es2020",
5-
"moduleResolution": "node",
6-
"declaration": true,
7-
"outDir": "dist",
8-
"strict": true,
9-
"esModuleInterop": true,
10-
"forceConsistentCasingInFileNames": true,
11-
"resolveJsonModule": true,
12-
"skipLibCheck": true,
13-
"types": ["node", "vinyl"]
14-
},
15-
"include": [
16-
"src"
17-
],
18-
"exclude": [
19-
"node_modules",
20-
"**/__tests__/*",
21-
"**/*.test.ts"
22-
]
2+
"compilerOptions": {
3+
"allowImportingTsExtensions": true,
4+
"declaration": true,
5+
"esModuleInterop": true,
6+
"forceConsistentCasingInFileNames": true,
7+
"module": "es2020",
8+
"moduleResolution": "node",
9+
"outDir": "dist",
10+
"resolveJsonModule": true,
11+
"skipLibCheck": true,
12+
"strict": true,
13+
"target": "es2020",
14+
"types": ["node", "vinyl"]
15+
},
16+
"include": ["src", "tests"],
17+
"exclude": ["node_modules", "**/__tests__/*", "**/*.test.ts"]
2318
}
24-

0 commit comments

Comments
 (0)