Skip to content

Commit d6a66cb

Browse files
committed
add temporary type casting
1 parent 28ca61a commit d6a66cb

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

tests/commands.test.ts

+7-6
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'),
@@ -77,17 +78,17 @@ test('Print compiler information', async () => {
7778
});
7879

7980
test('Print compiler information as JSON', async () => {
80-
const actual = (await MakeNSIS.headerInfo({ json: true })).stdout?.defined_symbols.__GLOBAL__;
81+
const actual = ((await MakeNSIS.headerInfo({ json: true })).stdout as Makensis.HeaderInfo).defined_symbols.__GLOBAL__;
8182
const expected = true;
8283

8384
assert.is(actual, expected);
8485
});
8586

8687
test('Print help for all commands', async () => {
87-
const output = await MakeNSIS.commandHelp();
88+
const { stdout } = await MakeNSIS.commandHelp() as { stdout: string };
8889

8990
const expected = shared.commandHelp?.replace(/\s+/g, '');
90-
const actual = output.stdout.replace(/\s+/g, '');
91+
const actual = stdout.replace(/\s+/g, '');
9192

9293
assert.is(actual, expected);
9394
});
@@ -245,7 +246,7 @@ test('Strict compilation with warning', async () => {
245246

246247
test('Print ${NSISDIR}', async () => {
247248
try {
248-
const nsisDir = await MakeNSIS.nsisDir();
249+
const nsisDir = await MakeNSIS.nsisDir() as string;
249250
const nsisCfg = path.join(nsisDir, 'Include', 'MUI2.nsh');
250251

251252
const expected = true;
@@ -259,8 +260,8 @@ test('Print ${NSISDIR}', async () => {
259260

260261
test('Print ${NSISDIR} as JSON', async () => {
261262
try {
262-
const nsisDir = await MakeNSIS.nsisDir({ json: true });
263-
const nsisCfg = path.join(nsisDir.nsisdir, 'Include', 'MUI2.nsh');
263+
const { nsisdir } = await MakeNSIS.nsisDir({ json: true }) as unknown as { nsisdir: string};
264+
const nsisCfg = path.join(nsisdir, 'Include', 'MUI2.nsh');
264265

265266
const expected = true;
266267
const actual = existsSync(nsisCfg);

tests/encoding.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test('Compile script with incorrect charset', async () => {
3434
const options = { ...defaultOptions, inputCharset: 'UTF16BE' };
3535

3636
try {
37-
const { status } = MakeNSIS.compile(script['utf8'], options);
37+
const { status } = await MakeNSIS.compile(script['utf8'], options) as { status: number };
3838

3939
const expected = 0;
4040
const actual = status;

tests/environment.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ test('Load magic environment variable from process', async () => {
3939
const { stdout } = await MakeNSIS.compile(scriptFile, {
4040
...defaultOptions,
4141
env: true,
42-
});
42+
}) as { stdout: string };
4343

4444
const expected = true;
4545
const actual = stdout.includes('NSIS_APP_MAGIC_ENVIRONMENT_VARIABLE') && stdout.includes(randomString);
@@ -58,7 +58,7 @@ test('Ignore magic environment variable', async () => {
5858
const { stdout } = await MakeNSIS.compile(scriptFile, {
5959
...defaultOptions,
6060
env: false,
61-
});
61+
}) as { stdout: string };
6262

6363
const expected = true;
6464
const actual = !stdout.includes(randomString);

0 commit comments

Comments
 (0)