Skip to content

Commit 9a89da9

Browse files
committed
improve test types
1 parent 791cf2c commit 9a89da9

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

tests/commands.test.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { test } from 'uvu';
55
import * as assert from 'uvu/assert';
66
import * as MakeNSIS from '../src/makensis';
77
import path from 'node:path';
8+
import type Makensis from '../types';
89

910
const scriptFile = {
1011
minimal: path.join(process.cwd(), 'tests', 'fixtures', 'utf8.nsi'),
@@ -38,7 +39,6 @@ test('Print makensis version as JSON', async () => {
3839
expected = JSON.stringify({ version: expected });
3940

4041
let actual = stdout;
41-
actual.version = `${actual.version}`;
4242
actual = JSON.stringify(actual);
4343

4444
assert.is(actual, expected);
@@ -63,7 +63,6 @@ test('Print makensis license as JSON', async () => {
6363
expected = JSON.stringify({ license: expected });
6464

6565
let actual = stdout;
66-
actual.license = `${actual.license}`;
6766
actual = JSON.stringify(actual);
6867

6968
assert.is(actual, expected);
@@ -79,7 +78,7 @@ test('Print compiler information', async () => {
7978
});
8079

8180
test('Print compiler information as JSON', async () => {
82-
const actual = (await MakeNSIS.headerInfo({ json: true })).stdout.defined_symbols.__GLOBAL__;
81+
const actual = (await MakeNSIS.headerInfo({ json: true })).stdout?.defined_symbols.__GLOBAL__;
8382
const expected = true;
8483

8584
assert.is(actual, expected);
@@ -198,7 +197,7 @@ test('Compilation with warning as JSON', async () => {
198197
test('Compilation with raw arguments and warning', async () => {
199198
try {
200199
const { status } = await MakeNSIS.compile(scriptFile.warning, {
201-
rawArguments: ['-WX'],
200+
rawArguments: '-WX',
202201
});
203202

204203
const expected = 1;
@@ -261,7 +260,7 @@ test('Print ${NSISDIR}', async () => {
261260

262261
test('Print ${NSISDIR} as JSON', async () => {
263262
try {
264-
const nsisDir = await MakeNSIS.nsisDir({ json: true });
263+
const nsisDir = await MakeNSIS.nsisDir({ json: true }) as Makensis.CompilerOutput;
265264
const nsisCfg = path.join(nsisDir.nsisdir, 'Include', 'MUI2.nsh');
266265

267266
const expected = true;

tests/encoding.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import { test } from 'uvu';
44
import * as assert from 'uvu/assert';
55
import * as MakeNSIS from '../src/makensis';
66
import path from 'node:path';
7+
import type Makensis from '../types';
78

89
// Compiler arguments
910
const script = {
1011
// cp850: join(__dirname, 'fixtures', 'cp850.nsi'),
1112
utf8: path.join(process.cwd(), 'tests', 'fixtures', 'utf8.nsi'),
1213
};
1314

14-
const defaultOptions = {
15+
const defaultOptions: Makensis.CompilerOptions = {
1516
strict: true,
1617
define: {
1718
NULL_DEVICE: nullDevice,

tests/environment.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import * as MakeNSIS from '../src/makensis';
88
import path from 'node:path';
99
import which from 'which';
1010

11+
import type Makensis from '../types';
12+
1113
const scriptFile = path.join(process.cwd(), 'tests', 'fixtures', 'env.nsi');
1214

13-
const defaultOptions = {
15+
const defaultOptions: Makensis.CompilerOptions = {
1416
define: {
1517
NULL_DEVICE: nullDevice,
1618
},

0 commit comments

Comments
 (0)